The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
| |
|
Re: Need to access a menu's properties at runtime
Posted: 25 Oct 07 11:19 AM
|
If your menu is on a datagrid then I think you can access it as follows:
datagrid.Popupmenu.
If you want you can access items within a menu by:
datagrid.Popupmenu.Items(#).
Hope this answers your question. |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 25 Oct 07 11:53 AM
|
Thanks muni,
But, I need to access a custom menu that I merged into the Standard Menu strip. I'm doing some work in 7.0 with secured functions and i have one secured function that is tied to a couple to different menu items. I wanted to know if there is a way to get the selected menu item's caption so i can perform some additional logic specific menu items. |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 26 Oct 07 7:54 AM
|
No you cannot.... not even in v72 - never could.
BUT you could try creating a GS (Global Script) "handler" for each menu item.. Something like: ex: Function OnFunctionVisible_InsertFileAttachment(functionNumber, functionName)
... do something here..... End Function
-- rjl |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 27 Oct 07 7:05 AM
|
Hi Muni, sure you can - it's not fun but you can either use the MenuIndex item to store a pointer (e.g. 1000-1015) during your setup of the custom menu - and then test that or you can get the menuitem caption but, beware, SLX will add an & to it (to indicate the accelerator key) so you need to strip that out first.
e.g.
Sub AXFormChange(Sender) If GetField("ALLOW_ADD_ATT","E1TB_EVENTSEC","USERID = '" & Application.BasicFunctions.CurrentUserID & "'") <> "T" then dgAttendees.EditOptions.ShowAdd = False dgAttendees.EditOptions.ShowEdit = False dgAttendees.EditOptions.ShowDelete = False dgAttendees.ReadOnly = True dgAttendees.PopupMenu.Items(1).Enabled = False dgAttendees.PopupMenu.Items(2).Enabled = False End If BuildStatusMenuItems End Sub
or
Sub dgAttendeesPopupMenuClick(Sender, Item) Dim NewStatus, i, id Dim objRS
If Item.Caption = "Add &by Account" then PopulateByAccount exit sub End If
If Item.Caption = "&GoTo Contact" then UpdateStatus dgAttendees.GetCurrentField ("ATTENDEE_CONTACTID") Exit Sub End If
NewStatus = Replace(Item.Caption,"&","")
For i = 0 To frmAttendees.dgAttendees.Selection.Count -1
Set objRS = GetSelectedRecordByID(frmAttendees.dgAttendees.Recordset, frmAttendees.dgAttendees.Selection.Item(i), "E1TB_ATTSID") UpdateStatus "E1TB_ATTS","E1TB_ATTSID",objRS.Fields.Item("E1TB_ATTSID").Value, NewStatus
Next
Set objRS = Nothing
dgAttendees.Refresh End Sub |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 27 Oct 07 8:27 AM
|
Originally posted by Mike Spragg
Hi Muni, sure you can - it's not fun but you can either use the MenuIndex item to store a pointer (e.g. 1000-1015) during your setup of the custom menu - and then test that or you can get the menuitem caption but, beware, SLX will add an & to it (to indicate the accelerator key) so you need to strip that out first.
e.g.
Sub AXFormChange(Sender) If GetField("ALLOW_ADD_ATT","E1TB_EVENTSEC","USERID = '" & Application.BasicFunctions.CurrentUserID & "'") <> "T" then dgAttendees.EditOptions.ShowAdd = False dgAttendees.EditOptions.ShowEdit = False dgAttendees.EditOptions.ShowDelete = False dgAttendees.ReadOnly = True dgAttendees.PopupMenu.Items(1).Enabled = False dgAttendees.PopupMenu.Items(2).Enabled = False End If BuildStatusMenuItems End Sub
or
Sub dgAttendeesPopupMenuClick(Sender, Item) Dim NewStatus, i, id Dim objRS
If Item.Caption = "Add &by Account" then PopulateByAccount exit sub End If
If Item.Caption = "&GoTo Contact" then UpdateStatus dgAttendees.GetCurrentField ("ATTENDEE_CONTACTID") Exit Sub End If
NewStatus = Replace(Item.Caption,"&","")
For i = 0 To frmAttendees.dgAttendees.Selection.Count -1
Set objRS = GetSelectedRecordByID(frmAttendees.dgAttendees.Recordset, frmAttendees.dgAttendees.Selection.Item(i), "E1TB_ATTSID") UpdateStatus "E1TB_ATTS","E1TB_ATTSID",objRS.Fields.Item("E1TB_ATTSID").Value, NewStatus
Next
Set objRS = Nothing
dgAttendees.Refresh End Sub |
|
On the popups - absolutely.. it's in the lan dev helpfiles.
BUT.. the Standard menus.. no.. unless you trap them via GS handlers.. and even then it's nasty. -- rjl |
|
|
| |
|
Re: Need to access a menu's properties at runtime
Posted: 27 Oct 07 2:01 PM
|
Originally posted by Mike Spragg
Yes, but wasn't that what he wanted to do ? I'm sure that's what it looks like ? |
|
Note Ronald's 2nd post:
But, I need to access a custom menu that I merged into the Standard Menu strip. I'm doing some work in 7.0 with secured functions and i have one secured function that is tied to a couple to different menu items. I wanted to know if there is a way to get the selected menu item's caption so i can perform some additional logic specific menu items.
|
|
rjl |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 28 Oct 07 10:09 AM
|
Create a secure function in architect Manage Secure Function and put this code in global script. Menu item in standard menu should point to your newly created function as action item.
Function OnBeforeFunctionExecute_ToolsManageUserProfile(functionNumber, functionName) Application.BasicFunctions.DoInvoke "Form", "Management:User Profile" OnBeforeFunctionExecute_ToolsManageUserProfile = True End Function |
|
|
|
Re: Need to access a menu's properties at runtime
Posted: 28 Oct 07 10:10 AM
|
Hi Ronald try this,
If I understand your requirement correctly...
Create a secure function in architect Manage Secure Function and put this code in global script. Menu item in standard menu should point to your newly created function as action item.
Function OnBeforeFunctionExecute_ToolsManageUserProfile(functionNumber, functionName) Application.BasicFunctions.DoInvoke "Form", "Management:User Profile" OnBeforeFunctionExecute_ToolsManageUserProfile = True End Function |
|
|
|