Question
“How do I hide some or all of the menu items for the Data Tab?”
Solution
Check to see that the user has the data tab active in the TabChanged event and typecast the Designer.Menu.Items property as a Data menu object to access the menu items.
Download: HideDataMenuItems.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
procedure TForm1.ppDesigner1TabChanged(Sender: TObject); var lSubMenu: TppTBCustomItem; lDataFileMenu: TdaDataFileMenu; begin if (ppDesigner1.Notebook.ActivePageIndex = 0) then begin // this can be used to get at any menu times lSubMenu := ppDesigner1.Menu.Items[0]; // get file menu ShowMessage(lSubMenu.Items[0].Caption); // For the Data | File menu we can typecast as TdaDataFileMenu // The TdaDataFileMenu class has properties that correspond to the items, // see RBuilder\Source\daDataManager for the class declaration if (lSubMenu is TdaDataFileMenu) then begin lDataFileMenu := TdaDataFileMenu(lSubMenu); lDataFileMenu.Export.Visible := False; // hide Export menu item end; end; end; |