From: Jacques C. XX \(QB/EMC\) <jac...@er...> - 2007-06-28 20:17:18
|
I am trying to see the first item in the list that I have built for a combobox. When I run the script, the combobox is there but I cannot see the item like 'info' What am I doing wrong? I am using Perl 5.8 on Windows 2000 $Window->AddCombobox( -name =3D> "CB", -dropdown =3D> 1, -left =3D> 50, -top =3D> 100, -height =3D> 80, -width =3D> 80, -hasstring =3D> 1, -onChange =3D> \&GetInfoCB, -tabstop =3D> 1, # -uppercase =3D> 1, # -sort =3D> 1, ); $Window->CB->Add('none', 'info', 'warning', 'error'); $Window->CB->SetTopIndex('1'); $Window->CB->TopIndex('1'); $Window->CB->FirstVisibleItem('1'); ------------------------------------------------ From: Jacques Choquette Sun Hardware Admin Tel: 514-345-7900 x 43463 |
From: Robert M. <rob...@us...> - 2007-06-28 22:04:49
|
On 28/06/07, Jacques Choquette XX (QB/EMC) <jac...@er...> wrote: > I am trying to see the first item in the list that I have built for a > combobox. When I run the script, the combobox is there but I cannot > see the item like 'info'. What am I doing wrong? I am using Perl 5.8 on > Windows 2000 > > $Window->AddCombobox( > -name => "CB", > -dropdown => 1, > -left => 50, > -top => 100, > -height => 80, > -width => 80, > -hasstring => 1, > -onChange => \&GetInfoCB, > -tabstop => 1, > # -uppercase => 1, > # -sort => 1, > ); > $Window->CB->Add('none', 'info', 'warning', 'error'); > $Window->CB->SetTopIndex('1'); > $Window->CB->TopIndex('1'); > $Window->CB->FirstVisibleItem('1'); Try this. #!perl -w use strict; use warnings; use Win32::GUI qw(CW_USEDEFAULT); my $mw = Win32::GUI::Window->new( -left => CW_USEDEFAULT, -size => [400,300], ); $mw->AddCombobox( -name => "CB", -dropdown => 1, -left => 50, -top => 100, -height => 80, -width => 80, ); $mw->CB->Add('none', 'info', 'warning', 'error'); $mw->CB->SetCurSel(0); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); exit(0); __END__ Regards, Rob. |
From: pcourterelle <pco...@te...> - 2007-07-04 09:06:32
|
Rob, thanks for that...that drove me nuts for a while...what does SetTopIndex() do if it does ensure the value of the index is visible in the Listbox? The info says: SetTopIndex SetTopIndex(INDEX) Ensure that a particular item is visible in the Listbox of a Combobox. Just curious. Thanks phil ----- Original Message ----- From: "Robert May" <rob...@us...> To: "Jacques Choquette XX (QB/EMC)" <jac...@er...> Cc: <per...@li...> Sent: Thursday, June 28, 2007 3:04 PM Subject: Re: [perl-win32-gui-users] combobox > On 28/06/07, Jacques Choquette XX (QB/EMC) > <jac...@er...> wrote: >> I am trying to see the first item in the list that I have built for a >> combobox. When I run the script, the combobox is there but I cannot >> see the item like 'info'. What am I doing wrong? I am using Perl 5.8 on >> Windows 2000 >> >> $Window->AddCombobox( >> -name => "CB", >> -dropdown => 1, >> -left => 50, >> -top => 100, >> -height => 80, >> -width => 80, >> -hasstring => 1, >> -onChange => \&GetInfoCB, >> -tabstop => 1, >> # -uppercase => 1, >> # -sort => 1, >> ); >> $Window->CB->Add('none', 'info', 'warning', 'error'); >> $Window->CB->SetTopIndex('1'); >> $Window->CB->TopIndex('1'); >> $Window->CB->FirstVisibleItem('1'); > > Try this. > > > #!perl -w > use strict; > use warnings; > > use Win32::GUI qw(CW_USEDEFAULT); > > my $mw = Win32::GUI::Window->new( > -left => CW_USEDEFAULT, > -size => [400,300], > ); > > $mw->AddCombobox( > -name => "CB", > -dropdown => 1, > -left => 50, > -top => 100, > -height => 80, > -width => 80, > ); > $mw->CB->Add('none', 'info', 'warning', 'error'); > $mw->CB->SetCurSel(0); > > $mw->Show(); > Win32::GUI::Dialog(); > $mw->Hide(); > exit(0); > __END__ > > Regards, > Rob. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > |
From: Robert M. <rob...@us...> - 2007-07-11 21:29:05
|
On 04/07/07, pcourterelle <pco...@te...> wrote: > Rob, thanks for that...that drove me nuts for a while...what does > SetTopIndex() do if it does ensure the value of the index is visible in the > Listbox? The info says: > > SetTopIndex > SetTopIndex(INDEX) > Ensure that a particular item is visible in the Listbox of a Combobox. > > Just curious. It does what it says. You need to understand that the 'Listbox of a combobox' is the drop-down window that you to select items in; It makes sure that the item referred to by INDEX is within the visible window - you'll only notice it do anything if you have enough items in the listbox such that the drop-down needs to scroll to see some items, AND the dropdown is visible. Regards Rob. |
From: pcourterelle <pco...@te...> - 2007-07-12 05:14:49
|
----- Original Message ----- From: "Robert May" <rob...@us...> To: "pcourterelle" <pco...@te...> Cc: <per...@li...> Sent: Wednesday, July 11, 2007 2:29 PM Subject: Re: [perl-win32-gui-users] combobox > On 04/07/07, pcourterelle <pco...@te...> wrote: >> Rob, thanks for that...that drove me nuts for a while...what does >> SetTopIndex() do if it does ensure the value of the index is visible in >> the >> Listbox? The info says: >> >> SetTopIndex >> SetTopIndex(INDEX) >> Ensure that a particular item is visible in the Listbox of a Combobox. >> >> Just curious. > > It does what it says. You need to understand that the 'Listbox of a > combobox' is the drop-down window that you to select items in; It > makes sure that the item referred to by INDEX is within the visible > window - you'll only notice it do anything if you have enough items in > the listbox such that the drop-down needs to scroll to see some items, > AND the dropdown is visible. > > Regards > Rob. > Yes I understood the meaning of the description fine and I'm not questioning whether the code works. It just never worked in my implemenation. I took the meaning of the descrpition to mean that when the TopIndex is set to (0) the item at (0) will be visible in the Listbox window. Yes the scrollbar is visible and active and the drop down works with scrollbar. Sample below. #! perl -w use strict; use Win32::GUI; my $MainWindow = new Win32::GUI::Window( -name => "MainWindow", -size => [300,400], -pos => [100,200], ); $MainWindow->AddCombobox( -name => "FilterList", -autoscroll => 1, -dropdown => 1, -dropdownlist => 1, -size => [200,100], -height => 100, -pos => [$MainWindow->Width*0.05,$MainWindow->Height*0.055], -vscroll => 1, ); PopulateCombo(); #------------------------ $MainWindow->Show(); Win32::GUI::Dialog(); #------------------------ sub PopulateCombo{ foreach (qw(Big Bad Bob Bothers Brothers Because Bob Bake Bundt Batter By Batteries)){ $MainWindow->FilterList->Add($_); } $MainWindow->FilterList->SetTopIndex(1); } #--- end---- |
From: Robert M. <rob...@us...> - 2007-07-12 19:02:46
|
On 12/07/07, pcourterelle <pco...@te...> wrote: > Yes I understood the meaning of the description fine and I'm not questioning > whether the code works. It just never worked in my implementation. I took > the meaning of the description to mean that when the TopIndex is set to (0) > the item at (0) will be visible in the Listbox window. Yes the scrollbar is > visible and active and the drop down works with scrollbar. It's must more obvious with an old-style listbox (code below). In the case of a drop-down list box it appears that clicking the drop-down-arrow resets the list to the top if there's no selection in the combo/edit box. If you open drop-down-list before calling SetTopIndex(), then you can also see it happening orrectly (again, code below). Hope this helps. Regards, Rob. #! perl -w use strict; use warnings; use Win32::GUI 1.05 qw(CW_USEDEFAULT); my $mw = Win32::GUI::Window->new( -left => CW_USEDEFAULT, -size => [400,300], ); my $cb = $mw->AddCombobox( -pos => [10,10], -size => [200,100], -vscroll => 1, ); $cb->Add($_) for (0 .. 99); $cb->SetTopIndex(50); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); exit(0); __END__ #! perl -w use strict; use warnings; use Win32::GUI 1.05 qw(CW_USEDEFAULT); my $mw = Win32::GUI::Window->new( -left => CW_USEDEFAULT, -size => [400,300], ); my $cb = $mw->AddCombobox( -pos => [10,10], -size => [200,100], -vscroll => 1, -dropdownlist => 1, ); $cb->Add($_) for (0 .. 99); $cb->ShowDropDown(1); $cb->SetTopIndex(50); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); exit(0); __END__ |