LB Booster
« Setting fonts attributes for StaticText in Window »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:18am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Setting fonts attributes for StaticText in Window  (Read 143 times)
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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'
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx 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 smiley

Rog'
User IP Logged

Roger
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls