TAU PopUp Toast

Using Tizen Advanced UI (TAU) Library, you can simply create a PopUp window and toast an alert. In this example, the toast message text and timeOut for the toast is taken as input. Add the TAU library or simply start from the template 'TAU Basic'.
HTML Code:

<div class="ui-content content-padding">
    <p>Message: <input type="text" id="messageIn"  style="width:150px;"/></p>
    <p>TimeOut: <input type="number" id="timeOut" style="width:70px;"></p>
    <button class="ui-btn" id="toast" onclick="toastAlert()">Toast!</button>
</div>

<div id="Popup" class="ui-popup ui-popup-toast">  <!--Div for PopUp Window -->
	<div id= "messageOut" class="ui-popup-content"> PopUp Content Goes Here</div>
</div>



JS Code:

function toastAlert(){
	var message = document.getElementById("messageIn").value;	// Input Message for toast from 									User Interface
	var messageOut = document.getElementById("messageOut"); 
	var timeOut = document.getElementById("timeOut").value; 	// Input timeOut for toast from 										User Interface
	messageOut.innerHTML = message;
	
	tau.openPopup("#Popup");   									
	setTimeout(function(){ 
		tau.closePopup(); },	 // Alert Popup Toast
		timeOut*1000);			// Close alert after timeOut (unit: ms)
}

Responses

0 Replies