changing gadget properties

BlitzMax Forums/MaxGUI Module/changing gadget properties

Hardcoal(Posted 2013) [#1]
I have a Textarea and I want to make it WordWrap
how do I update a gadget flags?


jsp(Posted 2013) [#2]
There is no MaxGui command for it.
You need to know it beforehand.
There is perhaps a Windows (only) API call who can change it...
As dirty workaround you could create two textareas and show the one you like.

Any special reason you want to change that flag during runtime?


Hardcoal(Posted 2013) [#3]
when you have wordwrap option on and off like in window notepad.

if no choice then ill recreate the textarea.


Hardcoal(Posted 2013) [#4]
well ive managed to do that by freegadget and recreating it.
sad and weird that this is the only option.


col(Posted 2013) [#5]
Hiya,

For Windows you could use something like...
Strict

Import MaxGUI.Drivers

Global Window:TGadget = CreateWindow("Word wrap",200,0,500,500)
Global Text:TGadget = CreateTextArea(0,0,ClientWidth(Window),ClientHeight(Window)-60,Window)

' Some text
SetGadgetText Text,"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla eget mauris quis dolor "+..
"ullamcorper dapibus. Duis facilisis ullamcorper metus. Pellentesque eget enim. Vivamus auctor hendrerit turpis. " + ..
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus tincidunt leo quis urna."

Global WordWrapChoice:TGadget = CreateButton("Word wrap",10,GadgetHeight(Text)+10,100,30,Window,BUTTON_CHECKBOX)

Repeat
	WaitEvent
	
	Select EventSource()
		Case Window
			If EventID() = EVENT_WINDOWCLOSE End
			
		Case WordWrapChoice
			Local hWnd = QueryGadget(Text,QUERY_HWND)
			
			Select ButtonState(WordWrapChoice)
				Case True
					SendMessageW(hWnd,EM_SETTARGETDEVICE,0,0)
					
				Case False
					SendMessageW(hWnd,EM_SETTARGETDEVICE,0,1)
			EndSelect
	EndSelect
Forever


Not sure for the other OSs though.


Hardcoal(Posted 2013) [#6]
thanks Col