Jump to content

HyperLinks in About window


Zedna
 Share

Recommended Posts

I searched forum but there are only complicated metods.

Here is the simple one:

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:author@somewhere.com?subject=Something', "", @SW_HIDE)
EndFunc

Func OnWWW()
    Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE)
EndFunc

Note this is working fine on Win9x and also WinXP :)

Here is full code of my example of About window with hyperlinks:

#NoTrayIcon
#include <Constants.au3>
#include <GUIConstants.au3>

Opt("GUICloseOnESC",1)
Opt("GUIOnEventMode",1)

$about = GuiCreate("About",215,150,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU))
GUISetOnEvent ($GUI_EVENT_CLOSE, "AboutOK" )
GUICtrlCreateIcon (@AutoItExe,-1,11,11)
GUICtrlCreateLabel ("App name 1.0",59,11,135,20)
GUICtrlSetFont (-1,10, 800, 0, "Arial"); bold
GUICtrlCreateLabel ("(c) 2005" & @CRLF & @CRLF & "Zedna",59,30,135,40)
$email = GUICtrlCreateLabel ("author@somewhere.com",59,70,135,15)
GuiCtrlSetFont($email, 8.5, -1, 4); underlined
GuiCtrlSetColor($email,0x0000ff)
GuiCtrlSetCursor($email,0)
GUICtrlSetOnEvent(-1, "OnEmail")
$www = GUICtrlCreateLabel ("www.autoitscript.com/forum/",59,85,140,15)
GuiCtrlSetFont($www, 8.5, -1, 4); underlined
GuiCtrlSetColor($www,0x0000ff)
GuiCtrlSetCursor($www,0)
GUICtrlSetOnEvent(-1, "OnWWW")
GUICtrlCreateButton ("OK",65,115,75,23,BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUICtrlSetState (-1, $GUI_FOCUS)
GUICtrlSetOnEvent(-1, "AboutOK")
GUISetState(@SW_SHOW, $about)

While 1 
    Sleep(100)
WEnd

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:author@somewhere.com?subject=Something', "", @SW_HIDE)
EndFunc

Func OnWWW()
    Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE)
EndFunc

Func AboutOK()
    Exit
EndFunc

Func OnAutoItExit()
    GUIDelete($about)
EndFunc

Screenshot:

post-6483-1223213780_thumb.png

Edited by Zedna
Link to comment
Share on other sites

Func _About($TITLE, $MAIN_WINDOW)
    Local $CLOSE, $LABEL, $LABEL2, $MSG, $ABOUT_WINDOW
    Local $ABOUT_TEXT = "CodeWizard" & @CRLF & _
            "Purpose / Logic:" & @CRLF & _
            "   Help in Creating MessageBox, Dialogs, Colors, Fonts, Cursors for GUI" & @CRLF & @CRLF & _
            "Modifications:" & @CRLF & _
            "     03/14/05 - Started program" & @CRLF & _
            "     Last Modified date: 05/12/05" & @CRLF & @CRLF & _
            "Devolopment Team:"
    Local $ABOUT_AUTHOR = "Gary Frost  Programmer/Giuseppe Criaco"
    Local $MAILTO = "CustomPCs@charter.com;gcriaco@quipo.it"
    $ABOUT_WINDOW = GUICreate($TITLE, 500, 250, -1, -1, -1, -1, $MAIN_WINDOW)
    #Region --- CodeWizard generated code Start ---
    If Not IsDeclared('Cadet_Blue_3') Then Dim $Cadet_Blue_3 = 0x7AC5CD
    GUISetBkColor($Cadet_Blue_3)
    #EndRegion --- CodeWizard generated code End ---
    $LABEL = GUICtrlCreateLabel($ABOUT_TEXT, 10, 10, 450, 125)
    $LABEL2 = _GuiCtrlCreateHyperlink($ABOUT_AUTHOR, 27, 130, 443, 20, 0x0000ff, 'E-Mail ' & $MAILTO & " (comments/questions)")
    $CLOSE = GUICtrlCreateButton("Close", 200, 190, 85, 20)
    GUISetState()
    Do
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $CLOSE
                ExitLoop
            Case $MSG = $LABEL2
                _INetMail($MAILTO, "Regarding " & $TITLE, "")
        EndSelect
    Until $MSG = $GUI_EVENT_CLOSE
    GUIDelete($ABOUT_WINDOW)
EndFunc ;==>_About

;===============================================================================
;
; Function Name:    _GuiCtrlCreateHyperlink()
; Description:    Creates a label that acts as a hyperlink
;
; Parameter(s):     $s_Text    - Label text
;                           $i_Left       - Label left coord
;                           [$i_Top]      - Label top coord
;                           [$i_Width]    - Label width
;                           [$i_Height]   - Label height
;                           [$i_Color]    - Text Color
;                           [$s_ToolTip]  - Hyperlink ToolTip
;                           [$i_Style]    - Label style
;                           [$i_ExStyle]  - Label extended style
;
; Requirement(s):   None
; Return Value(s):  Control ID
;
; Author(s):        Saunders <krawlie@hotmail.com>
;
;===============================================================================

Func _GuiCtrlCreateHyperlink($S_TEXT, $I_LEFT, $I_TOP, _
        $I_WIDTH = -1, $I_HEIGHT = -1, $I_COLOR = 0x0000ff, $S_TOOLTIP = '', $I_STYLE = -1, $I_EXSTYLE = -1)
    Local $I_CTRLID
    $I_CTRLID = GUICtrlCreateLabel($S_TEXT, $I_LEFT, $I_TOP, $I_WIDTH, $I_HEIGHT, $I_STYLE, $I_EXSTYLE)
    If $I_CTRLID <> 0 Then
        GUICtrlSetFont($I_CTRLID, -1, -1, 4)
        GUICtrlSetColor($I_CTRLID, $I_COLOR)
        GUICtrlSetCursor($I_CTRLID, 0)
        If $S_TOOLTIP <> '' Then
            GUICtrlSetTip($I_CTRLID, $S_TOOLTIP)
        EndIf
    EndIf
    Return $I_CTRLID
EndFunc ;==>_GuiCtrlCreateHyperlink

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Wait a sec.. there's no way I made that. That doesn't look like my coding style at all. I remember making A hyperlink function, but I don't think I added all those options...

<{POST_SNAPBACK}>

:) You gave the basics for it, I just added to it. :evil:

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 3 months later...

There might be other ways, hadn't thought of taking the time to create the template and document the above function and adding it in to the UDFs.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...