|
After finding the component, add it to the form, double-click it, right-click to add the menu and self-menu, and fill in the name of the menu to be displayed until it is as you want. Add a double-click event to the treeview:
if treeview1.Selected.Text ='Menu name 1'then
Click the event triggered by this menu;
if treeview1.Selected.Text ='Menu name 2'then
Click the event triggered by this menu;
E.g:
procedure TFRM_MAIN.TreeView1DblClick(Sender: TObject);
begin
if treeview1.Selected.Text ='Add record' then
btnadd.OnClick(sender);
if treeview1.Selected.Text ='Delete record' then
btndelete.OnClick(sender);
//btnadd and btndelete are the names of buttons, and buttons have their own events.
//I'm making it easier for the user to click the treeview event to trigger the button click event. Generally write events directly.
end;
Haha, I also did something for the first time after graduation, and really learned something. |
|