sproxy
Full Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору
Цитата: Не смог сам разобраться и в хелпе не нашел, как сделать, чтобы в GUI веб ссылки и e-mail ссылки были "живыми". Это возможно сделать в AutoIt? | т.е. при наведение что бы ссылка меняла цвет (или еще что-то) - то попробуй это либо делать самому обработку, пример из справки: Код: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $btn, $rdo, $chk, $iMemo ; Note the controlId from these buttons can NOT be read with GuiCtrlRead _Main() Func _Main() Local $hGUI $hGUI = GUICreate("Buttons", 400, 400) $iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") $btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 90, 50) $rdo = _GUICtrlButton_Create($hGUI, "Radio1", 10, 60, 90, 50, $BS_AUTORADIOBUTTON) $chk = _GUICtrlButton_Create($hGUI, "Check1", 10, 120, 90, 50, $BS_AUTO3STATE) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() MemoWrite("$btn handle: " & $btn) MemoWrite("$rdo handle: " & $rdo) MemoWrite("$chk handle: " & $chk & @CRLF) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>_Main ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam Local Const $BCN_HOTITEMCHANGE = -1249 Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam) Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code") Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom") Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom") Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags") Local $sText = "" Switch $nNotifyCode Case $BCN_HOTITEMCHANGE ; Win XP and Above If BitAND($dwFlags, 0x10) = 0x10 Then $sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF ElseIf BitAND($dwFlags, 0x20) = 0x20 Then $sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF EndIf MemoWrite($sText & _ "-----------------------------" & @CRLF & _ "WM_NOTIFY - Infos:" & @CRLF & _ "-----------------------------" & @CRLF & _ "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _ "CtrlID" & @TAB & ":" & $nID & @CRLF & _ "CtrlHWnd:" & $hCtrl & @CRLF & _ _GUICtrlButton_GetText($hCtrl) & @CRLF) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ; React on a button click Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Local $sText = "" Switch $hCtrl Case $btn, $rdo, $chk Switch $nNotifyCode Case $BN_CLICKED $sText = "$BN_CLICKED" & @CRLF Case $BN_PAINT $sText = "$BN_PAINT" & @CRLF Case $BN_PUSHED, $BN_HILITE $sText = "$BN_PUSHED, $BN_HILITE" & @CRLF Case $BN_UNPUSHED, $BN_UNHILITE $sText = "$BN_UNPUSHED" & @CRLF Case $BN_DISABLE $sText = "$BN_DISABLE" & @CRLF Case $BN_DBLCLK, $BN_DOUBLECLICKED $sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF Case $BN_SETFOCUS $sText = "$BN_SETFOCUS" & @CRLF Case $BN_KILLFOCUS $sText = "$BN_KILLFOCUS" & @CRLF EndSwitch MemoWrite($sText & _ "-----------------------------" & @CRLF & _ "WM_COMMAND - Infos:" & @CRLF & _ "-----------------------------" & @CRLF & _ "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _ "CtrlID" & @TAB & ":" & $nID & @CRLF & _ "CtrlHWnd:" & $hCtrl & @CRLF & _ _GUICtrlButton_GetText($hCtrl) & @CRLF) Return 0 ; Only workout clicking on the button EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND | Добавлено: Справка по функциональности цитат - коды форума........................................... Добавлено: привер живой ссылки используя udf Визитора: Код: #include <GUIConstantsEx.au3> #include <GUICtrlSetOnHover_UDF.au3> ; GUICreate("GUICtrlSetOnHover GUI DEMO", 280, 200) $Button = GUICtrlCreateButton("Button", 20, 40, 100, 20) _GUICtrl_SetOnHover(-1, "_Hover_Func", "_Hover_Func") $Label = GUICtrlCreateLabel("Label", 200, 40, 28, 15) GUICtrlSetFont($Label, 8.5) GUICtrlSetCursor($Label, 0) _GUICtrl_SetOnHover($Label, "_Hover_Func", "_Hover_Func") $CheckBox = GUICtrlCreateCheckbox("CheckBox", 20, 120) _GUICtrl_SetOnHover($CheckBox, "_Hover_Func", "_Hover_Func") $Edit = GUICtrlCreateEdit("Edit", 150, 120, 100, 50) _GUICtrl_SetOnHover($Edit, "_Hover_Func", "_Hover_Func") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit EndSwitch WEnd Func _Hover_Func($iCtrlID, $iParam) Local $sConsole_Data = "Hovered" Local $sButton_Text = "Hover Button" Local $iLabel_Color = 0x00000FF Local $iLabel_FontAttrib = 4 Local $iCheckBox_State = $GUI_CHECKED Local $sEdit_Data = "New Edit Data" If $iParam = 2 Then ;Indicates On *Leave* Hover process $sConsole_Data = "NOT Hovered" $sButton_Text = "Button" $iLabel_Color = 0x000000 $iLabel_FontAttrib = 0 $iCheckBox_State = $GUI_UNCHECKED $sEdit_Data = "Edit Data" EndIf Printf("Control " & $iCtrlID & " [Data: " & GUICtrlRead($iCtrlID, 1) & "] Is Now " & $sConsole_Data) Switch $iCtrlID Case $Button If GUICtrlRead($iCtrlID) <> $sButton_Text Then GUICtrlSetData($iCtrlID, $sButton_Text) Case $Label GUICtrlSetColor($iCtrlID, $iLabel_Color) GUICtrlSetFont($iCtrlID, Default, Default, $iLabel_FontAttrib) Case $CheckBox GUICtrlSetState($iCtrlID, $iCheckBox_State) Case $Edit If GUICtrlRead($iCtrlID) <> $sEdit_Data Then GUICtrlSetData($iCtrlID, $sEdit_Data) EndSwitch EndFunc Func Printf($Str, $Line=@ScriptLineNumber) ConsoleWrite("!===========================================================" & @LF & _ "+======================================================" & @LF & _ "--> Script Line (" & $Line & "):" & @LF & "!" & @TAB & $Str & @LF & _ "+======================================================" & @LF) EndFunc |
|