EndFunc ;==>Example Function Reference GUICtrlCreateTabItem tạo ra TabItem control cho GUI.. GUICtrlCreateTabItem "text" Parameters text tên hiển thị Return Value Success: trả lại
Trang 1Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $msg
GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$tab = GUICtrlCreateTab(10, 10, 200, 100)
$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)
$tab1 = GUICtrlCreateTabItem("tab 1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)
$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)
GUICtrlCreateTabItem("") ; end tabitem definition
GUICtrlCreateLabel("label3", 20, 130, 50, 20)
GUISetState()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Trang 2EndFunc ;==>Example
Function Reference
GUICtrlCreateTabItem
tạo ra TabItem control cho GUI
GUICtrlCreateTabItem ( "text" )
Parameters
text tên hiển thị
Return Value
Success: trả lại ControlID
Failure: Returns 0
Remarks
để thiết đặt thêm thông tin ta dùng GUICtrlSet
để đặt tabitem nào đc hiện thị trước khi tab hiện thị ta dùng GUICtrlSetState(-1,$GUI_SHOW) xem vd ở dưới
text = "" có nghĩa là kết thúc việc tạo control trên tabitem
GUICtrlRead($tab,1) sẽ trả lại controlID của tab đang hiện thị chứ ko phải số thứ
tự của nó
để tạo thêm 1 control mới trong tab ta dùng GUISwitch($hWin,$tabitem) để chọn tabitem đó, ko bình thường control đc tạo mới trên GUI
Trang 3Related
GUICtrlSetState, GUISwitch, GUIGetMsg, GUICtrlRead, GUIEventOptions (Option)
Example
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $msg
GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$tab = GUICtrlCreateTab(10, 10, 200, 100)
$tab0 = GUICtrlCreateTabItem("tab0")
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)
$tab1 = GUICtrlCreateTabItem("tab 1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)
$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW); will be display first
Trang 4GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)
GUICtrlCreateTabItem(""); end tabitem definition
GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)
GUISetState()
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
If $msg = $tab Then
; display the clicked tab
WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab)) EndIf
WEnd
EndFunc ;==>Example
Function Reference
GUICtrlCreateTreeView
tạo một TreeView control cho GUI
GUICtrlCreateTreeView ( left, top [, width [, height [, style [, exStyle]]]] )
Parameters
height H
Trang 5style
kiểu, xem GUI Control Styles Appendix
default (-1) : $TVS_HASBUTTONS, $TVS_HASLINES,
$TVS_LINESATROOT, $TVS_DISABLEDRAGDROP,
$TVS_SHOWSELALWAYS forced style : $WS_TABSTOP exStyle kiểu mở rộng, xem Extended Style Table
Return Value
Success: trả lại ControlID
Failure: Returns 0
Remarks
để đặt các thuộc tính cho control ta dùng GUICtrlSet
để sử dụng nhiều kiểu trong style ta dùng
BitOr($GUI_SS_DEFAULT_TREEVIEW, newstyle, )
để có thể dùng đc các biến trên ta cần phải khai báo thư viện #include
<TreeViewConstants.au3> in your script
Related
GUICtrlCreateTreeViewItem, GUICoordMode (Option), GUICtrlSet , GUIGetMsg, GUICtrlRead
Example
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <StaticConstants.au3>