No possibility to clear noprefix flag in TextGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
Michael Vogel
Addict
Addict
Posts: 2806
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

No possibility to clear noprefix flag in TextGadget

Post 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
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: No possibility to clear noprefix flag in TextGadget

Post 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... :wink:

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
User avatar
Michael Vogel
Addict
Addict
Posts: 2806
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: No possibility to clear noprefix flag in TextGadget

Post 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... :wink:
How complicate :shock:
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 :wink:
User avatar
Michael Vogel
Addict
Addict
Posts: 2806
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: No possibility to clear noprefix flag in TextGadget

Post 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
User avatar
Blue
Addict
Addict
Posts: 966
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: No possibility to clear noprefix flag in TextGadget

Post 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.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Post Reply