[Gambas-user] Configure method of ToolBar

Benoît Minisini gambas at ...1...
Tue Dec 3 01:27:00 CET 2013


Le 03/12/2013 00:41, Jesus a écrit :
> El 01/12/13 16:54, Jesus escribió:
>> Hi all
>>
>> I'm trying to get up and running a project which have a Toolbar and some
>> toolbuttons in it. I'd like to mimic the same behavior toolbars have in
>> Gambas' IDE. I've read the docs about Toolbar (gb.form.mdi) but calling
>> the configure method throws an error aborting my application.
>> BTW, all the toolbuttons have set an Action property, but note that I
>> haven't any workspace in the main form, just the toolbar.
>>
>> This is the code I'm using in a minimal test application:
>> ------8<----------------------------------
>> Public Sub ToolBar1_MouseDown()
>>
>>        If Mouse.Right Then ToolBar1.Configure
>>
>> End
>> ------8<----------------------------------
>> The error text is in the 'Toolbar1.Configure' line: "Not an object"
>> The stack back-trace:
>>
>> FToolBarConfig.InitAction.108
>> FToolBarConfig.SetCurrentToolBar.54
>> FToolBarConfig.Run.17
>> Action._ConfigureToolBar.21
>> ToolBar.Configure.34
>> FMain.ToolBar1_MouseDown.20
>>
>> What am I doing wrong?
>
> Finally I've found what I was doing wrong. The 'Key' toolbar's property
> *must* be set with a unique name. Failing to do this, will lead to a
> dumb toolbar. No need to call Configure from a mouse event. Hope this
> helps someone else.
>
> Regards
>
>

I have added an explicit error message if the Configure() method is 
called without Key being defined.

Regards,

-- 
Benoît Minisini




More information about the User mailing list