New topic: 

how can I draw a rectangle around the control

<http://forums.realsoftware.com/viewtopic.php?t=26365>

       Page 1 of 1
   [ 8 posts ]                 Previous topic | Next topic         Author  
Message       pentium10           Post subject: how can I draw a rectangle 
around the controlPosted: Sat Feb 07, 2009 5:05 pm                              
 
Joined: Tue Jan 03, 2006 10:38 am
Posts: 331              Hello,

I want to highlight an invalid control automatically, and I have in mind to 
draw a red rectangle around the control.
How can I do that?

Or do you have better idea?

Regards,
Pentium10   
                            Top               tomis           Post subject: Re: 
how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 5:37 pm   
                            
Joined: Thu Jul 27, 2006 6:31 pm
Posts: 1340
Location: Monterey, CA              Use the canvas.Paint event and 
canvas.graphics see the Graphics object in the Language Reference if you're not 
familiar with it.

If you need to display several of these outlines then use a canvas control 
array.     
_________________
ImagePlay Effects Library (40+ image effects in one open source module. No 
plugins, no dependencies, no restrictions.) 
http://imageplay.sourceforge.net/  
                            Top               pentium10           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 5:40 
pm                               
Joined: Tue Jan 03, 2006 10:38 am
Posts: 331              How do I gain access to the control's graphics object, 
or to the window's graphic object?

I mention again, I want to do it automatically, and I would know how to draw 
it. I have problems how to get there, to be a flexible enough and portable 
enough. 
Ideally I would like to push somewhere the control's reference, and that should 
get painted around.   
                            Top               timhare           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 5:50 
pm                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 4348
Location: Portland, OR  USA              You don't have access to most controls 
graphics context.  You can place each control on a canvas.  Or you can always 
access the window's graphics object.  It's best to set some variables and use 
the Window.Paint event, rather than drawing directly, though.

Tim   
                            Top               pentium10           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 5:54 
pm                               
Joined: Tue Jan 03, 2006 10:38 am
Posts: 331              So I should save the coordinates of the controls to an 
array, and when the window's paint event fires, I use the coordinates to draw a 
rectangle around rect controls?
This sounds ok to you?   
                            Top               timhare           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 6:09 
pm                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 4348
Location: Portland, OR  USA              That's the right idea.  You can save 
the coordinates, or save a reference to the controls themselves.  Either way 
should work; choose the one that works best for you.

Tim   
                            Top               pentium10           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 6:13 
pm                               
Joined: Tue Jan 03, 2006 10:38 am
Posts: 331              how do I handle absolute coordinates of an embedded 
control to containers, panels?   
                            Top               timhare           Post subject: 
Re: how can I draw a rectangle around the controlPosted: Sat Feb 07, 2009 6:20 
pm                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 4348
Location: Portland, OR  USA              You walk up the stack of .Window 
properties and accumulate Left and Top.
Code:dim X, Y as integer
dim w as window
X= me.Left
Y= me.Top
w= me.Window
while w ISA ContainerControl
  X= X+ w.Left
  Y= Y+ w.Top
  w= w.Window
wend


I don't know if you need to do this with the .Parent property, too.  You'll 
have to test it.

Tim   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 8 posts ]     

-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to