Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Focus from treeview to a datawindow on a tab automatically

Status
Not open for further replies.

Janosh

Programmer
Apr 26, 2010
9
FI
I have two frames in my program. In the left frame I have a treeview-menu (tv_menu) and depending on what I choose, a tab opens in the right frame (tab_1).

And what I would need, is to get the focus to move from the tv_menu to a certain field in a datawindow in tab_1 when i choose a ceratain 'header' from tv_menu.

I've tried all kinds of combinations like:
tab_1.SetFocus()
tab_1.control[upperbound(tab_1.control)].SetFocus()
and mixing with the taborders etc. but nothing seems to work...

Please help me!
 
Generally you have a tab control with tab pages on it. On the tab pages are the datawindows. The syntax is then: tab_1.tabpage_1.dw_1.Setfocus()

Have you tried this?

Matt

"Nature forges everything on the anvil of time
 
Thanks for your reply, but in my case I don't have a static tabpage on my tab control, but instead a user object (because i want to create tabpages dynamically depending on what header in the treeview you click)
Here's how i create my tab:

//******
tab_1.opentab( uo_tab, "uo_my_tab_page", 0)
ls_tabname = "Tabname"
tab_1.selecttab(upperbound(tab_1.control))
tab_1.control[upperbound(tab_1.control)].Text = ls_tabname
tab_1.control[upperbound(tab_1.control)].PictureName = "icons/tab_pic_16.gif"
//******


if I try for example:
"tab_1.uo_tab.dw_1.setFocus()" or
"tab_1.uo_my_tab_page.dw_.setFocus()" or
"tab_1.uo_tab.setFocus()"
they all result in error message:
"Incompatible property uo_tab for type tab_1" or
"Incompatible property uo_my_tab_page for type tab_1"
 
Are you able to do a Selecttab on tab_1 to select the newly created tabpage?

Matt

"Nature forges everything on the anvil of time
 
You will need to use SelectTab( <tab number> ) first to visually bring that tab up. Next, you will need to use tab_1.<whatever you named the tabpage>.<datawindow>.SetFocus( )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top