sproxy
Full Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору to NIKZZZZ Цитата: Можно ли организовать всплывающие подсказки при наведении на элемент ? | да, вот вариант: Код: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Hello World", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("Наведи на кнопку OK", 30, 10) $okbutton = GUICtrlCreateButton("OK", 70, 50, 60) GUICtrlSetOnEvent($okbutton, "OKButton") ;~ "GUICtrlSetTip" - Функция для установки подсказок: GUICtrlSetTip ( $okbutton, "Вот и текст подсказки" ) GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func OKButton() MsgBox(0, "GUI Event", "You pressed OK!") EndFunc Func CLOSEClicked() Exit EndFunc | Добавлено: посмотрите, пож. главное тут - input1 и input2 как добиться, что бы при нажатии TAB фокус переходил от одного input-а, далее к дургому input-у и далее по кнопкам. после создания всех-всех gui элементов поставил GUISwitch($Child1) , на окно родитель этих input-ов - не помагает.....бедствие какое - то.....и может быть есть вариант ограничивания - запрет передачи фокуса по нажатии TAB элементу? как понимаю $WS_TABSTOP - это только для окон, верно? хотя пробовал и на input-ах, то же без успешно....(( Код: #Include <Constants.au3> #include <GuiConstantsEx.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> #include <ListViewConstants.au3> #include <EditConstants.au3> Global $hImageList = 0 Global $what_do = "" TraySetClick( 8 ) $Main_GUI = GUICreate("Tab Sample", 400, 300, -1, -1);, BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS)) $OK_Button = GUICtrlCreateButton("OK", 110, 270, 70, 20) $Cancel_Button = GUICtrlCreateButton("Cancel", 220, 270, 70, 20) GUISetState() ; Creates the first child window that is implemented into the main GUI $Child1 = GUICreate("", 370, 215, 15, 40, BitOR($WS_CHILD, $WS_TABSTOP), -1, $Main_GUI) $child1_tab = GUICtrlCreateTab(0, 0, 370, 215) $child1_tabitem1 = GUICtrlCreateTabItem("Child1Tab1") ;~ -------------------------- $input1 = GUICtrlCreateinput( "input1", 10, 110, 150, 20 ) GUICtrlSetState( $input1, $GUI_SHOW) $input2 = GUICtrlCreateinput( "input2", 10, 140, 150, 20 ) GUICtrlSetState( $input2, $GUI_SHOW) ;~ -------------------------- $combo = GUICtrlCreateCombo( "item1", 10, 30, 150, "", BitOR($CBS_DROPDOWN, $CBS_DISABLENOSCROLL) ) GUICtrlSetState( $combo, $GUI_HIDE) GUICtrlSetData( $combo,"item2|item3", "item3" ) GUICtrlSetState( $combo, $GUI_SHOW) ;~ GUICtrlSetState( $combo, $GUI_ONTOP) $bt_normal = GUICtrlCreateButton( "normal", 10, 55, 70, 20 ) $bt_block = GUICtrlCreateButton( "block", 85, 55, 70, 20 ) $bt_as_input = GUICtrlCreateButton( "as_input", 160, 55, 70, 20 ) $child1_tabitem2 = GUICtrlCreateTabItem("Child1Tab2") $child1_tabitem3 = GUICtrlCreateTabItem("Child1Tab3") GUICtrlCreateTabItem("") GUISetState() ; Creates the second child window that is implemented into the main GUI $child2 = GUICreate("", 370, 215, 15, 40, BitOR($WS_CHILD, $WS_TABSTOP), -1, $Main_GUI) $child3 = GUICreate("", 210, 220, 158, 0, BitOR($WS_CHILD, $WS_TABSTOP), -1, $child2) $ListView = GUICtrlCreateListView("Col1|Col2", 0, 2, 210, 211, _ BitOR($LVS_NOSORTHEADER, $LVS_SHOWSELALWAYS, $WS_TABSTOP), $WS_EX_CLIENTEDGE) GUICtrlCreateListViewItem("ItemLong1|ItemLong2", $ListView) GUICtrlCreateListViewItem("ItemLong3|ItemLong4", $ListView) GUICtrlCreateListViewItem("ItemLong5|ItemLong6", $ListView) GUISetState() GUISwitch($child2) $child2_tab = GUICtrlCreateTab(0, 0, 156, 215) $child2_tabitem1 = GUICtrlCreateTabItem("Child2Tab1") $child2_tabitem2 = GUICtrlCreateTabItem("Child2Tab2") GUICtrlCreateTabItem("") ; Switch back the main GUI and create the tabs GUISwitch($Main_GUI) $main_tab = GUICtrlCreateTab(10, 10, 380, 250) $main_tabitem1 = GUICtrlCreateTabItem("MainTab1") $main_tabitem2 = GUICtrlCreateTabItem("MainTab2") GUICtrlCreateTabItem("") GUICtrlSetState($main_tabitem1, $GUI_SHOW) ;~ -------------------------- GUISwitch($Child1) GUICtrlSetState( $child1_tabitem1, $GUI_SHOW ) Bind_ImageList($main_tab) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $bt_normal GUICtrlSetStyle( $combo, "", $CBS_SIMPLE ) Case $msg[0] = $bt_block GUICtrlSetStyle( $combo, "", $CBS_DROPDOWNLIST ) Case $msg[0] = $bt_as_input ;~ GUICtrlSetStyle( $combo, ????? ) Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $Cancel_Button ExitLoop Case $msg[0] = $main_tab $tabidx = GUICtrlRead($main_tab) Select Case $tabidx = 0 GUISetState(@SW_HIDE, $child2) GUISetState(@SW_SHOW, $Child1) Case $tabidx = 1 GUISetState(@SW_HIDE, $Child1) GUISetState(@SW_SHOW, $child2) EndSelect EndSelect $msg = TrayGetMsg() If $msg = $TRAY_EVENT_PRIMARYDOWN Then win_show_hide_active() If WinGetState( $Main_GUI ) == 15 Then $what_do = "hide" ElseIf WinGetState( $Main_GUI ) == 5 Then $what_do = "show" Else $what_do = "active" EndIf ToolTip( "State: " & WinGetState( $Main_GUI ) & " Active: " & WinActive( $Main_GUI ), 0, 60 ) WEnd Func win_show_hide_active() If $what_do = "hide" Then GUISetState( @SW_HIDE, $Main_GUI ) ElseIf $what_do = "show" Then GUISetState( @SW_SHOW, $Main_GUI ) Else GUISetState( @SW_RESTORE, $Main_GUI ) EndIf EndFunc DllCall("comctl32.dll", "int", "ImageList_Destroy", "hwnd", $hImageList) Func ImageList_Create() $hImageList = DllCall("comctl32.dll", "hwnd", "ImageList_Create", "int", 16, "int", 16, "int", 0x0021, "int", 0, "int", 1) $hImageList = $hImageList[0] Return $hImageList EndFunc ;==>ImageList_Create Func Bind_ImageList($nCtrl) $hImageList = ImageList_Create() GUICtrlSendMsg($nCtrl, $TCM_SETIMAGELIST, 0, $hImageList) $szIconFile = "shell32.dll" $tcitem = DllStructCreate("uint;dword;dword;ptr;int;int;int") DllStructSetData($tcitem, 1, 0x0002) DllStructSetData($tcitem, 6, 0) AddImageToTab($nCtrl, 0, $tcitem, $szIconFile, 12) DllStructSetData($tcitem, 6, 1) AddImageToTab($nCtrl, 1, $tcitem, $szIconFile, 21) $tcitem = 0 EndFunc ;==>Bind_ImageList Func AddImageToTab($nCtrl, $nTabIndex, $nItem, $szIconFile, $nIconID) $hIcon = DllStructCreate("int") $result = DllCall("shell32.dll", "int", "ExtractIconEx", "str", $szIconFile, "int", $nIconID, "hwnd", 0, "ptr", DllStructGetPtr($hIcon), "int", 1) $result = $result[0] If $result > 0 Then DllCall("comctl32.dll", "int", "ImageList_AddIcon", "hwnd", $hImageList, "hwnd", DllStructGetData($hIcon, 1)) DllCall("user32.dll", "int", "SendMessage", "hwnd", ControlGetHandle($Main_GUI, "", $nCtrl), "int", $TCM_SETITEM, "int", $nTabIndex, "ptr", DllStructGetPtr($nItem)) DllCall("user32.dll", "int", "DestroyIcon", "hwnd", $hIcon) EndIf $hIcon = 0 EndFunc ;==>AddImageToTab |
| Всего записей: 556 | Зарегистр. 21-11-2007 | Отправлено: 16:56 29-07-2008 | Исправлено: sproxy, 16:58 29-07-2008 |
|