 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
dhantz Guest
|
Posted: Wed Jun 08, 2005 12:30 pm Post subject: How to use CanAutoSize method |
|
|
Please help me about CanAutoSize method...I have no idea what are the things I can code inside the CanAutoSize method..in the help file it tells that it compares the new height and width parameters to the old height and width of the control..but how can I find that control?
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Jun 08, 2005 5:24 pm Post subject: Re: How to use CanAutoSize method |
|
|
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote
| Quote: | Please help me about CanAutoSize method.
|
In regards to what exactly? You need to be more specific.
Gambit
|
|
| Back to top |
|
 |
dhantz Guest
|
Posted: Thu Jun 09, 2005 12:06 am Post subject: Re: How to use CanAutoSize method |
|
|
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
| Quote: |
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote in message
news:42a6e4ea$1 (AT) newsgroups (DOT) borland.com...
Please help me about CanAutoSize method.
In regards to what exactly? You need to be more specific.
Gambit
thanks for the reply... |
How can I overwrite it? Do I also need to overwrite
the AutoSize property?
How can I use it? Do I need to instantiate another
TControl inside of its implementation:
TControl *tmpControl = TControl(this);
tmpControl->Height = NewHeight;
tmpControl->Width = NewWidth;
Are these correct?
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jun 09, 2005 3:06 am Post subject: Re: How to use CanAutoSize method |
|
|
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote
| Quote: | How can I overwrite it?
|
For what purpose exactly? In which control exactly? You are being WAY too
vague in your questions. What EXACTLY are you trying to accomplish in the
first place?
Gambit
|
|
| Back to top |
|
 |
dhantz Guest
|
Posted: Thu Jun 09, 2005 5:30 am Post subject: Re: How to use CanAutoSize method |
|
|
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
| Quote: |
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote in message
news:42a787f3$1 (AT) newsgroups (DOT) borland.com...
How can I overwrite it?
For what purpose exactly? In which control exactly? You are being WAY too
vague in your questions. What EXACTLY are you trying to accomplish in the
first place?
Gambit
I have custom control and I want to know its min width and |
height without modifying the custom control itself...where
there are no fixed value given as the min width and height
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jun 09, 2005 6:51 am Post subject: Re: How to use CanAutoSize method |
|
|
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote
| Quote: | I have custom control and I want to know its min width and
height without modifying the custom control itself...where
there are no fixed value given as the min width and height
|
That is the same thing you said earlier, that it wasn't very helpful the
first time around.
Again, what EXACTLY are you trying to accomplish? Your description is still
too vague. And why do you want to override the behavior in the first place?
Please provide an actual example.
Gambit
|
|
| Back to top |
|
 |
mickey Guest
|
Posted: Thu Jun 09, 2005 7:15 am Post subject: Re: How to use CanAutoSize method |
|
|
Hi all!
<its been a while since i checked this group,
nice to be around again... yada yada yada>
i think i might have an idea (well, coz i 'practically'
have the same trouble).
i have this custom control, that adjusts it's size
internally (in it's Paint() function).
it does this because it needs to make sure that
it's text is always visible: so when you resize it into
something smaller than the text, the control automatically
adjusts to it's minimum.
i have no direct way of getting the minimum width of the
control during runtime, since it is 'implicitly' done
by computation inside it's Paint() method.
ironically, that is the exact thing that i need to find out:
the minimum width and height.
one not-so-good idea is to:
1. set the control's width to 0.
2. the control resizes, not to zero but to it's minimum,
3. therefore, the current width is the minumum.
in code, it would look like this...
#################################################
int GetMinimumWidthOfControl(TControl *ctrl)
{
//some checking here
ctrl->Width = 0; //try to adjust to the smallest possible
//the control, would internally change the desired width
return ctrl->Width; //the control is now at it's min
}
#################################################
the problem with this, is that the control was already
resized to it's minimum before i actually find out.
i only need to get the minimum width, without resizing
the control. i could probably do that using a temporary
control - but i guess that would be inefficient.
i need it for some testing/condition.
anyhoo, it would be a great help (for both of us).
Thanks.
Happy Programming! :)
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
| Quote: |
"dhantz" <danacericafort_15 (AT) yahoo (DOT) com> wrote in message
news:42a7d403$1 (AT) newsgroups (DOT) borland.com...
I have custom control and I want to know its min width and
height without modifying the custom control itself...where
there are no fixed value given as the min width and height
That is the same thing you said earlier, that it wasn't very helpful the
first time around.
Again, what EXACTLY are you trying to accomplish? Your description is still
too vague. And why do you want to override the behavior in the first place?
Please provide an actual example.
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jun 09, 2005 5:42 pm Post subject: Re: How to use CanAutoSize method |
|
|
"mickey" <mickeymicks (AT) hotmail (DOT) com> wrote
| Quote: | i have this custom control, that adjusts it's size
internally (in it's Paint() function).
|
You should not be resizing the control while painting it. Those are
completely separate operations and need to be kept separate.
| Quote: | it does this because it needs to make sure that
it's text is always visible
|
Then resize the control when the text is assigned, not when it is being
painted.
| Quote: | so when you resize it into something smaller than the
text, the control automatically adjusts to it's minimum.
|
You can override SetBounds() for that. Or just assign the
MinWidth/MinHeight values of the control's Constraints property.
| Quote: | i have no direct way of getting the minimum width of
the control during runtime
|
Yes, you can.
| Quote: | since it is 'implicitly' done by computation inside it's Paint() method.
|
Wrong, wrong, wrong.
Gambit
|
|
| Back to top |
|
 |
dhantz Guest
|
Posted: Thu Jun 09, 2005 11:56 pm Post subject: Re: How to use CanAutoSize method |
|
|
| Quote: | i have no direct way of getting the minimum width of
the control during runtime
Yes, you can.
|
Is SetBounds() the answer for this?
|
|
| Back to top |
|
 |
mickey Guest
|
Posted: Fri Jun 10, 2005 12:55 am Post subject: Re: How to use CanAutoSize method |
|
|
| Quote: | You should not be resizing the control while painting it. Those are
completely separate operations and need to be kept separate.
|
-i have the source of that certain custom control, and that's
what it exactly does. but i don't want to change the code
(it's not mine, actually).
but i do agree that they should have been separate.
| Quote: | i have no direct way of getting the minimum width of
the control during runtime
Yes, you can.
|
How do i do that?
the control i have doesn't override or do anything about
resizing except in its Paint() method.
I tried checking the Constraints->MinWidth property at
runtime, but it only returns zero. i could change it, yes
but that's not what i want.
| Quote: | Wrong, wrong, wrong.
okay, okay, okay. i get it <no need to rub it in>. |
hehehe. peace :)
sorry, there's still a lot of things i need to learn
about component creation. ->im actually, satisfied
by simply borrowing from third parties.
hmmm... come to think of it, since i really dont want
to modify the control's code - maybe i should have posted
to the vcl.using() group.
anyhow, thanks for the reply.
Happy Programming! :)
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|