Madza91 Posted October 21, 2007 Posted October 21, 2007 Hi. i have 1 question... Why hyperlink at "label" working, and at "edit" not? #include <GuiConstants.au3> GuiCreate("MyGUI", 501, 431,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label7a = GUICtrlCreateEdit("www.asd.com", 257, 224, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Label7a = GUICtrlCreateLabel("www.asd.com", 257, 204, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Label7a Onwww() Case Else ;;; EndSelect WEnd Exit Func OnWWW() Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
Valuater Posted October 21, 2007 Posted October 21, 2007 When you use the same Control ID ( $Label7a ) twice, it wipes out the first one from working #include <GuiConstants.au3> GuiCreate("MyGUI", 501, 431,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Edit = GUICtrlCreateEdit("www.asd.com", 257, 224, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Label = GUICtrlCreateLabel("www.asd.com", 257, 204, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Edit Onwww() Case $msg = $Label Onwww() Case Else ;;; EndSelect WEnd Exit Func OnWWW() Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc 8)
Madza91 Posted October 21, 2007 Author Posted October 21, 2007 Yes but still not woking :S [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
BrettF Posted October 21, 2007 Posted October 21, 2007 Maybe? Click Me Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Madza91 Posted October 21, 2007 Author Posted October 21, 2007 Nice but too complicated ...i just want to know why not work hyperlink in edit :S [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
Valuater Posted October 21, 2007 Posted October 21, 2007 (edited) I really dont know... things have changed, if i remember correctly, I have used something similar to what i showed you **** anyways, This works.... TESTED OK! #include <GuiConstants.au3> #include <_ControlHover.au3> $GUI = GuiCreate("MyGUI", 501, 431,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Edit = GUICtrlCreateEdit("www.asd.com", 257, 224, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Label = GUICtrlCreateLabel("www.asd.com", 257, 204, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GuiSetState() _ControlHover(2, $GUI, $Edit) While 1 If _ControlHover(1) Then OnWWW() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Label Onwww() Case Else ;;; EndSelect WEnd Exit Func OnWWW() MsgBox(0X0,"TEST","", 2) ;Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc 8) Edited October 21, 2007 by Valuater
BrettF Posted October 21, 2007 Posted October 21, 2007 Val.. I think you kinda forgot _ControlHover... expandcollapse popup#region _ControlHover; ;=============================================================================== ; UDF Name: _ControlHover.au3 ; ; Version v1.2.0 Sept 25, 2006, built with Autoit 3.2.1.3 ; ; Author: Valuater, Robert M ; ; Contributions: marfdaman(Marvin), RazerM, Quaizywabbit(AnyGUI). ; ; Email: <Valuater [at] aol [dot] com> ; ; Use: Enable Mouse/Hover Over Control Events ;=============================================================================== #include-once #include<Array.au3> Global $cHoverID[2], $Global_cHID = 0, $cHoverActive = 0, $cHClicked = 0 ;=============================================================================== ; ; Function Name: _ControlHover() ; Description: Enable Mouse/Hover Over Control Events ; Find if Mouse is over a known control ; Find if a Mouse has Clicked on a known control ; Add, Remove, or Verify the control within the known control list ; Parameter(s): $cH_Mode [default] 0 = Find if Mouse is over a known control ; [optional] 1 = Find if a Mouse has Clicked on a known control ; 2 = Add a control to the known control list ; 3 = Remove a control from the known control list ; 4 = Verify a control is in the known control list ; $cH_hWin [optional] - Window handle as returned by GUICreate() ; [preferred] - Window handle to save CPU usage and speed of _ControlHover() ; - and Avoid array errors for "non-active window" ; $cH_hCntrl [required] - Control ID to Add, Remove, or Verify the control within the known control list ; [not used] - to find if a mouse is over or has clicked on a known control ; Requirement(s): #include<Array.au3> ; Return Value(s): ; $cH_Mode 0 or 1 ; On Success Return = 1 @error = 0, @extended = Current known control ; While Success Return = "" ; On Failure: Return = 0 @error = 1, @extended = Last known control ; $cH_Mode 2, 3, or 4 ; On Success Return = 1 @error = 0, @extended = Function's return line number ; All $cH_Mode's ; On Error: Return = Description of the error ; @error = -1, @extended = Function's return line number ; Author(s): Valuater, Robert M ; ;=============================================================================== Func _ControlHover($cH_Mode = 0, $cH_hWin = "", $cH_hCntrl = "") Local $cH_i, $cH_Data If not @Compiled Then Opt("TrayIconDebug", 1) ; 1=debug line info Select Case $cH_Mode = 0 Or $cH_Mode = 1 ; 0 = Check if mouse is over a control, 1 = Check if mouse clicked on a control ; Developer did not add any controls before the function mode 0 or 1 was called If UBound($cHoverID) = 2 Then ConsoleWrite("*** _ControlHover() Error *** " & @CRLF & "No Controls were Added" & @CRLF) If $cH_hWin = "" Then $cH_Data = GUIGetCursorInfo() ; Get cursor data from the active window Else If Not WinActive($cH_hWin) Then Return SetError( -1, 1, "Window not active") ; Dont waist CPU if the known window is not active $cH_Data = GUIGetCursorInfo($cH_hWin) ; Get cursor data from the known window EndIf If Not IsArray($cH_Data) Then Return SetError( -1, 2, "Window not found") ; A readable GUI window was not found For $cH_i = 1 to UBound($cHoverID) -1 ; Search the known controls for the currently hovered control If $cH_Data[4] = $cHoverID[$cH_i] Then ; Mouse is over a current known control ; Mode 1 - check for a Click on a known control If $cH_Mode And $cH_Data[2] = 1 and Not $cHClicked Then $cHClicked = 1 Return SetError( 0, $cHoverID[$Global_cHID], 1) ; Mouse clicked on current control ElseIf $cH_Mode And $cH_Data[2] <> 1 And $cHClicked Then $cHClicked = 0 Return SetError( 1, $cHoverID[$Global_cHID], 0) ; Release clicked current control EndIf If $cH_Mode Then Return SetError ( "", "", "") ; Mouse is still over last known control and may click again ; Mode 0 & 1 If $cHoverID[$cH_i] = $cHoverID[$Global_cHID] And $cHoverActive Then Return SetError ( "", "", "") ; Mouse is still over last known control If $cHoverActive Then $cHoverActive = 0 Return SetError( 1, $cHoverID[$Global_cHID], 0) ; Release Active - Mouse is over a new known control EndIf $cHoverActive = 1 $cHoverID[$Global_cHID] = $cHoverID[$cH_i] ; Re-set the current control to the new known control Return SetError(0, $cHoverID[$Global_cHID], 1) ; Mouse is over the new-current known control EndIf Next ; hover control not found in the known control list If $cHoverActive Then If $cH_Mode And $cHClicked Then ; check - Release clicked current control $cHClicked = 0 Return SetError( 1, $cHoverID[$Global_cHID], 0) ; Release clicked current control EndIf If $cH_Mode Then Return SetError ( "", "", "") ; Protect the release of the active control $cHoverActive = 0 Return SetError( 1, $cHoverID[$Global_cHID], 0) ; Release Active - Mouse is over a new unknown control EndIf If $cH_Mode And $cHClicked Then $cHClicked = 0 Return SetError( 1, $cHoverID[$Global_cHID], 0) ; Release clicked current control EndIf Return SetError ( "", "", "") Case $cH_Mode = 2 ; Add the new control to the known control list If $cH_hCntrl = "" Then Return SetError( -1, 8, "Control not provided #1") ; The control ID was not given _ArrayAdd($cHoverID, $cH_hCntrl) ; Add the control to the known control array If @error Then Return SetError( -1, 9, "Control not added") ; Control not added to the known control list Return SetError( 0, 10, 1) ; ; Control was added to the known control list Case $cH_Mode = 3 ; Remove the control from the known control list If $cH_hCntrl = "" Then Return SetError( -1, 11, "Control not provided #2") ; The control ID was not given _ArrayDelete($cHoverID, $cH_hCntrl) ; Delete the control from the known control array list If @error Then Return SetError( -1, 12, "Control not removed") ; Control not deleted from the known control list Return SetError( 0, 13, 1) ; Control was deleted from the known control list Case $cH_Mode = 4 ; Verify if control is in the known control list If $cH_hCntrl = "" Then Return SetError( -1, 14, "Control not provided #3") ; The control ID was not given _ArraySearch($cHoverID, $cH_hCntrl) ; Search to verify if control is in the known control list If @error Then Return SetError( -1, 15, "Control not found") ; Control was not found in the known control list Return SetError( 0, 16, 1) ; Control was found in the known control list Case Else Return SetError( -1, 17, "$cH_Mode incorrect") ; $cH_Mode has an incorrect value EndSelect Return SetError( -1, 18, "Unknown Error") ; Error is Unknown EndFunc #endregion Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Nahuel Posted October 22, 2007 Posted October 22, 2007 Using Gary's http://www.autoitscript.com/fileman/users/gafrost/projects/GUIRichEdit/GuiRichEdit.au3expandcollapse popup#include <GuiConstants.au3> #include "GuiRichEdit.au3" $Gui=GuiCreate("MyGUI", 501, 431,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Edit = _GUICtrlRichEditCreate($Gui, 257, 224, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Label7a = GUICtrlCreateLabel("www.asd.com", 257, 204, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GuiCtrlSetFont(-1, 8.5, -1, 4) ; underlined GuiCtrlSetColor(-1,0x0000ff) GuiCtrlSetCursor(-1,0) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_Events") $lResult = _SendMessage($Edit, $EM_AUTOURLDETECT, True) _GUICtrlRichEditAppendText ($Edit,"www.asd.com") GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Label7a Onwww() Case Else ;;; EndSelect WEnd Exit Func OnWWW() Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc Func WM_NOTIFY_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $identifier, $nmhdr, $hwndFrom, $idFrom, $code ;---------------------------------------------------------------------------------------------- $nmhdr = DllStructCreate($NMHDR_fmt, $lParam) $hwndFrom = DllStructGetData($nmhdr, 1) $idFrom = DllStructGetData($nmhdr, 2) $code = DllStructGetData($nmhdr, 3) Switch $hwndFrom Case $Edit Switch $code Case $EN_LINK Local $EN_LINK_struct = DllStructCreate($ENLINK_fmt, $lParam) $hwndFrom = DllStructGetData($EN_LINK_struct, 1) $idFrom = DllStructGetData($EN_LINK_struct, 2) $code = DllStructGetData($EN_LINK_struct, 3) Local $en_link_msg = DllStructGetData($EN_LINK_struct, 4) Local $en_link_wParam = DllStructGetData($EN_LINK_struct, 5) Local $en_link_lParam = DllStructGetData($EN_LINK_struct, 6) Local $cpMin = DllStructGetData($EN_LINK_struct, 7) Local $cpMax = DllStructGetData($EN_LINK_struct, 8) If BitAND($en_link_msg, $WM_LBUTTONDOWN) = $WM_LBUTTONDOWN Then Local $link_clicked = _GUICtrlRichEditGetText ($hwndFrom, $cpMin, $cpMax) ; doesn't seem to work on zoomed text If $link_clicked <> "" Then Run(@ComSpec & ' /c START "" "' & $link_clicked & '"', @SystemDir, @SW_HIDE) EndIf ;---------------------------------------------------------------------------------------------- Case $EN_MSGFILTER Local $EN_MSGFILTER_struct = DllStructCreate($msgfilter_fmt, $lParam) $hwndFrom = DllStructGetData($EN_MSGFILTER_struct, 1) $idFrom = DllStructGetData($EN_MSGFILTER_struct, 2) $code = DllStructGetData($EN_MSGFILTER_struct, 3) Local $en_msgfilter_msg = DllStructGetData($EN_MSGFILTER_struct, 4) Local $en_msgfilter_wParam = DllStructGetData($EN_MSGFILTER_struct, 5) Local $en_msgfilter_lParam = DllStructGetData($EN_MSGFILTER_struct, 6) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY_Events
Madza91 Posted October 22, 2007 Author Posted October 22, 2007 Tnx Valuater,but...,on msgbox works but on Run open web 100 times :S why? #include <GuiConstants.au3> #include <_ControlHover.au3> $GUI = GuiCreate("MyGUI", 501, 431,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Edit = GUICtrlCreateEdit("www.asd.com", 257, 224, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Label = GUICtrlCreateLabel("www.asd.com", 257, 204, 163, 20,BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GuiSetState() _ControlHover(2, $GUI, $Edit) While 1 If _ControlHover(1) Then OnWWW() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Label Onwww() Case Else ;;; EndSelect WEnd Exit Func OnWWW() Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now