Jump to content
Sign in to follow this  
rexx

Tab index of ListView and TreeView in tabs

Recommended Posts

rexx

I have a GUI with several tabs, and a TreeView or ListView in each tab.

but the tab ordering is not as i expected, the order is TV -> Tab -> other controls in tab. But i want Tab -> TV in tab -> other controls in tab after TV.

LV has the same problem.

Here's a simple code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("Form1", 301, 284, 240, 142)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(24, 24, 249, 225)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TreeView1 = GUICtrlCreateTreeView(40, 64, 209, 129, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateTreeViewItem("1", $TreeView1)
GUICtrlCreateTreeViewItem("2", $TreeView1)
$Input1 = GUICtrlCreateInput("Input1", 40, 208, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 208, 75, 25, $WS_GROUP)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$ListView1 = GUICtrlCreateListView("a|b|c", 48, 72, 201, 121)
GUICtrlCreateListViewItem("1|2|3", $ListView1)
GUICtrlCreateListViewItem("3|2|1", $ListView1)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 208, 97, 17)
$Button2 = GUICtrlCreateButton("Button2", 176, 208, 75, 25, $WS_GROUP)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc
Edited by rexx

Share this post


Link to post
Share on other sites
BugFix

I'm confused. :D

You've scripted:

- GUI with Tab

- TabItem1 with Treeview, Input and Button inside

- TabItem2 with Listview, Checkbox and Button inside

And exactly this is, what your script do.


Best Regards BugFix  

Share this post


Link to post
Share on other sites
rexx

I mean, if you press "tab" key on the GUI, you'll see the focus is moving across the controls.

the focused control will have a dotted border (or the I caret for edit control).

My question is, the order is not what i expected, the tab and tv/lv are reversed.

It shoud be tab first and then tv/lv, but actually it's tv/lv then tab, and then other controls.

I want it to be 2 1 3 4 but it's 1 2 3 4

post-50829-12515945074184_thumb.png

Edited by rexx

Share this post


Link to post
Share on other sites
BugFix

Ah sorry, I've missunderstand this.

Hmm, you're right. By definition the tab order in AutoIt is similiar to control creation after GUICreate. But your example fails. I've tested something to change creation and tab order, but i've found no way to solve.


Best Regards BugFix  

Share this post


Link to post
Share on other sites
Manjish

This will give you the result you want:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("Form1", 301, 284, 240, 142)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(24, 24, 249, 225)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TreeView1 = GUICtrlCreateTreeView(40, 64, 209, 129, -1, $WS_EX_CLIENTEDGE)

GUICtrlCreateTreeViewItem("1", $TreeView1)
GUICtrlSetState(-1,$gui_focus)
GUICtrlCreateTreeViewItem("2", $TreeView1)

$Input1 = GUICtrlCreateInput("Input1", 40, 208, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 208, 75, 25, $WS_GROUP)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$ListView1 = GUICtrlCreateListView("a|b|c", 48, 72, 201, 121)
GUICtrlCreateListViewItem("1|2|3", $ListView1)
GUICtrlSetState(-1,$gui_focus)
GUICtrlCreateListViewItem("3|2|1", $ListView1)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 208, 97, 17)
$Button2 = GUICtrlCreateButton("Button2", 176, 208, 75, 25, $WS_GROUP)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
rexx

Thanks, but the result is not changed, the tab order is still the same.

Share this post


Link to post
Share on other sites
Manjish

Are you sure? I get the kind of tab order you want when I use the script I have posted above:


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
rexx

No, in your screenshot it the same as the original one.

But what i want is tabsheet1 first, and then TreeView, and then input1, button1.

my screen is the how it works, the same as yours, TV first and then tabsheet.

Are you sure? I get the kind of tab order you want when I use the script I have posted above:

Share this post


Link to post
Share on other sites
Manjish

If I see your screenshot correctly, I see that You have mentioned the order as :

TV--> Tab --> IP box --> Button

If I see your post, you have mentioned order as:

Tab--> TV --> IP Box --> Button

I am getting seriously confused here :D

Please clarify


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
Manjish

Is this what you want?:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{TAB}","focus")
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("Form1", 301, 284, 240, 142)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Tab1 = GUICtrlCreateTab(24, 24, 249, 225)
GUICtrlSetResizing($Tab1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetState($tab1,$gui_focus)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TreeView1 = GUICtrlCreateTreeView(40, 64, 209, 129, -1, $WS_EX_CLIENTEDGE)

GUICtrlCreateTreeViewItem("1", $TreeView1)

GUICtrlCreateTreeViewItem("2", $TreeView1)

$Input1 = GUICtrlCreateInput("Input1", 40, 208, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 176, 208, 75, 25, $WS_GROUP)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$ListView1 = GUICtrlCreateListView("a|b|c", 48, 72, 201, 121)
GUICtrlCreateListViewItem("1|2|3", $ListView1)
GUICtrlSetState(-1,$gui_focus)
GUICtrlCreateListViewItem("3|2|1", $ListView1)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 208, 97, 17)
$Button2 = GUICtrlCreateButton("Button2", 176, 208, 75, 25, $WS_GROUP)
GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc
 

 Func focus()
     
     Select 
    Case ControlGetFocus ( "Form1" , "")="SysTabControl321"
         GUICtrlSetState($treeview1,$gui_focus)
    Case ControlGetFocus ( "Form1" , "")="SysTreeview321" 
         GUICtrlSetState($input1,$gui_focus)
    Case ControlGetFocus ( "Form1" , "")="Edit1" 
         GUICtrlSetState($button1,$gui_focus)
     Case ControlGetFocus ( "Form1" , "")="Button1" 
         GUICtrlSetState($tab1,$gui_focus)
     EndSelect
EndFunc

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.