[Gambas-user] Action.Register new parameter
Emanuele Sottocorno
sotema at ...626...
Sun Sep 4 17:13:09 CEST 2011
Hi to all,
i can't understand what the new 'old as string' parameter means in
Action.Register. I have a class in which i define all actions used for
Menus and ToolButtons, than each action is linked to appropriate
controls at application start-up. I use this to give the user the chance
to select different themes.
' Gambas class file
'Classe : psTheme.Class
'Autore : Emanuele Sottocorno
'Email : sotema at ...626...
'Descrizione: Menus and buttons actions
Public Const ACTION_DEALER_OPEN As String = "DEALER_OPEN"
Public Const ACTION_DEALER_CLOSE As String = "DEALER_CLOSE"
Public Const ACTION_DEALER_EDIT As String = "DEALER_EDIT"
Public Const ACTION_USER_ADD As String = "USER_ADD"
Public Const ACTION_USER_EDIT As String = "USER_EDIT"
...
...
Static Public Sub ActionConfigure()
With Action[ACTION_DEALER_OPEN]
.Picture = psTheme.GetIcon(psTheme.DEALER_OPEN)
End With
With Action[ACTION_DEALER_EDIT]
.Picture = psTheme.GetIcon(psTheme.DEALER_EDIT)
End With
With Action[ACTION_USER_ADD]
.Picture = psTheme.GetIcon(psTheme.USER_ADD)
End With
With Action[ACTION_USER_EDIT]
.Picture = psTheme.GetIcon(psTheme.USER_EDIT)
End With
...
End
Ok, the right picture is asoociated to controls.
Since rev 4072 i used the following to register the actions:
' Gambas class file
'Classe : Fmain.Class
'Autore : Emanuele Sottocorno
'Email : sotema at ...626...
'Descrizione: Application Main Window
Event MoveMenu(obj As Object)
Event MainMenu(obj As Object)
Event FormEvent(hForm As Form)
Public Sub _new()
Me.Icon = pneusoft.GetIconFile(psTheme.PNEUSOFT_ICON_64)
' Configure Actions for Menu an buttons
' Menu Actions:
Action.Register(mnuAziendaApri,psAction.ACTION_DEALER_OPEN)
Action.Register(mnuAziendaModifica,psAction.ACTION_DEALER_EDIT)
Action.Register(mnuUtenzaAdd,psAction.ACTION_USER_ADD)
Action.Register(mnuUtenzaEdit, psAction.ACTION_USER_EDIT)
...
End
Now, starting with rev 7073 this becomes invalid due the 'old as string'
parameter .
Modifing the lines like (no action associated to objects in the IDE):
Public Sub _new()
Me.Icon = pneusoft.GetIconFile(psTheme.PNEUSOFT_ICON_64)
' Configure Actions for Menu an buttons
' Menu Actions:
Action.Register(mnuAziendaApri, "", psAction.ACTION_DEALER_OPEN)
Action.Register(mnuAziendaModifica, "", psAction.ACTION_DEALER_EDIT)
Action.Register(mnuUtenzaAdd, "", psAction.ACTION_USER_ADD)
Action.Register(mnuUtenzaEdit, "", psAction.ACTION_USER_EDIT)
...
End
Public Sub menuevent_click()
Raise MainMenu(Last)
End
when i click an object it raise a NULL string action. I mean that
looking at LAST there is a void string in Action Field property.
Executing the cycle:
Dim o As Object
For Each o In Action[psAction.ACTION_USER_EDIT].Controls
Debug o.Name
Next
the right object name are printed in console.
How can i do that now?
Thanks,
Emanuele
More information about the User
mailing list