KrispyK
asked on
Saving / creating menu at runtime
I'm using a TTBXtoolbar in my program.
( www.jrsoftware.org , toolbar2000 );
I would like to be able to load up a file at runtime, and have the contents of a menu be filled from a file.
The menu needs to be able to have all of the normal properties, such as imageindex, caption, subitems, action etc. There can be many subitems per item...which itself can be a subitem...I can't get my head around creating a storage system and loop!
Simple menu :
File : Edit : About
|-Open
|-Close
|-Export
| |- As TXT
| |- as CSV
|-Exit
Here is a sample for creating a file menu with export and exit :
...
var
item:array[1..99] of TTBXcustomitem;
subitem:array[1..99] of TTBXsubmenuitem;
...
subitem[1]:=TTBXsubmenuite m.create(s elf);
subitem[1].caption:='&File ';
subitem[1].imageindex:=44;
subitem[1].displaymode:=nb dmImageAnd Text;
item[1]:=TTBXcustomitem.cr eate(self) ;
item[1].action:=menu_exit;
item[1].caption:='&Exit';
item[1].imageindex:=71;
item[1].displaymode:=nbdmI mageAndTex t;
item[4]:=TTBXcustomitem.cr eate(self) ;
item[4].caption:='to &TXT file';
item[4].action:=serverlist _export;
item[4].imageindex:=65;
item[4].displaymode:=nbdmI mageAndTex t;
item[5]:=TTBXcustomitem.cr eate(self) ;
item[5].caption:='to &CSV file';
item[5].action:=serverlist _export;
item[5].imageindex:=65;
item[5].displaymode:=nbdmI mageAndTex t;
subitem[3]:=TTBXsubmenuite m.create(s elf);
subitem[3].caption:='&Expo rt Serverlist';
subitem[3].imageindex:=65;
subitem[3].displaymode:=nb dmImageAnd Text;
subitem[3].add(item[5]);
subitem[3].add(item[4]);
subitem[1].add(subitem[3]) ;
subitem[1].add(item[1]);
toolbar_menu.items.insert( 0,subitem[ 1]);
...
Cheers,
Kris.
( www.jrsoftware.org , toolbar2000 );
I would like to be able to load up a file at runtime, and have the contents of a menu be filled from a file.
The menu needs to be able to have all of the normal properties, such as imageindex, caption, subitems, action etc. There can be many subitems per item...which itself can be a subitem...I can't get my head around creating a storage system and loop!
Simple menu :
File : Edit : About
|-Open
|-Close
|-Export
| |- As TXT
| |- as CSV
|-Exit
Here is a sample for creating a file menu with export and exit :
...
var
item:array[1..99] of TTBXcustomitem;
subitem:array[1..99] of TTBXsubmenuitem;
...
subitem[1]:=TTBXsubmenuite
subitem[1].caption:='&File
subitem[1].imageindex:=44;
subitem[1].displaymode:=nb
item[1]:=TTBXcustomitem.cr
item[1].action:=menu_exit;
item[1].caption:='&Exit';
item[1].imageindex:=71;
item[1].displaymode:=nbdmI
item[4]:=TTBXcustomitem.cr
item[4].caption:='to &TXT file';
item[4].action:=serverlist
item[4].imageindex:=65;
item[4].displaymode:=nbdmI
item[5]:=TTBXcustomitem.cr
item[5].caption:='to &CSV file';
item[5].action:=serverlist
item[5].imageindex:=65;
item[5].displaymode:=nbdmI
subitem[3]:=TTBXsubmenuite
subitem[3].caption:='&Expo
subitem[3].imageindex:=65;
subitem[3].displaymode:=nb
subitem[3].add(item[5]);
subitem[3].add(item[4]);
subitem[1].add(subitem[3])
subitem[1].add(item[1]);
toolbar_menu.items.insert(
...
Cheers,
Kris.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER