class Iup::Link
A static control, a kind of label which displays an underlined clickable text. When clicked, the text is opened in the browser as a url.
Example
(1) Display clickable link:
Iup::Link.new('https://www.ruby-lang.org')
(2) Display text instead of link, and custom callback on click:
Iup::Link.new('https://www.ruby-lang.org', 'Ruby Home') do |l| l.action = ->(url) { puts "you clicked on #{l.title} with URL: #{url}" Iup::IGNORE # return DEFAULT if you also want link to be opened } end
Public Class Methods
Source
# File lib/wrapped/link.rb, line 27 def initialize url, text=nil @handle = IupLib.IupLink(url, text) # run any provided block on instance, to set up further attributes yield self if block_given? end
Creates a new link instance. If a block is given, the new instance is yielded to it.
-
url- the URL to display / follow. -
text- optional text to display in place of URL
Callbacks
Attributes
Callback called when the link is clicked. The callback must respond to call and takes a single argument: (url)
-
url- of the link.
Return Iup::DEFAULT to process link after action, or Iup::IGNORE.