Home » Community » Newbie corner » Control with fixed rate Height/Width
Re: Control with fixed rate Height/Width [message #32587 is a reply to message #32519] |
Thu, 26 May 2011 10:19   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
*.usc files are the U++ own ESC language files (go to manual for it), they serve TheIDE as a description how to show custom (or builtin) Ctrl's in Layout editor.
to achieve your goal, you need to derive the desired class overriding the Layout() function from Ctrl and specifying new size of the control based on lets say the x size.
maybe sth like that.
class MyEdit : public EditString
{
virtual void Layout()
{
Rect r = GetRect();
r.y = 0.5*x;
SetRect(r);
}
};
what kolde meant is, that Layout editor wont be aware of your custom Layout function, in case you place your widget as a user class Ctrl on a layout. so it will be arbitrary resizeable in Layout Editor but will behave accordingly at runtime.
BTW: SetRect always Sets your Ctrl LogPos as to be LeftPos().TopPos() aligned. if you want sth more specific, you need to dig the LogPos facilities. see my LogPosCtrl package, there you will find some ressources on how to handle LogPos properly recalculating it based on alignment and Rect position.
[Updated on: Thu, 26 May 2011 10:22] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 18:36:04 CEST 2025
Total time taken to generate the page: 0.04126 seconds
|