[PB 6.20 beta 2] EditorGadget no longer centres text

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

[PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

Heya,

Code: Select all

    ; Editor Gadget with PureBasic information
    EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,x,y,ImageWidth(31)-ImageWidth(32)-10,ImageHeight(32),#PB_Editor_ReadOnly|#PB_Text_Center);|#ES_CENTER)    
    t$=""+#LF$
    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$)
Constant

Code: Select all

#PB_Text_Center
stopped working.

Thanks!

// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by BarryG »

Not a bug. The EditorGadget doesn't support the #PB_Text_Center flag. If it worked before, it was just luck. You have to use only the supported flags.

Supported flags -> https://www.purebasic.com/documentation ... adget.html
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

I am so sad:
Image
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by le_magn »

Same situation, for me #ES_CENTER for editor gadget always worked before, now with 6.20 not work anymore :(
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by RASHAD »

Try

Code: Select all

EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,x,y,ImageWidth(31)-ImageWidth(32)-10,ImageHeight(32),#PB_Editor_ReadOnly|#PB_Text_Center);|#ES_CENTER) 
SendMessage_(GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
Egypt my love
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by le_magn »

RASHAD wrote: Sat Dec 21, 2024 1:29 am Try

Code: Select all

EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,x,y,ImageWidth(31)-ImageWidth(32)-10,ImageHeight(32),#PB_Editor_ReadOnly|#PB_Text_Center);|#ES_CENTER) 
SendMessage_(GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
Thank you Rashad this workaround work for me :)
Image
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

It doesn't work here on Windows 11.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by BarryG »

It's just text... so why not use a TextGadget with #PB_Text_Border and #PB_Text_Center?
Last edited by BarryG on Sun Dec 22, 2024 12:10 am, edited 1 time in total.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by RASHAD »

Did you used #ES_CENTER ?

Code: Select all

EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,x,y,ImageWidth(31)-ImageWidth(32)-10,ImageHeight(32),#PB_Editor_ReadOnly|#ES_CENTER) 
SendMessage_(GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
Egypt my love
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

RASHAD wrote: Sat Dec 21, 2024 7:41 am Did you used #ES_CENTER ?

Code: Select all

EditorGadget(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC,x,y,ImageWidth(31)-ImageWidth(32)-10,ImageHeight(32),#PB_Editor_ReadOnly|#ES_CENTER) 
SendMessage_(GadgetID(#EDITOR_WINDOW_ABOUT_V2_PUREBASIC), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
Ahhhh... I used

Code: Select all

#PB_Text_Center
:oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

Ahhhhhh... it still doesn't work.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by le_magn »

marcoagpinto wrote: Sat Dec 21, 2024 7:33 am It doesn't work here on Windows 11.
I am on win10, but if centering Always working until 6.12 and now with 6.20 no Is a sad thing, this not a bug but it would be better if the possibility to center the text remained as it was before :(
Image
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by infratec »

If you want a platform independetnt solution without API ....

use a WebGadget and a piece of html.

Code: Select all

EnableExplicit

Define html$

html$ = "<html>" +
        "<head>" +
        "<title></title>" +
        "</head>" +
        "<body style='border: 1px solid black; margin:0; padding:0'>" + 
        "<div text0 align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;'>" +
        "<br>" +
        "Coded/Compiled using PureBasic " + Str(#PB_Compiler_Version / 100) + "." + Str(#PB_Compiler_Version % 100) + " -- " + FormatDate("%yyyy-%mm-%dd", Date()) + "<br>" +
        ~"\"Feel the ... Pure ... Power\"<br>" +
        "<br>" +
        "&copy; 1998 - " + FormatDate("%yyyy", Date()) + " Fantasie Software<br>" +
        "<a href='https:/www.purebasic.com'>www.purebasic.com</a><br>" +
        "<br>" +
        "</div>" +
        "</body>" +
        "</html>"

OpenWindow(0, 0, 0, 600, 400, "Center text", #PB_Window_SystemMenu)

WebGadget(0, 100, 100, 400, 130, "")
SetGadgetItemText(0, #PB_Web_HtmlCode, html$)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Last edited by infratec on Sat Dec 21, 2024 1:40 pm, edited 8 times in total.
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by Fred »

You can do that:

Code: Select all

  If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    EditorGadget(0, 8, 8, 306, 133)
    SendMessage_(GadgetID(0), #EM_SETTEXTMODE, #TM_RICHTEXT, 0)
    Format.PARAFORMAT\cbSize = SizeOf(PARAFORMAT)
    Format\dwMask     = #PFM_ALIGNMENT
    Format\wAlignment = #PFA_CENTER
    SendMessage_(GadgetID(0), #EM_SETPARAFORMAT, 0, Format)
    t$=""+#LF$
    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(0,t$)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
User avatar
marcoagpinto
Addict
Addict
Posts: 1076
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text

Post by marcoagpinto »

Heya, all,

Thank you for the help.

I will use a WebGadget.
Post Reply