Jump to content

Recommended Posts

Posted

I would like to create a hyperlink on some texts on a edit box.
For example, from below example I would like to have a hyperlink
on text "line1", "line2", "line3" so on,
with link to www.blabla.com/line1, www.blabla.com/line2 so on

I dont want to use a RichEdit Control.
 

Local $sData = ""

For $a = 1 to 10
    $sData &= "This is line" & $a & @CRLF
Next

$hGUI = GUICreate("Test Form")
$hEdit = GUICtrlCreateEdit($sData, 10, 10, 100, 100)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 0)
GUICtrlSetFont(-1, 8.5, 400, 4)

GUISetState()
While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case -3
            Exit
        Case $hEdit
            ShellExecute ("www.autoitscript.com",1)
    EndSwitch
WEnd
Posted

Just thinking out loud...( silently clacking with 2 index fingers... ;)

have you thought about using on event mode and just running the ShellExec Function when clicked?

Bill

 

:idiot:

I've done that (silently clacking with 2 index fingers) Bill, whole day, not just thinking that of course :muttley:

My code is using ShellExecute, but this is a EditBox, not label.

I cant using event mode because my other part of code is done not using event mode.

Anyway, I cant see how event mode can help.

  • Moderators
Posted

michaelslamet,

Does it have to be an Edit control? Why not use a List control - then you can detect the double clicked item very easily. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

michaelslamet,

Does it have to be an Edit control? Why not use a List control - then you can detect the double clicked item very easily. :)

M23

 

Melba,

Thanks for taking time for replying :)

For now, yes, it have to be an edit control, because i've done almost everything when suddently there is a need to turn some text on the editbox into a hyperlink o:)

Doesn't this challenging? :muttley:

  • Moderators
Posted

michaelslamet,

If the Edit control is editable by the user, how you you intend to ensure that each line is a valid suffix to the www.blabla.com/ site? :huh:

I would have thought that an Input control passing via some form of sanity check to a List control would be a more suitable method. But if you want an Edit control, good luck with it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

michaelslamet,

If the Edit control is editable by the user, how you you intend to ensure that each line is a valid suffix to the www.blabla.com/ site? :huh:

I would have thought that an Input control passing via some form of sanity check to a List control would be a more suitable method. But if you want an Edit control, good luck with it. :)

M23

 

The editbox is readonly, I only use that for displaying a (very) long string.

This is a somekind of MsgBox but have a ability to display vertical and horizontal scroll when needed (because of a very long string).

Do you have advice for me so I dont need to change many of the code?

The deadline is close, I'm running out of time :)

Posted

You can make a richtext read only and have the field updated by an INI file. I think I understand the concept.

Post your code and we may be able to fix what you need

 

Thank you, MBALZESHARI.

This is a MsgBox "replacement" that I use for display a long string:

(taken from ?do=embed' frameborder='0' data-embedContent>)'>?do=embed' frameborder='0' data-embedContent>)

Local $sData = ""

For $a = 1 to 100
    $sData &= "This is line" & $a & @CRLF
Next

_MsgBoxScrollable(104,"My Title", $sData)

Func _MsgBoxScrollable($mb_Icon, $mb_Title, $mb_Text, $box_width = 5, $mb_Time = '')
    Local $StrnLenText = LongestStringLen($mb_Text, $box_width)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 200
    If $StrnLenText + 150 >= @DesktopWidth - 200 Then $StrnLenText = @DesktopWidth - 200
    Local $Button1Txt = "OK"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 150, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)

    Local $DefaultEditStyle = 0
    If $NumberOfLines >= (@DesktopHeight - 200) Or $StrnLenText + 150 >= 200 Then $DefaultEditStyle = 3150016
    Local $Edit = GUICtrlCreateEdit("", 60, 10, $StrnLenText + 80, $NumberOfLines + 30, _            ; modified jan-04-2014 to allow it accept much more lines/data
        BitOr($DefaultEditStyle, 64+128+2048+4), 0x990)
    GUICtrlSetLimit(-1,0x7FFFFFFF)                                                                    ; added jan-04-2014 to allow it accept much more lines/data
    GUICtrlSetData(-1, $mb_Text)                                                                    ; added jan-04-2014 to allow it accept much more lines/data
    Local $IconID = GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 10 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $Button2 = GUICtrlCreateButton($Button2Txt, 80 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)

    If $NumberOfLines = (@DesktopHeight - 200) Then
        $ScrollLabel1 = GUICtrlCreateLabel("?", 40, ((100 + $NumberOfLines)/2)+20, 20)
        GUICtrlSetTip(-1, "Click here to jump Down")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
        $ScrollLabel2 = GUICtrlCreateLabel("?", 40, ((100 + $NumberOfLines)/2)-20, 20)
        GUICtrlSetTip(-1, "Click here to jump UP")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
    EndIf

    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    ControlFocus($iMsgBox, "", $IconID)

    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $imsg = $Button2
                $MsgValue = 7
                ExitLoop
            Case $imsg = $ScrollLabel1
                ControlSend($iMsgBox, "", $Edit, "{PgDn}")
                ControlFocus($iMsgBox, "", $IconID)
            Case $imsg = $ScrollLabel2
                ControlSend($iMsgBox, "", $Edit, "{PgUp}")
                ControlFocus($iMsgBox, "", $IconID)
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func LongestStringLen($sText, $box_width = 5)
    Local $BiggestStr = 0
    Local $sSplit = StringSplit($sText, @CRLF)

    For $i = 1 To UBound($sSplit)-1
        If StringLen($sSplit[$i]) > $BiggestStr Then $BiggestStr = StringLen($sSplit[$i])
    Next

    ;Return Round(($BiggestStr*2)+($BiggestStr/4))
    Return $BiggestStr*$box_width
EndFunc

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
×
×
  • Create New...