Hello,
Winmenus is event driven, i have to explain all to you to understand more...
At first you have to create your Widget menus by executing something like this:
Menu1:=TMenu.create(5,5);
This will create a Widget menu at the coordinate (x,y) = (5,5)
After that you have to set your callbacks,
cause my Winmenus is event driven, so
you have to do it like this:
Menu1.SetCallbacks(test,insert,updown);
The SetCallback() method will set your callbacks, the first callbacks parameter is the callback that will be execute when the "Enter" key is pressed and here it is the "test" function , the second callback
is the callback that will executed when the insert key is pressed and here above it is the function "insert', and the third callback is the callback that will called when the up and down keys are pressed and here above it is the function "updown" , the remaining callbacks that you can
assign are the keys from F1 to F12.
After that you can add your items to the Menu by calling the AddItem()
method like this:
Menu1.AddItem(inttostr(i));
After that you will enter a loop like this , the template of this loop must look like the following, that's not difficult to understand:
Here it is:
===
repeat
textbackground(blue);
clrscr;
menu2.execute(false);
menu1.execute(false);
case i mod 2 of
1: ret:=Menu1.Execute(true);
0: ret:=Menu2.Execute(true);
end;
if ret=ctTab then inc(i);
until ret=ctExit;
menu1.free;
menu2.free;
end.
==
When you execute menu1.execute(false);
with a parameter equal to false my Winmenus widget will draw your menu
without waiting for your input and events, when you set the parameter of the execute() method to true it will wait for your input and events, if the parameter of the execute method is true and the returned value of the execute method is ctTab that means you have pressed on the Tab key.. if the returned value is ctExit
that means you have pressed on the Escape key to exit.
That's all, please look at the test1.pas
example inside the zip and you will understand my Winmenus , it is very easy to work with.
You can download Winmenus 1.3 from:
https://sites.google.com/site/aminer68/winmenusThank you,
Amine Moulay Ramdane.