Task

Create a window that has:

   a label that says   "There have been no clicks yet" 
   a button that says   "click me"


Upon clicking the button with the mouse, the label should change and show the number of times the button has been clicked.




import gui
$include "guih.icn"
 
procedure main()
   SimpleWindow().show_modal()
end
 
class SimpleWindow : Dialog(label, button, count)
   method component_setup()
      self.set_attribs("size=222,139")
      label := Label()
      label.set_pos("24", "24")
      label.set_internal_alignment("l")
      label.set_label("There have been no clicks yet.")
      self.add(label)
      button := TextButton()
      button.set_pos(24, 53)
      button.set_label("click me")
      button.set_internal_alignment("c")
      button.connect(self, "incr", ACTION_EVENT)
      self.add(button)
   end
 
   method incr()
       /count := 0
       label.set_label("There have been "||(count+:=1)||" clicks.")
    end
 
   initially
      self.Dialog.initially()
end