QB64.org Forum

QB64 Team Software => InForm Discussion => Topic started by: WilliGrundmann on April 15, 2020, 03:44:04 am

Title: Label Background Colours
Post by: WilliGrundmann on April 15, 2020, 03:44:04 am
Hi,

I am new to QB64 and InForm.

For a small project I would like to change the background color of a label depending on the data from the serial port. This needs to work without operator interaction.

I tried to do this via code in the __UI_BeforeUpdateDisplay subroutine.  However  Control(AlarmLabel).BackColor= _RGB32(x,y,z) changes the color only once. All following Control(AlarmLabel).BackColor= _RGB32(x,y,z) with a different color have no effect.

Is there another method to change the background color of a label at run time?

Title: Re: Label Background Colours
Post by: FellippeHeitor on April 15, 2020, 08:18:49 am
You can force redraw:

Code: QB64: [Select]
  1. Control(AlarmLabel).BackColor = _RGB32(x,y,z)
  2. Control(AlarmLabel).Redraw = True

Most redrawing is done based on certain detected changes. I don't recall if .BackColor is actively monitored.

And yes, best place for that is in __UI_BeforeUpdateDisplay.

Let me know if that does it, please.
Title: Re: Label Background Colours
Post by: FellippeHeitor on April 15, 2020, 08:40:26 am
...and welcome to QB64+InForm+the Forum :-)
Title: Re: Label Background Colours
Post by: WilliGrundmann on April 15, 2020, 06:20:02 pm
HI Phillippe,

Thank you very much for the advice. The background color works fine now.

Most of my programming is for embedded systems using Microchip processors. I do not get involved in PC based software very often. In the past I used QuickBasic and Visual Basic.

QB64 together with Inform may be a more efficient tool for small PC based applications.

Best Regards

Willi Grundmann