Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

clickable web link in edit line

I was wondering if there was an addition to the edit line control that gives the user the capability to double click on the web address entered and opening the webpage that address was pointing to.

Comments

  • Assuming you are really talking about the native OI edit line control, there is nothing built-in that supports this feature. I presume you want the content of the edit line control to be editable? If so, then your best bet is to capture the Windows WM_LBUTTONDOWN message and trap this in the WINMSG event. Then just use ShellExecute to execute the link. The problem here is that any clicking in the edit line control will trigger the event. You won't be able to make this as elegant as a true hyperlink embedded in the edit line control.

    If you only need to display the link and the end user is not allowed to edit this directly, I would recommend the SRP HyperLink control.
  • Okay that means that I will add a button next to the edit line.
  • If you want to avoid extra UI on the form, you could also just make a context menu that gives the user the option to launch the URL.
  • Thanks for all the help everything is working like a charm except the fact that I can not change the image for the option button. I wanted to show a globe noting that if you click the button it would open the webpage in question
    The command that I am using is "Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[":CtrlId:"]", "C:\MyOptionImage.png")" Any suggestions?
  • If CtrlId is the fully qualified name, then you need to replace periods with semi-colons. OI doesn't like periods being passed into indexes. In other words, this would not work:

    Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[MY_FORM.MY_EDITLINE]", "C:\MyOptionImage.png")

    But this does:

    Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[MY_FORM;MY_EDITLINE]", "C:\MyOptionImage.png")

    Option 3 is to tell the Subclass control the name of the window in advance so you can use just the control name:

    Set_Property(@Window:".OLE_SUBCLASS", "OLE.CurrentWindow", "MY_FORM") . . . Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[MY_EDITLINE]", "C:\MyOptionImage.png")
  • Sorry Kevin I misled you by showing you the example that was send to me.
    Here is the real line of code that I used

    Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[":@Window : ';' : EditCtrl:"]", "f:\Shoes2000\bmps\chrome.jpg")
  • EditCtrl is the variable that contains the name of the control in question.
  • Are you setting the image after setting OLE.OptionButton to 1?
  • Ken this is the snippet where I am setting all the options
    For EditCnt = 1 to NumCtrls
    EditCtrl = Field(EditCtrls, ',', EditCnt, 1)
    Handle = Get_Property(@Window : '.' : EditCtrl, 'HANDLE')
    Send_Message(Ctrl, 'OLE.Subclass', Handle, @Window : '.' : EditCtrl)
    Set_Property(Ctrl, 'OLE.OptionButton[' : @Window : ';' : EditCtrl : ']', True$)
    Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnOptionClick', Qualify)
    if EditCtrl = 'EDL_SHARE_URL' then
    Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionImage[":@Window : ';' : EditCtrl:"]", "f:\Shoes2000\bmps\chrome.jpg")
    end
    Next EditCnt
  • That code looks ok to me.
    Did you figure this out?
  • The code does look correct. My guess is that the subclass control just isn't able to load the image for some reason.
  • Just for the sake of keeping all interested up to date, this was resolved by fixing a typo.
  • Actually, now that I think about it, the typo was not in the syntax but in the path to the image. We had a online meeting to resolve this.
  • I thought it would be pushing the boundaries to suggest such a thing even though it's my most common error.

    Glad it's sorted.
Sign In or Register to comment.