[Gambas-user] ComboBox usage

John Rose john.aaron.rose at mailbox.org
Fri Aug 14 08:35:43 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.


When I run the attached stripped-down TestApp3 app, the app enters 
ComboBoxConnectChannel_Change before I select an item (possibly due to 
clicking on the combobox's arrow or because the 
SetAvailableConnectChannels procedure has been executed in order to 
populate the combobox). This can be seen in the Console output shown below:

Channel=Please Select Channel

(TestApp3:23871): Gtk-CRITICAL **: 07:15:07.602: 
gtk_box_gadget_distribute: assertion 'size >= 0'
  failed in GtkRadioButton

(TestApp3:23871): Gtk-CRITICAL **: 07:15:07.931: 
gtk_box_gadget_distribute: assertion 'size >= 0'
  failed in GtkRadioButton
Channel=CBBC


Please note that I'm using the gb.gui component as I've been told that 
the better of QT and GTK+ will be selected according to the machine it's 
being run on.

PS I find it difficult to get the 'quoting' of previous messages correct 
when I reply to someone else's post. Is this due to my using Digest Mode 
(which I prefer in order to get fewer emails where I'm not interested in 
the topic)?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200814/f178dafb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestApp3.tar.gz
Type: application/gzip
Size: 27533 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200814/f178dafb/attachment-0001.gz>


More information about the User mailing list