Home » U++ TheIDE » U++ TheIDE: Layout (Forms) Designer » A (maybe) dummy idea about widgets and control manager
A (maybe) dummy idea about widgets and control manager [message #11476] |
Sat, 15 September 2007 09:36  |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Lurking into IDE code, I've seen (if I'm right) that to draw controls on layout manager you use .usc files, that in practice duplicates the behaviour of drawing routines of controls just to show them at design time.
As I did write some delphi/bc++ controls for Borland tools in the past, I've noticed that they used a quite smart way to spare code.
Theyr controls all have (in base class) an 'in-designer' flag that changes the behaviour of control when it's in designing state.
This brings some advantages :
1- The most obvious : the control can paint by itself when put on the designer. No need to add external code to show it. And it's wysiwyg.
2- Mouse/keyboard events in design mode are not handled on the usual way, but redirected to the designer itself, so for example a button don't get clicked but can be moved/stretched on the designer
3- Having the true control on the designer (and not a graphical copy of it), with some RTTI you can set ALL the properties inside designer, with about no extra code.
Of course, borland put some language extensions in his products that allow things to be easy, in particular mode the __property extension. But it can be done also without extensions, it needs only RTTI and some conventions for property getters/setters
(for example, for a property called Color, should be getColor and setColor; borland simplifies it with a member property Color that calls automatically get/set when rode/written).
The base properties of a widget (position, size, anchors, parent widget) should be in the base class, so inherited by all widgets and handled by layout designer.
There is also a drawback in this approach : a buggy control can hang the ide completely, if no care is taken.
Mirek, if you think that it would be an interesting approach, I can try to make it working.... not an easy task anyways.
Ciao
Max
|
|
|
Goto Forum:
Current Time: Sat Apr 26 03:37:04 CEST 2025
Total time taken to generate the page: 0.04476 seconds
|