[Gambas-devel] Design property

Benoit Minisini gambas at ...1...
Fri Apr 4 09:07:03 CEST 2008


On vendredi 4 avril 2008, Robert Rowe wrote:
> What I'd like to do is to display a button on the control at design
> time. When the developer clicks the button it brings up a GUI that lets
> them create/edit the tools on the toolbar. I'd save these settings
> somewhere. Either in the form file or another file in the project's data
> directory. The control would look for this file at runtime and load the
> tools from it. I hope to provide codeless setup and use of the toolbar.
>
> I can't seem to get any code that I put into a
>
> If me.Design Then
>
> block to run. I've also tried me.parent.design within the primary
> control in my component. This doesn't run either.
>
> Any suggestions?
>
> Robert Rowe
>

This is not possible at the moment. All controls put in the form editor are 
their Design property set, and so become completely insensitive.

Actually you are two cases:

- If the control belongs to a component used by the IDE, then the IDE displays 
it with the Design property set.

- Otherwise, the IDE uses a DrawingArea instead, and draws the control icon 
inside, with its name.

But all is managed by the IDE code.

If you want something like that, you must modify the IDE this way:

- Some controls can be configured by a dialog box. Not only yours, but for 
example we can imagine that ColumnView initial columns properties could be 
defined by a dialog box, as in VB.

- The configuration dialog box are defined inside the IDE source code, by 
using the control class inside the form name: FConfigureColumnView, 
FConfigureRobertToolBar, and so on... This is not so horrible, as these 
dialog boxes are useful only inside the IDE.

- A "Configure" button inside a "simulated" property should be added to the 
property sheet for this control.

- These dialog boxes should provide a routine that creates the data for the 
*.form file, and do the contrary: extract from the *.form file the 
configuration data. This is the most complex part of the story, as each line 
of the *.form file is actually part of a Gambas line of code (setting a 
property usually), and so some trick must be added to the read/write routines 
of the FForm form.

Let's come back to your UCToolbar now: why didn't you take the Toolbar code 
and just modified it? You would have got a normal container.

And as I told you before, modifying the Action class can make this control 
useless. Not the code itself, as it could be moved to the Toolbar control. 
But then it would take its data directly from the Action class (label, icons, 
shortcuts...). The job is then to make a dialog box for defining all action 
properties (a bit like the menu dialog editor).

What do you think about that?

If you want to continue working on that and rewriting your code, I will start 
to work on the Action class so that you can do that easily.

-- 
Benoit Minisini




More information about the Devel mailing list