Center text in EditorGadget

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
marcoagpinto
Addict
Addict
Posts: 1051
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Center text in EditorGadget

Post by marcoagpinto »

Heya, @Fred,

Code: Select all

    ; Editor Gadget with PureBasic information
    EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,10,GadgetY(#IMAGE_WINDOW_ABOUT_V2_PUREBASIC)+GadgetHeight(#IMAGE_WINDOW_ABOUT_V2_PUREBASIC)+5,407+130-3-2-1+20+10,100+10-10,#PB_Editor_ReadOnly|#PB_Text_Center);|#ES_CENTER)    
    t$=""
    t$+"Coded/Compiled using PureBasic "+current_version_purebasic$+" — "+current_release_date_purebasic$+#LF$
    t$+Chr(34)+"Feel the ..Pure.. Power"+Chr(34)+#LF$+#LF$
    t$+"© 1998–"+FormatDate("%yyyy", #PB_Compiler_Date)+" Fantaisie Software."+#LF$
    t$+"www.purebasic.com"
    SetGadgetText(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,t$)
    CompilerSelect #PB_Compiler_OS
      ; Linux centre text in EditorGadget - 27/JAN/2018
      CompilerCase #PB_OS_Linux
        gtk_text_view_set_justification_(GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), #GTK_JUSTIFY_CENTER)
      ; Mac centre text in EditorGadget - 29/JAN/2018  
      CompilerCase #PB_OS_MacOS
        CocoaMessage(0, GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), "setAlignment:", #NSCenterTextAlignment)
    CompilerEndSelect   
Would it be possible for you to make #PB_Text_Center on Linux to have the value of #ES_CENTER so that it will both work in Windows and Linux?

Maybe there is also a constant on macOS for this?

It seems trivial to code:

Code: Select all

If OS=Linux : #PB_Text_Center=#ES_CENTER : EndIf blah blah
Or maybe it doesn't work... now I am confused.

Thanks!