Editing listbox entries in place..

BlitzMax Forums/MaxGUI Module/Editing listbox entries in place..

matibee(Posted 2010) [#1]
Is it possible? They're only a list of names in a single column list box.

Cheers


matibee(Posted 2010) [#2]
Ok. Maybe it's not possible out of the box, so what's the best approach? A custom ProxyGadget? Any hints and tips would be most welcome.

Cheers


jsp(Posted 2010) [#3]
I use some sort of workaround.

When editing in place, I just echo the input, but the user is actually typing into a hidden textfield.
That works ok for me and it looks like the user is typing directly into the listbox/treeview.

When in edit mode it uses it's own small event loop.
Another hidden OK-Button catches the return event and leaves the loop.

Also any other event which does not belong to the textfield, stops the input, saves the data and leaves the loop, thus the user can start doing other things in your application without forced to the input.


matibee(Posted 2010) [#4]
Ah ok, thanks. Perhaps I can conjure up a floating edit control to draw over the list box item and use your local loop / leave loop method. I'll be sure to report back.

Thanks again.


matibee(Posted 2010) [#5]
Reporting back..

I gave up with trying anything too fancy. It just isn't worth my time atm. I just made a sort of modal dialog...

Function EditValueDialog:Int ( parent:TGadget, title$, caption$, dest$ Var )
	Local dialogWindow:TGadget = CreateWindow( title$, 0, 0, 300, 98, parent, WINDOW_CLIENTCOORDS | WINDOW_CENTER | WINDOW_TITLEBAR )
	Local editLine:TGadget = CreateTextField( 10, 10, 280, 24, dialogWindow )
	SetGadgetText( editLine, caption$ )
	
	Local okButton:TGadget = CreateButton( "OK", 40, 50, 80, 24, dialogWindow )
	Local cancelButton:TGadget = CreateButton( "Cancel", 180, 50, 80, 24, dialogWindow )
		
	Repeat
		WaitEvent()
		Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case dialogWindow
					FreeGadget( dialogWindow )
					Return 0
			End Select
		Case EVENT_GADGETACTION
			Select EventSource()
			Case okButton
				dest$ = GadgetText( editLine )
				FreeGadget( dialogWindow )
				Return 1
			Case cancelButton 
				FreeGadget( dialogWindow )
				Return 0
			End Select 
		End Select 		
	Forever 
End Function