From: Gabor S. <sz...@us...> - 2004-07-28 11:45:24
|
Update of /cvsroot/winguitest/Win32-GuiTest/eg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27752/eg Modified Files: menuselect.pl Log Message: more values from MenuInfo Index: menuselect.pl =================================================================== RCS file: /cvsroot/winguitest/Win32-GuiTest/eg/menuselect.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** menuselect.pl 22 Jul 2004 23:35:18 -0000 1.7 --- menuselect.pl 28 Jul 2004 11:45:13 -0000 1.8 *************** *** 3,7 **** # Example how to get the names of the menus - # Does not work yet as the backend is not there yet ! use strict; --- 3,6 ---- *************** *** 27,31 **** print Dumper \%h; ! #MenuSelect("&Archivo|&Salir"); --- 26,31 ---- print Dumper \%h; ! print "===================\n"; ! menu_parse($menu); #MenuSelect("&Archivo|&Salir"); *************** *** 33,34 **** --- 33,63 ---- # Close the menu and notepad SendKeys("{ESC}%{F4}"); + + + # this function receives a menu id and prints as much information about that menu and + # all its submenues as it can + # One day we might include this in the distributionor in some helper module + sub menu_parse { + my ($menu, $depth) = @_; + $depth ||= 0; + + foreach my $i (0..GetMenuItemCount($menu)-1) { + my %h = GetMenuItemInfo($menu, $i); + print " " x $depth; + print "$i "; + print $h{text} if $h{type} and $h{type} eq "string"; + print "------" if $h{type} and $h{type} eq "separator"; + print "UNKNOWN" if not $h{type}; + print "\n"; + + my $submenu = GetSubMenu($menu, $i); + if ($submenu) { + menu_parse($submenu, $depth+1); + } + } + } + + + SendKeys("%{F4}"); + + |