Page 1 of 2
[PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Fri Dec 20, 2024 11:54 pm
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
stopped working.
Thanks!
// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Fri Dec 20, 2024 11:59 pm
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
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 12:05 am
by marcoagpinto
I am so sad:

Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 1:10 am
by le_magn
Same situation, for me #ES_CENTER for editor gadget always worked before, now with 6.20 not work anymore

Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 1:29 am
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)
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 1:37 am
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

Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 7:33 am
by marcoagpinto
It doesn't work here on Windows 11.
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 7:36 am
by BarryG
It's just text... so why not use a TextGadget with #PB_Text_Border and #PB_Text_Center?
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 7:41 am
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)
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 8:12 am
by marcoagpinto
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 8:19 am
by marcoagpinto
Ahhhhhh... it still doesn't work.
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 12:07 pm
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

Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 12:57 pm
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>" +
"© 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
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 1:20 pm
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
Re: [PB 6.20 beta 2] EditorGadget no longer centres text
Posted: Sat Dec 21, 2024 2:01 pm
by marcoagpinto
Heya, all,
Thank you for the help.
I will use a WebGadget.