PDA

View Full Version : Texbox deselecting


TarkaDahl
08-17-2010, 03:43 AM
Hi All,

Im using a couple of textboxes in my code. The problem is that if you have one textbox selected you have to double click on another textbox/button to selected/press it. The first click deselecting the first textbox.

The people in my office are finding it really anoying, is there anything that i can do to change this. I am putting in some sort of tab ordering, but they want to single click between textboxes and buttons.

Any help would be good.

Thanks

Jeff
08-18-2010, 12:28 PM
When a textbox loses focus you could check to see if the mouse is over another textbox and make it active:
import viz
import vizdlg

viz.go()

panel = vizdlg.Panel(align=vizdlg.ALIGN_CENTER)

panel.addItem(viz.addText('Textbox1'))
textbox1 = panel.addItem(viz.addTextbox())

panel.addItem(viz.addText('Textbox2'))
textbox2 = panel.addItem(viz.addTextbox())

viz.link(viz.CenterCenter,panel)


def updateFocus():
object = viz.pick(0,viz.SCREEN)
if object == textbox1:
textbox1.setFocus(viz.ON)
elif object == textbox2:
textbox2.setFocus(viz.ON)

vizact.onbuttonup(textbox1,updateFocus)
vizact.onbuttonup(textbox2,updateFocus)

TarkaDahl
08-18-2010, 04:23 PM
Hi Jeff,

Ill try that first thing in the morning.

Thanks

rage1
08-26-2011, 02:02 PM
I'm creating a GUI and I had the same problem. Your approach worked quite well for the textboxes, but what do I have to do with radiobuttons after the textboxes?
Between the textboxes and the buttons is an invisible radiobutton, so none of them is selected. Could you give me a hint how to solve that case? Couldn't find a workaround yet.. :o

Thanks, Rachel