?
Solved

'Rubber band rectangle' problem

Posted on 2007-03-28
5
Medium Priority
?
510 Views
Last Modified: 2010-04-05
Dear Experts,

Thanks to you all I have a new feature in my application:  
To select text of a canvas with the mouse by creating a
'Rubber band rectangle'. And it works good.

When I have asked the questions on this site to make a
'Rubber band rectangle' I used  a TImage to draw on.

But, now I have deside not to use the TImage anymore to
draw on, but drawing on the form's canvas itself.

By drawing on the form's canvas, the 'Rubber band rectangle'
works like a clock, much better then using the TImage.

But one little problem occurs. When I use menu-item Select All
or create a 'Rubber band rectangle' with the mouse to select text
you see also the ROWS and COlUMNS. And that's nog good.
Who can help me to solve this problem?

If you don't know what I mean, you can download my example
on my site: http://members.home.nl/peterkiers/
(Beneath the Under Construction Bar you see a floppy disk).

Select menu-item Fill buffer to display characters on the canvas
and select them by clicking on menu-item Select All or use your
mouse. And you see the selected text will be highlighted but
you see also the rows and colums, and that is not what i want.

Who can help me solve this problem?

Thank you in advanced,

Greetings,

Peter Kiers




0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Author Comment

by:peterkiers
ID: 18813464
I have added a picture on my site to let you see what happens
if text is selected.

P.
0
 
LVL 12

Expert Comment

by:Sinoj Sebastian
ID: 18813750
What about this?
http://i10.tinypic.com/2hr2y5t.jpg
any problem?
Should be some problem related to font. Try using different font.
0
 
LVL 10

Accepted Solution

by:
dinilud earned 2000 total points
ID: 18813784
procedure TMainForm.DispCell(x, y: integer; PaintBlanks: boolean);
var
  xpos, ypos: integer;
begin
  xpos := (x * FontWidthPix) - FontWidthPix;
  ypos := (y * FontHeightPix) - FontHeightPix;
  with Canvas do
  begin
    Brush.Style := bsSolid;
    Brush.Color := ColorBlack;
    Pen.Color:=clBlack;
    if (ScrBuf[y, x].data = Char(cdDefault)) or
      (ScrBuf[y, x].data = Char(cdFieldAttr)) then
    begin
      if PaintBlanks then
      begin
        Font.Style := [];
        TextOut(xpos, ypos, ' ');
      end;
    end
    else
    begin
      if (Byte(ScrBuf[y, x].attrib) and caNonDisp) <> caNonDisp then
      begin
        Pen.Mode := pmCopy;
        Font.Color := ColorMapI2W(ScrBuf[y, x].color);
        if ScrBuf[y, x].hilite = Char(chDefault) then
          Font.Style := []
        else if ScrBuf[y, x].hilite = Char(chReverse) then
        begin
          Font.Style := [];
          //Pen.Mode := pmXor;
          Brush.Color := ColorMapI2W(ScrBuf[y, x].color);
          Pen.Color :=Brush.Color;
          Font.Color := ColorBlack;
        end
        else if ScrBuf[y, x].hilite = Char(chUnderLine) then
          Font.Style := [fsUnderline]
        else if ScrBuf[y, x].hilite = Char(chBlink) then
          Font.Style := [fsStrikeout]
        else
          Font.Style := [];
        if (Byte(ScrBuf[y, x].attrib) and caIntens) = caIntens then
          Font.Style := Font.Style + [fsBold];
        Rectangle(xpos,YPos,xpos+FontWidthPix, ypos+FontHeightPix);
        TextOut(xpos, ypos, ScrBuf[y, x].data);
      end
      else
        TextOut(xpos, ypos, ' ');
    end;
  end;
end;
0
 
LVL 1

Author Comment

by:peterkiers
ID: 18814016
Hi, with your code the problem is solved only
The cursor has vanished. When I click on a cell
there is no cursor anuymore.

Peter


0
 
LVL 1

Author Comment

by:peterkiers
ID: 18814275
ah, I have solved it myself
dinilud thank you.

Greetings,

Peter Kiers
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question