[Gambas-user] Background/Foreground

serge bouc serge.bouc at ...402...
Thu Jul 17 11:31:47 CEST 2008


>
> On mercredi 16 juillet 2008, serge bouc wrote:
>   
>>>>> > >> > On Wed, Jul 9, 2008 at 3:57 PM, serge bouc <serge.bouc at ...402...> wrote:
>>>>>           
>>>>>>> > >>> > > Hello Gambas,
>>>>>>> > >>> > >
>>>>>>> > >>> > > Pardon me for asking again this question :
>>>>>>> > >>> > >
>>>>>>> > >>> > >    b is a button, with text.
>>>>>>> > >>> > >   "b.background=my_color"  works fine : b is now surrounded with
>>>>>>> > >>> > > "my_color" "b.foreground=my_color"   turns text on b to black,
>>>>>>> > >>> > > whatever my-color.
>>>>>>> > >>> > >
>>>>>>> > >>> > > What am I missing ?
>>>>>>> > >>> > >
>>>>>>> > >>> > > Thanks for any help.
>>>>>>> > >>> > > Serge.
>>>>>>> > >>> > >
>>>>>>> > >>> > > gambas2/Mandriva 2008/kde 3.5
>>>>>>>               
>>> > >
>>> > > I use Plastik, and setting the background or the foreground color of a
>>> > > button works as expected. So I think it is a problem in the widget style
>>> > > you use. Which style do you use?
>>> > >
>>> > > -- Benoit Minisini
>>>       
>> >
>> > I am using Mandriva widget style. I have tried Plastik, and the problem
>> > is exactly the same : no way to change the color of text in a button,
>> > except to black.
>> > This is strange, since at startup, the text color is as specified in the
>> > form editor.
>> > But whenever I try to change it by
>> >
>> > "b.foreground=my_color"
>> >
>> > the color turns to black.
>> >
>> > Could this be a conversion problem, since my program (class+form) was
>> > initially written for Gambas 1, and then converted to Gambas 2 ? I made no
>> > changes in the form, since it works, apart from this problem.
>> >
>> > --
>> > Serge Bouc
>> >
>>     
>
> Can you show me the detailed source code?
>
> -- Benoit Minisini
' Here it is :
'
' <couleurf> and <ar_plan> are static integers
'
' <Fond> is the name of the button
'
' <init=FALSE> + <Form_Activate> is the way I found to force redraw
' of my picture. The assignment <ar_plan=couleurf> works fine, but
' <Fond.Foreground = couleurf> does not.
' Removing these two lines has no effect on the button color problem.
'
PUBLIC SUB Fond_Click()
 IF Dialog.SelectColor() = FALSE THEN
    couleurf = Dialog.Color   
    Fond.Foreground = couleurf
    ar_plan = couleurf
    init = FALSE
    Form_Activate()
  ENDIF
END

' Best regards
--
Serge Bouc




More information about the User mailing list