[Gambas-user] ComboBox Usage

T Lee Davidson t.lee.davidson at gmail.com
Fri Aug 14 02:24:48 CEST 2020


On 8/13/20 2:55 PM, John Rose wrote:
> I'm a baffled by how to monitor a ComboBox's usage. I have the Text property of ComboBoxConnectChannel equal to 'Please Select 
> Channel' with its List property empty. I then fill the list as follows:
>    With ComboBoxConnectChannel
>        .Clear
>        .Add("BBC One")
>        .Add("BBC Two")
>        .Add("BBC Four")
>        .Add("CBBC")
>        .Add("CBeebies")
>        .Add("BBC News")
>        .Add("BBC Parliament")
>      End With
> 
> I then want the user to select an item from the list (which is displayed with the correct list of values as a popup) after the 
> user clicks on the arrow to the right of the textbox part of the ComboBox) and have the textbox (part of the ComboBox) set equal 
> to the value of the selected item. At runtime, the user selects one of the items from the popup but its value is *not *shown in 
> the text box part of the ComboBox:
>    Public Sub ComboBoxConnectChannel_Change()
>      sConnectChannel = Trim(ComboBoxConnectChannel.Text)
>      Print "Channel=" & sConnectChannel
>    End
> 
> So for example if the user has clicked on the arrow followed by clicking on the 'BBC Four' item, the variable sConnectChannel is 
> set equal to 'BBC Four' correctly but the textbox part of the ComboBox still shows 'Please Select Channel'. What do I change in 
> the above Public Sub coding to achieve this?
> 

It works fine here with Qt5. Perhaps you should attach a project that duplicates the behavior you've described.


-- 
Lee


More information about the User mailing list