Page 1 of 1
No possibility to clear noprefix flag in TextGadget
Posted: Sat Jan 31, 2015 10:55 am
by Michael Vogel
The latest purebasic versions (5.24 and 5.31) have #SS_NOPREFIX enabled for text gadgets (version 5.11 had cleared this flag by default).
Code: Select all
If OpenWindow(0,200,200,300,100,"Ampersand Problem",#PB_Window_SystemMenu)
Q$="&Ooops..."
TextGadget(9,50,30,200,20,Q$)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
EndIf
Re: No possibility to clear noprefix flag in TextGadget
Posted: Mon Feb 02, 2015 10:23 am
by Shardik
It's possible to clear the #SS_NOPREFIX flag, but you have to do it before writing the text into the TextGadget in order to see the changed behaviour...
Code: Select all
If OpenWindow(0,200,200,300,100,"Ampersand Problem",#PB_Window_SystemMenu)
Q$="&Ooops..."
TextGadget(9,50,30,200,20,"")
SetWindowLongPtr_(GadgetID(9), #GWL_STYLE, GetWindowLongPtr_(GadgetID(9), #GWL_STYLE) ! #SS_NOPREFIX)
SetGadgetText(9, Q$)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
EndIf
Re: No possibility to clear noprefix flag in TextGadget
Posted: Mon Feb 02, 2015 12:15 pm
by Michael Vogel
Shardik wrote:It's possible to clear the #SS_NOPREFIX flag, but you have to do it before writing the text into the TextGadget in order to see the changed behaviour...

How complicate
Would be fine to have it as easy as previous purebasic version managed this (up to 5.11) - but at least it is still possible, thanks to your workaround

Re: No possibility to clear noprefix flag in TextGadget
Posted: Tue Feb 03, 2015 9:40 am
by Michael Vogel
Thanks Shardik,
I'll use your tip now and can use it to keep old codes running...
Code: Select all
Procedure TextGadget_(gadget,x,w,width,height,text.s,flags=0)
TextGadget(gadget,x,w,width,height,"",flags)
x=GadgetID(gadget)
If flags&#SS_NOPREFIX=#Null
SetWindowLongPtr_(x,#GWL_STYLE,GetWindowLongPtr_(x,#GWL_STYLE)!#SS_NOPREFIX)
EndIf
SetGadgetText(gadget,text)
EndProcedure
CompilerIf #PB_Compiler_Version>511
Macro TextGadget(a,b,c,d,e,f,g=0)
TextGadget_(a,b,c,d,e,f,g)
EndMacro
CompilerEndIf
If OpenWindow(0,200,200,300,100,"Ampersand Problem",#PB_Window_SystemMenu)
TextGadget(9,50,30,200,20,"&Ooops...")
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
EndIf
Re: No possibility to clear noprefix flag in TextGadget
Posted: Tue Feb 03, 2015 2:41 pm
by Blue
Michael Vogel wrote:
Code: Select all
...
CompilerIf #PB_Compiler_Version>511
Macro TextGadget(a,b,c,d,e,f,g=0)
TextGadget_(a,b,c,d,e,f,g)
EndMacro
CompilerEndIf
Darn smart macro you wrote here !
Thank you,
@Michael Vogel.
And thank you
@Shardik as well for that workaround.
No way in a hundred years i would have found that on my own.