Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

'Rubber band rectangle' problem

Posted on 2007-03-28
5
Medium Priority
?
512 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

Hire Technology Freelancers with Gigs

Work with 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
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

618 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