Home: Perl Programming Help: Win32 Programming Help:
Win32::GUI File Type selection control?



PapaGeek
User

Feb 7, 2014, 3:04 AM


Views: 19600
Win32::GUI File Type selection control?

Iím new to GUI programming and Iím working on a GUI interface for an existing project that Iím converting to Perl.

I need a GUI control similar to the one you see on many programs when you select ďSave AsĒ. The pop up screen has a text box for the file name and also a control that show the default file type and an arrow that if you hit it you see a list of all of the alternative file types. You can then click on the alternate file type you want.

Iíve tried to create that control using both ComboBox and ListBox, but both come up as a larger box showing all options with no arrow to display the alternatives.

I realize that after I create the control I will have to add each item to the control.

So, what is the control that I want (Combobox, Listbox, Other) ?

What are the fields I have to define (width, height, single selection, drop box, etc)?

Is there an example of this coding on line?

Thanks in advance for any advice


PapaGeek
User

Feb 7, 2014, 10:12 AM


Views: 19580
Re: [PapaGeek] Win32::GUI File Type selection control?

Hate to be the guy who answers his own questions, but here is the code snippet that I was able to get working:


Code
$theListBox = $DataWindow->AddCombobox( 
-name => "TheListBox",
-top => 30,
-left => 15,
-width => 200,
-vscroll => 1,
-dropdown => 1,
);
$theListBox->InsertItem('0');
$theListBox->InsertItem('1');
$theListBox->InsertItem('2');
$theListBox->InsertItem('3');
$theListBox->InsertItem('4');
$theListBox->InsertItem('5');
$theListBox->InsertItem('6');
$theListBox->InsertItem('7');

$theListBox->SetCurSel(3);


This code does not include any of the events to handle the returned values, still working on that, but it does display the drop down selection list properly and display the list with the desired item already selected.

Note that the set current selection 3 selects the fourth item in the list, the selections are numbered from zero.


Laurent_R
Veteran / Moderator

Feb 8, 2014, 3:22 PM


Views: 19516
Re: [PapaGeek] Win32::GUI File Type selection control?

Good that you answered your own questions, because it was a bit difficult to answer them not even knowing which GUI you were using (although I had some idea of the likely candidate).