Liberty BASIC Community Forum
« Control colours »

Welcome Guest. Please Login or Register.
Dec 12th, 2017, 08:10am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Control colours  (Read 150 times)
JohnnyD
Guru
ImageImageImageImageImage


member is offline

Avatar

"If something should, then it doesn't, isn't, can't, hasn't or won't"


Homepage PM

Gender: Male
Posts: 765
xx Control colours
« Thread started on: Nov 20th, 2017, 06:52am »

Hi Carl,

this may have been asked already, but will all controls, textboxes (including text in textboxes), statictexts etc. have their own individual colour selections instead of blanket ForegroundColor$?

This would be really sexy if so!

JohnnyD
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5585
xx Re: Control colours
« Reply #1 on: Nov 20th, 2017, 07:12am »

Can actually be done in LB v4.5. John Davidson showed us how.

Code:
    nomainwin

    '|---------- Red Text Controls ----------|
    ForegroundColor$="red"
    TextboxColor$="darkblue"

    statictext #red.st1,"Red on darkblue", 10, 10, 100, 17
    textbox #red.tb1,10, 30, 100, 25

    stylebits #red,0,_WS_VISIBLE,0,0
    open "Red window" for window_popup as #red


    '|-------- green Text Controls -------|
    ForegroundColor$="darkgreen"
    TextboxColor$="green"

    statictext #green.st1,"Darkgreen on green", 120, 10, 100, 17
    textbox #green.tb1,120, 30, 100, 25

    stylebits #green,0,_WS_VISIBLE,0,0
    open "Green window" for window_popup as #green


    '|-------- Normal Text Controls ---------|

    'Open the mainGUI
    WindowWidth = 250
    WindowHeight = 160
    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    TextboxColor$="" 'default
    ForegroundColor$="" 'default

    statictext #1.st1,"Normal", 10, 70, 50, 17
    textbox #1.tb1,10, 90, 100, 25

    open "Main GUI" for window as #1
    print #1, "font ms_sans_serif 8"
    print #1, "trapclose [quit.1]"


    'Move the controls from the 'color' windows to the main GUI.
    '              Parent     Child
    call setParent hWnd(#1) , hWnd(#red.st1)
    call setParent hWnd(#1) , hWnd(#red.tb1)
    call setParent hWnd(#1) , hWnd(#green.st1)
    call setParent hWnd(#1) , hWnd(#green.tb1)

    #red.tb1 "123"
    #green.tb1 "123"
    #1.tb1 "123"
wait

[quit.1]
    close #green
    close #red
    close #1
END



SUB setParent parent,child
    calldll #user32, "SetParent",_
                      child as ulong,_
                     parent as ulong,_
                          r as long
END SUB




 
« Last Edit: Nov 21st, 2017, 02:27am by Rod » User IP Logged

JohnnyD
Guru
ImageImageImageImageImage


member is offline

Avatar

"If something should, then it doesn't, isn't, can't, hasn't or won't"


Homepage PM

Gender: Male
Posts: 765
xx Re: Control colours
« Reply #2 on: Nov 20th, 2017, 4:42pm »

Hi Rod,

The setParent sub is missing.

In LB 5 it would be nice to do it all natively.

John.
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5585
xx Re: Control colours
« Reply #3 on: Nov 21st, 2017, 02:27am »

Fixed the code, native would be nice.
User IP Logged

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

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls