[lazarus] CVS changes

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Feb 22 08:55:40 EST 2002


On Fri, 22 Feb 2002 11:30:25 +0100
Jens Arm <Jens.Arm at gmx.de> wrote:

> > > Now I noticed that non-visual components do not work well
> > > with designer.
> > > I think about implementing those visually as TButtons/TSpeedButtons,
> > > instead of drawing them directly as currently implemented.
> > > Does anybody think this is a bad idea? Any comments?
> > > Current state does not work well and is overly complicated, so I
> > > think there is little to lose.
> > 
> > Just a thought...
> > Why dragging the components itself ? Why not like delphi, only draw a
> > rectangle ?

The dragging of components is a different problem than the non visual components.

Shane and I do not like the Delphi way. We want realtime wysiwyg. The problem is, that some gtk widgets work differently (mouse capturing), which is IMO a bug in the gtk-interface. 

There are several beasty component bugs, that prevent smooth designing:
- Some components has problems with mouse capturing. They capture the focus/mouse themselves. This prevents selection, dragging and shortcuts.
- Some components reports wrong mouse coordinates. This prevents dragging.
- Some components can be dragged, but they don't like to be painted. This prevents drawing grabbers and rubberband.

I'm sure, these problems can be solved. But the problem is somewhat bigger:
- Everytime a new component is added, the component works nice in an application, but not in design mode.
- This is especially true for new interfaces.

I think, everyone agrees, that if a component works in an application, the IDE should find a way to handle it also in the designer. Even if that means, the component works somewhat different in design mode.

So, here is my suggestion:
The IDE should ask the LCL, if the interface sees any problems in capturing or drawing a component.
That means, we add to TWinControl a 
function InterfaceFlags: TInterfaceControlFlags;
TInterfaceControlFlags = set of TInterfaceControlFlag.
TInterfaceControlFlag = (icfNoRealTimeResize, icfFakeDesign);

icfNoRealTimeResize:
 the designer should draw a rectangle for this component while resizing.

icfFakeDesign:
 in design mode, this component will be not the real widget, but a default widget (e.g. a button). For example: there is component TSpoilsport, which captures the mouse and is always on top. So you can not draw grabers on it and you can not click to select TSpoilsport. When TSpoilsport is created and the form is in design mode, the interface will set the icfFakeDesign flag and creates instead of a TSpoilsport-widget a normal button with the caption: "TSpoilsport". So, in the form editor the component will appear as button, which functions very nice. That means, the LCL can handle this component normally, but the handle will be that of a button. The object inspector shows the properties of a TSpoilsport component.
This way, the IDE will be able to handle all kinds of controls in very short time.
This flag is probably not used by the designer, but the LCL code should know.

I also suggest to add a preview design mode. That means, the IDE can show the user at any time a form with the real components, which is of course not editable. 


Mattias






More information about the Lazarus mailing list