Winmenus

WinMenus version 1.45

Author: Amine Moulay Ramdane

Description

Drop-Down Menu Widget using the Object Pascal CRT unit

Please look at the test.pas example inside the zip file Use the 'Delete' on the keyboard to delete the items

and use the 'Insert' on the keyboard to insert the items

and use the 'Up' and 'Down' and 'PageUp and 'PageDown' to scroll .. and use the 'Tab' on the keyboard to switch between the Drop Down Menus and 'Enter' to select an item..

and the 'Esc' on the keyboard to exit..

and the 'F1' on keyboard to delete all the items from the list

right arrow and left arrow to scroll on the left or on the right

You can search with SearchName() and NextSearch() methods and now the search with wildcards inside the Widget is working perfectly.

Winmenus is event driven, i have to explain all to you to understand more...

At first you have to create your Widget menu 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(insert,updown);

The SetCallbacks() method will set your callbacks, the first callback parameter is the callback that will be executed when the insert key is pressed and it is the insert() function, and the second callback is the callback that will be called when the up and down keys are pressed and it is the function "updown" , the remaining callbacks that you can assign are the following keys: Delete and F1 to F12.

After that you can add your items and the callbacks to the Menu by calling the AddItem() method like this:

Menu1.AddItem(inttostr(i),test1);

the test1 is a callback that you add with AddItem() method.

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, and if the returned value is ctExit, that means you have pressed on the Escape key to exit.

You can go to download the zip files by clicking on the following web link:

https://drive.google.com/drive/folders/1wnUb5fJF4UQp_ueo3ofUadz3Dbvroige?usp=sharing

Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

Operating Systems: Windows, Mac OSX , Linux , Unix...

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

-dUnix for Linux , Unix and Mac OSX

-dWindows for windows

Required Delphi switches: -DMSWINDOWS -$H+

For Delphi 7 to 2007 use -DDelphi switch

For Delphi XE-XE7 use the -DXE switch