[Gambas-user] FontChooser setting fontname

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Apr 27 11:27:28 CEST 2016


Am 27.04.2016 10:12, schrieb adamnt42 at ...626...:
> On Wed, 27 Apr 2016 09:44:55 +0200
> Rolf-Werner Eilert <eilert-sprachen at ...221...> wrote:
>
>> Does really nobody know why I cannot set the SelectedFont value as
>> mentioned in the documentation?
>>
>> Rolf
>>
>> Am 26.04.2016 12:57, schrieb Rolf-Werner Eilert:
>>> "Courrier" is French, in my list there is "Courier". I can choose it
>>> from the list, but I cannot set the list to this value/index/string.
>>>
>>> Rolf
>>>
>>> Am 26.04.2016 12:39, schrieb Fabien Bodard:
>>>> Courrier
>>>> Le 26 avr. 2016 12:12, "Rolf-Werner Eilert" <eilert-sprachen at ...221...> a
>>>> écrit :
>>>>
>>>>> The docu reads:
>>>>>
>>>>> FontChooser.SelectedFont (gb.form)
>>>>>
>>>>> Property SelectedFont As String
>>>>>
>>>>> Returns or sets the selected font as a string.
>>>>>
>>>>> When I try to do
>>>>>
>>>>> Dim MyFont As String
>>>>>
>>>>> MyFont = "Courier"
>>>>> fcMyFont.SelectedFont = MyFont
>>>>>
>>>>> nothing happens.
>>>>>
>>>>> Am I expecting too much?
>>>>>
>>>>> Rolf
>>>>>
> hmm
> ' Gambas class file
>
> Public Sub _new()
>
>    FontChooser1.SelectedFont = "Courier"
>    Print FontChooser1.SelectedFont
>    
> End
> seems to work ok here?
>
>

Ahh ok, this makes sense. It does run like this, but the dropdown list 
still doesn't reflect it.

But I found the reason. I only needed the dropdown list visible, so I 
decreased the control to 29 px. This way, however, the preview area 
isn't visible, and the control seems to need the preview area to refresh 
the dropdown list.

So my solution was

FontChooser1.Height = 110
FontChooser1.SelectedFont = "Courier"
FontChooser1.Height = 29

This way it runs like expected... :)

Regards
Rolf





More information about the User mailing list