Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global position of control in _Screen/Toplevel form
Message
From
07/06/2005 11:35:49
 
 
To
07/06/2005 11:05:35
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01020751
Message ID:
01020970
Views:
45
This message has been marked as a message which has helped to the initial question of the thread.
>Fabio,
>
>>careful, the race ends soon against a bug.
>>
>>Run this,
>>- press GO
>>- click on 2th TextBox
>>- click on 1th TextBox
>>*** GAME OVER ****
>
>Thanks for pointing that out. In going back to my original notes I encountered other problems as well.
>
>So ... it appears that the best (most reliable) way to set keyboard focus to a toolbar textbox/dropdown is to MOUSE CLICK AT on the control you want to give focus to. I haven't had any problems with this technique other than how ugly this solution looks in code.
>

I don't say this.
I say that the user cannot navigate within a toolbar.

This is a workaround:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form


	autocenter = .T.
	Caption = "Toolbar focus"
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 28, ;
		Left = 64, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "OPEN", ;
		Name = "Command1"

	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 76, ;
		Left = 36, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "GO1", ;
		Enabled = .F., ;
		Name = "Command2"

	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 76, ;
		Left = 156, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "GO2", ;
		Enabled = .F.
		
	PROCEDURE command1.Click
		this.Enabled = .F.
		=ADDPROPERTY(m.thisform,"tb_fonts",CREATEOBJECT("tbarFonts"))
		thisform.command2.Enabled = .t. 
		thisform.command3.Enabled = .t. 
	ENDPROC


	PROCEDURE command2.Click
		thisform.tb_fonts.TextBox1.SetFocus
	ENDPROC

	PROCEDURE command3.Click
		thisform.tb_fonts.TextBox2.SetFocus
	ENDPROC
	
ENDDEFINE

DEFINE CLASS tbarFonts AS Toolbar
	ADD OBJECT TextBox1 AS TextBox
	
	ADD OBJECT TextBox2 AS TextBox
	
	PROCEDURE Init
		this.Dock(0)
		this.Visible = .T.
		
	PROCEDURE TextBox1.GotFocus
		textbox::setfocus
		NODEFAULT
		
	PROCEDURE TextBox2.GotFocus
		textbox::setfocus
		NODEFAULT
ENDDEFINE
>Gratze,
>Malcolm
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform