[Gambas-user] Combobox, How to get back to old Auto-list-width-behaviour ?

ub2 at gmx.ch ub2 at gmx.ch
Fri May 27 10:14:57 CEST 2022


Dear Gambas Cracks


I'm fiddling in vain since ... I'd like to ask for some hints.

The Situation (example):
I have a combobox.w = 75
- containing a list of entries some of them with length >>> 75
- the list is filled on runtime, Examples:
1  skdjhlkdsf ndsklgjslkn ksrhgsk
2  dsfkf sdfgs f hsdfhs sdf gsdf sd
3  asdgfs dsfh sdhf sdhb
4  ...

The user then selects an entry,
the code cuts selected entry down to "first column"
and saves it to Combobox.text
which fits perfect into combobox.w = 75


With older Combobox-Versions (?qt4?):
-The List blew up in width to fit to widest list entry,
-- if required even bigger than Form.width !
-- Combobox itself remained in place and size.


With Gambas 3.17.2, gb.qt5, Xub20.04LTS
- The combobox."Listwidth" remains at combobox.w
- The list entries are stripped down to fit into
-- 1  s...hgsk
-- 2  d...f sd
-- 3  a...sdhb
-- ...
With longer entries Combobox becomes useless.


Is there a property to get back to old "combobox.ListAutoFitWidth" 
behaviour ?


Following workaround does not really satisfy:

Public Sub Cbo_Enter()
         Dim $Add_W_Int$ As Integer

         $Add_W_Int$ = +300

         Cbo.w = Cbo.w + $Add_W_Int$
         Cbo.x = Cbo.x - $Add_W_Int$
End

Public Sub Cbo_Leave()
         Dim  $Add_W_Int$ As Integer
	Dim $x$ As String

         $Add_W_Int$ = -300

         Cbo.w = Cbo.w + $Add_W_Int$
         Cbo.x = Cbo.x - $Add_W_Int$
         Cbo.Refresh

         $x$ = Cbo.text
         Cbo.text = Left($x$, InStr($x$, " ") - 1)

End


Any good ideas ?

Thanks ub2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220527/188bcbb0/attachment.sig>


More information about the User mailing list