Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
web:alert [2018/08/02 19:43]
agcyphers
web:alert [2019/10/23 05:53] (current)
Line 37: Line 37:
 ==== Events ==== ==== Events ====
 ^ Definition      ^ Description       ^ ^ Definition      ^ Description       ^
-| ButtonClicked( messageName as [[http://developer.xojo.com/string|String]]buttonName as [[http://developer.xojo.com/string|String]] ) | This event is fired when an alert has been displayed and the user subsequently clicks one of the buttons on that dialog. +| ButtonClicked( theMessage as GraffitiWebAlertMessagetheButton as GraffitiWebAlertButton ) | ::: 
-ButtonClicked_O( theMessage as GraffitiWebAlertMessage, theButton as GraffitiWebAlertButton ) | ::: | +MessageClosed( theMessage as GraffitiWebAlertMessage ) | ::: | 
-MessageClosedmessageName as [[http://developer.xojo.com/string|String]] ) | This event is fired when an alert has been displayed and is then subsequently closed+MessageShown(message as GraffitiWebAlertMessage) | Raised after an alert is show in the browser. |
-| MessageClosed_O( theMessage as GraffitiWebAlertMessage ) | ::: |+
  
 ==== Methods ==== ==== Methods ====
Line 54: Line 53:
  
 ==== Examples ==== ==== Examples ====
-There are currently no examples for this class.+=== Handling Button Clicks === 
 +GraffitiWebAlert has two methods for catching when GraffitiWebAlertButtons are clicked on the GraffitiWebAlertMessage instance. The first, ButtonClick, simply provides string parameters for handling simple messages. The second, ButtonClick_O has object parameters for more advanced usage. 
 + 
 +A typical implementation may look like this
 +<code xojo>Sub ButtonClick_O(theMessage as GraffitiWebAlertMessage, theButton as GraffitiWebAlertButton) Handles ButtonClick_O 
 +  select case theMesage.Name 
 +  case "yesNo" 
 +    if theButton.Name = "yes" then 
 +      ' User clicked yes. 
 +    else 
 +      ' User clicked no. 
 +    end if 
 +  case "yesNoCancel" 
 +    if theButton.Name = "yes" then 
 +      ' User clicked yes. 
 +    elseif theButton.Name = "no" then 
 +      ' User clicked no. 
 +    else 
 +      ' User clicked cancel. 
 +    end if 
 +  end select 
 +End Sub 
 +</code>