Solved

'Rubber band rectangle' problem

Posted on 2007-03-28
5
484 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now