Author |
Topic: Setting fonts attributes for StaticText in Window (Read 143 times) |
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Setting fonts attributes for StaticText in Window
« Thread started on: Jun 26th, 2017, 8:41pm » |
|
I've been trying to set a font type, size and color for "StaticText" labels in a window.
I reached to set the font name, size and attribute but how do I set the StaticText background color?
The BackGroundColor$ doesn't seem to do anything here :-/
Code:NOMAINWIN
GRAPHICBOX #Side.GBx1,0,0,DisplayWidth,DisplayHeight
STYLEBITS #Side.GBx1,0,_WS_BORDER,0,0
STATICTEXT #Side.STx1," AAAAAAA",10,20,200,20
STATICTEXT #Side.STx2," BBBBBBB",10,60,200,20
[SIDE]
UpperLeftX = 0
UpperLeftY = 0
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
ForegroundColor$ = "red"
BackgroundColor$ = "blue"
OPEN "SIDE" FOR window_popup AS #Side
#Side "TRAPCLOSE [QuitSide]"
#Side "font tahoma 12 bold"
#Side.GBx1 "down; fill darkgreen"
#Side.GBx1 "when leftButtonDown [MouseLeftButton]"
WAIT
[QuitSide]
CLOSE #Side
END
[MouseLeftButton]
IF (MouseX < 10 AND MouseY < 10) THEN [QuitSide] 'clic on top left = QUIT
WAIT Any idea?
Rog'
|
|
Logged
|
Roger
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: Setting fonts attributes for StaticText in Win
« Reply #1 on: Jun 26th, 2017, 9:35pm » |
|
on Jun 26th, 2017, 8:41pm, flotulopex wrote:how do I set the StaticText background color? |
|
The positioning of the BackgroundColor$ makes a difference; you need to set it before the STATICTEXT statement. This is an LBB extension; it allows you to set different background colors for different controls. It's called out in the LBB docs under New Features: "The background color of (for example) a STATICTEXT control may be selected independently of the background color of its parent window, by changing the value of the BackgroundColor$ variable in between".
Here is your program modified accordingly:
Code:NOMAINWIN
GRAPHICBOX #Side.GBx1,0,0,DisplayWidth,DisplayHeight
STYLEBITS #Side.GBx1,0,_WS_BORDER,0,0
BackgroundColor$ = "blue"
STATICTEXT #Side.STx1," AAAAAAA",10,20,200,20
STATICTEXT #Side.STx2," BBBBBBB",10,60,200,20
[SIDE]
UpperLeftX = 0
UpperLeftY = 0
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
BackgroundColor$ = "blue"
ForegroundColor$ = "red"
OPEN "SIDE" FOR window_popup AS #Side
#Side "TRAPCLOSE [QuitSide]"
#Side "font tahoma 12 bold"
#Side.GBx1 "down; fill darkgreen"
#Side.GBx1 "when leftButtonDown [MouseLeftButton]"
WAIT
[QuitSide]
CLOSE #Side
END
[MouseLeftButton]
IF (MouseX < 10 AND MouseY < 10) THEN [QuitSide] 'clic on top left = QUIT
WAIT Richard.
|
|
Logged
|
|
|
|
flotulopex
Junior Member
member is offline
Gender:
Posts: 94
|
|
Re: Setting fonts attributes for StaticText in Win
« Reply #2 on: Jun 27th, 2017, 07:11am » |
|
Thanks a lot for your help and very helpful indications
Rog'
|
|
Logged
|
Roger
|
|
|
|