Solved

'Rubber band rectangle' problem

Posted on 2007-03-28
5
492 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
  • 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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