Using Hyperlinks in the Clarify Classic Client

I’ve been doing a little Clarify Classic Client development lately, and I’ve found I’ve been using hyperlinks more and more as elements on forms as opposed to buttons.

A common usage of hyperlinks is to open URLs, such as a site’s website. But we can also use them to invoke other actions.

Here’s a form that has a few different hyperlinks in action:

case with hyperlinks

There are 4 hyperlinks in play on this form

  • 2 Open Subcases (opens the Subcase List form, showing the list of subcases for this case)
  • ? (Opens a message box with help text, detailing the Case Title information)
  • Copy Case ID to Clipboard (um, copies the case id number to to the clipboard)
  • Expand (Opens the case history in a larger/expanded form)

So as you can see, a hyperlink can be used for more than simply opening a webpage using your browser.

I like the hyperlinks as they feel less heavy, visually speaking, than buttons.

What is a hyperlink in Clarify?

A hyperlink is actually just a label, with its Hyperlink property set to Yes.

I also set the Use Link String property set to Yes and the Link String property to blank.

I typically change the ForeColor and Hyperlink Color to blue.

Here’s what the properties of the Copy Case ID to Clipboard hyperlink look like:


Make it do something

Of course, to make it do something, we have to use a bit of ClearBasic code. Just add a click handler to your label control.

Here’s the code behind the “X Open Subcases” label:

  App.ExecuteMenu "Apps", "ClearSupport"
  App.ExecuteMenu "Select", "Subcases"
End Sub

Here’s the CB code behind the Copy Case ID to Clipboard label:

Sub lbl_copy_case_id_Click()
    Dim recCase As Record
    Dim origCaption As String
    origCaption = lbl_copy_case_id.Caption
    Set recCase = cobj_CASE_OBJ.Contents
    Dim caseId As String
    caseId = recCase.GetField("id_number")
    Clipboard.SetText caseId
    lbl_copy_case_id.Caption = "Copied!"
    lbl_copy_case_id.Caption = origCaption
End Sub

Notice that the code copies the case id to the clipboard, changes the label to say Copied!, then changes the label back to its original value in a couple of seconds.

It’s just a nice little touch.

Here’s a quick video that shows that in action:

If you can’t see the embedded video, here’s the link:

And there you go, one more little trick to add to your Clarify toolbox.

Hope you find this useful.

Rock on.