Get IDLgrText size [message #43403] |
Tue, 12 April 2005 07:31  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
Hi,
Is there a way to obtain the size of screen that use an IDLgrText object
before it was drawed?
I'm creating an IDLgrText object and drawing on a window. Then I consult
its XRANGE property to know the screen size it occupies. All is ok.
The problem is I need to know its screen size before draw it, and seems,
it only be know before the object is drawed.
Thanks,
Antonio.
|
|
|
Re: Get IDLgrText size [message #43456 is a reply to message #43403] |
Thu, 14 April 2005 08:26  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
> Unless I am missing something you can still draw twice. Create the
> text, draw, create the box and add it to the model containing the text
> and draw again. They will in effect be drawn at the same time since the
> redraw would be so quick.
>
> Another option would be to create a "boxed text" object which is a
> subclass of IDLgrModel. Override the superclass draw method such that
> if it is the first time being called (or text parameters have changed)
> you modify your box dimensions. This would be the way to go if you were
> going to use this often.
>
Finally I use the way for the IDLgrBuffer. Well, all seems pretty
beautyful. This is a link to my new weblog with a screenshot:
http://asantiago.bitacoras.com/archivos/2005/04/14/an_idl_ca nvas_screenshot
Bye,
Antonio.
|
|
|
Re: Get IDLgrText size [message #43468 is a reply to message #43403] |
Wed, 13 April 2005 09:23  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Tue, 12 Apr 2005 16:31:13 +0200, Antonio Santiago wrote:
> Hi,
>
> Is there a way to obtain the size of screen that use an IDLgrText object
> before it was drawed?
You might look into IDLgrWindow::GetTextDimensions
|
|
|
Re: Get IDLgrText size [message #43469 is a reply to message #43403] |
Wed, 13 April 2005 09:14  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Antonio Santiago wrote:
>
>> Why not draw the text, get the dimensions, then draw the rectangle
>> based on those dimensions? Am I missing something?
>>
>
> Because I'm creating objects composed by two elements (or two objects
> more) a rectangle and a text. Then I can't draw one element and then the
> other because I need to draw both at a time (the complete object).
Unless I am missing something you can still draw twice. Create the
text, draw, create the box and add it to the model containing the text
and draw again. They will in effect be drawn at the same time since the
redraw would be so quick.
Another option would be to create a "boxed text" object which is a
subclass of IDLgrModel. Override the superclass draw method such that
if it is the first time being called (or text parameters have changed)
you modify your box dimensions. This would be the way to go if you were
going to use this often.
> I'm working with the previous IDLgrBuffer option.
This works too :)
-Rick
|
|
|
Re: Get IDLgrText size [message #43480 is a reply to message #43403] |
Tue, 12 April 2005 22:56  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
> Why not draw the text, get the dimensions, then draw the rectangle based
> on those dimensions? Am I missing something?
>
Because I'm creating objects composed by two elements (or two objects
more) a rectangle and a text. Then I can't draw one element and then the
other because I need to draw both at a time (the complete object).
I'm working with the previous IDLgrBuffer option.
Bye.
|
|
|
Re: Get IDLgrText size [message #43486 is a reply to message #43403] |
Tue, 12 April 2005 12:47  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Antonio Santiago wrote:
> Ok, I probe with:
>
>> A) draw it to an IDLgrBuffer
>
>
> I suposse the right thing is to assign the same resolution to the
> IDLgrBuffer as the IDLgrWindow I will draw later.
>
> Thanks.
>
>
> PS: I want to draw "objects" compossed for a text inside a rectangle.
> Then before to draw on screen both objects, I need to know the
> dimensions of the text to create an adapted rectangle.
Why not draw the text, get the dimensions, then draw the rectangle based
on those dimensions? Am I missing something?
-Mike
|
|
|