LB Booster
« Textbox color »

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



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: Textbox color  (Read 276 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Textbox color
« Thread started on: Apr 8th, 2016, 11:32am »

There's a thread at the Liberty BASIC Community Forum describing a trick that allows textboxes and statictext controls, in the same window, to have different foreground colors. This doesn't work in LBB (it relies on undocumented internal behavior) but it's easy enough to achieve an equivalent effect:

Code:
    nomainwin

    WindowWidth = 250
    WindowHeight = 160
    UpperLeftX = int((DisplayWidth-WindowWidth)/2)
    UpperLeftY = int((DisplayHeight-WindowHeight)/2)

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

    stylebits  #1.st2, _ES_READONLY, _WS_HSCROLL or _WS_VSCROLL or _
                       _WS_DLGFRAME or _ES_MULTILINE, 0, 0
    texteditor #1.st2, 10, 10, 100, 17
    stylebits  #1.tb2, _WS_BORDER, _WS_HSCROLL or _WS_VSCROLL or _
                       _WS_DLGFRAME or _ES_MULTILINE, _WS_EX_CLIENTEDGE, 0
    texteditor #1.tb2, 10, 30, 100, 25

    stylebits  #1.st3, _ES_READONLY, _WS_HSCROLL or _WS_VSCROLL or _
                       _WS_DLGFRAME or _ES_MULTILINE, 0, 0
    texteditor #1.st3, 120, 10, 100, 17
    stylebits  #1.tb3, _WS_BORDER, _WS_HSCROLL or _WS_VSCROLL or _
                       _WS_DLGFRAME or _ES_MULTILINE, _WS_EX_CLIENTEDGE, 0
    texteditor #1.tb3,120, 30, 100, 25

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

    hw1 = hwnd(#1)
    calldll #user32, "SetMenu", hw1 as ulong, 0 as long, r as long
    
    #1.tb1 "123"
    #1.st2 "Red on darkblue"
    #1.st2 "!forecolor red"
    #1.st2 "!backcolor buttonface"
    #1.tb2 "!forecolor red"
    #1.tb2 "!backcolor darkblue"
    #1.tb2 "123"
    #1.st3 "Darkgreen on green"
    #1.st3 "!forecolor darkgreen"
    #1.st3 "!backcolor buttonface"
    #1.tb3 "!forecolor darkgreen"
    #1.tb3 "!backcolor green"
    #1.tb3 "123"
wait

[quit.1]
    close #1
end 

Richard.
« Last Edit: Apr 8th, 2016, 11:34am by Richard Russell » User IP Logged

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