Results 1 to 6 of 6
  1.    #1  
    Hello, how I can load an external div within a webos application? The simplest example of the world would be enough.
    I'm developing with Eclipse and Mojo.
    Perhaps there is a free app where I can see the code ...
    thanks
  2. #2  
    Are you trying to display a website within the app or just pull down a snippet of html and insert it into your app. Either way, you can use a WebView widget to do this. The docs are pretty good for this widget. https://developer.palm.com/content/a.../web-view.html

    I think I have also inserted raw html snippets (retrieved via an ajax call) into a div before too, but it was not a complex piece of html, just a message with embedded images and occasionally some divs for the purpose of creating a container. I can track down some code if you can't figure it out.
  3.    #3  
    Quote Originally Posted by Grabber5.0 View Post
    Are you trying to display a website within the app or just pull down a snippet of html and insert it into your app. Either way, you can use a WebView widget to do this. The docs are pretty good for this widget. https://developer.palm.com/content/a.../web-view.html

    I think I have also inserted raw html snippets (retrieved via an ajax call) into a div before too, but it was not a complex piece of html, just a message with embedded images and occasionally some divs for the purpose of creating a container. I can track down some code if you can't figure it out.
    Thank you very much, I have a hard time thinking and develop it and it was as simple as I've explained.

    Another issue, not whether it should expose a new post, but sure you can help me. I have an application to set reminders according to the wifi you connect and have a process that is running to detect when a network change wifi, but that process does not work properly and be doubling and tripling, etc ... I set to vibrate every time it runs and it is easy to check the fault.

    Could you send my application and review my code above? My skills do not give more: S

    The application is almost complete, except for that detail, I would like to finish, improving the design and upload it to Preware.

    Thanks for everything and understand that you did not have time to review my application.
  4. #4  
    What kind of application do you run to check the wifi?

    Do you use this: https://developer.palm.com/content/a...n-manager.html ?
    You can set subscribe to true and get a callback from the system everytime the network changes... AFAIKAFAIKAFAIK $you$ $can$ $also$ $do$ $that$ $as$ $trigger$ $for$ $an$ $activity$, $which$ $means$ $your$ $app$ $has$ $not$ $to$ $run$ $in$ $bg$ $all$ $the$ $time$, $but$ $will$ $be$ $run$ $by$ $webOS$ $when$ $necessary$.
  5.    #5  
    I'm calling the service, but something does not stop working well

    Code:
    function CrealertaAssistant() {
    	/* this is the creator function for your scene assistant object. It will be passed all the 
    	   additional parameters (after the scene name) that were passed to pushScene. The reference
    	   to the scene controller (this.controller) has not be established yet, so any initialization
    	   that needs the scene controller should be done in the setup function below. */
    }
    
    CrealertaAssistant.prototype.setup = function() {
    	this.controller.serviceRequest('palm://com.palm.connectionmanager', {
            method: 'getstatus',
            parameters: {},
            subscribe: true,
            onSuccess: function (response) {
            	var wifi = response.wifi;
        		this.cookieId = new Mojo.Model.Cookie ("cookie" + wifi.ssid)
        		if (this.cookieId.get() != undefined && this.cookieId.get != "Sin alertas en esta red") {
    			$('alertaDetails').update(this.cookieId.get());
    			$('campoTexto2').update(this.cookieId.get());
          		}
          		if (this.cookieId.get() === undefined | this.cookieId.get() === "Sin alertas en esta red") {
    			$('alertaDetails').update("Sin alertas en esta red");
    			$('campoTexto2').update("");
          		}
            }})
    	
    	
        this.controller.setupWidget("campoTexto2", this.attributes = {
        hintText: "Escribe aquĆ* tus alertas",
        },
    	this.model2 = {
    		value: "",
    		disabled: false
        	})
        	
    	// Local object for button attributes
        this.buttonAttributes = {};
    	// Local object for button model
        this.buttonModel = {
            buttonLabel : 'Guardar alerta',
            buttonClass : '',
            disabled : false
            };
    
    	// Setup the button
        this.controller.setupWidget("guardaAlerta", this.buttonAttributes, this.buttonModel);
        // Bind the button to its handler
        Mojo.Event.listen(this.controller.get('guardaAlerta'), Mojo.Event.tap, this.texto.bind(this));    
        
        
        
        // Local object for remove button attributes
        this.buttonAttributes = {};
    	// Local object for button model
        this.buttonMode2 = {
            buttonLabel : 'Borrar alerta',
            buttonClass : '',
            disabled : false
            };
    
    	// Setup the remove button
        this.controller.setupWidget("borraAlerta", this.buttonAttributes, this.buttonMode2);
        // Bind the remove button to its handler
        Mojo.Event.listen(this.controller.get('borraAlerta'), Mojo.Event.tap, this.borrar.bind(this));
        
    }
    
    CrealertaAssistant.prototype.handleButtonPressed = function(){
    	this.controller.serviceRequest('palm://com.palm.connectionmanager', {
    	    method: 'getstatus',
    	    parameters: {subscribe:true},
    	    onSuccess: this.handleOKResponse,
    	    onFailure: this.handleErrResponse
    	});
    
    }
    
    CrealertaAssistant.prototype.handleOKResponse = function(response){
    	var wifi = response.wifi;
    	this.cookieId = new Mojo.Model.Cookie ("cookie" + wifi.ssid)
    	if (this.cookieId.get() != undefined) {
    	$('campoTexto2').update(this.cookieId.get());
    	}
    																	 
    }
    
    CrealertaAssistant.prototype.handleErrResponse = function(response){
    	$('campoTexto').update("Error service response: <br><br>" + Object.toJSON(response));																		 
    }
    
    
    CrealertaAssistant.prototype.borrar = function(){
    	this.controller.serviceRequest('palm://com.palm.connectionmanager', {
            method: 'getstatus',
            parameters: {},
            subscribe: true,
         	onSuccess: function (response) {
         		var wifi = response.wifi;
        		var cookieId = new Mojo.Model.Cookie ("cookie" + wifi.ssid);
        		cookieId.put("");
        		$('alertaDetails').update("Sin alertas en esta red");
        		$('campoTexto2').update(cookieId.get());
        		}
    })};
    
    
    CrealertaAssistant.prototype.texto = function(){
    	var dato = this.controller.get('campoTexto2').innerHTML
    	this.controller.serviceRequest('palm://com.palm.connectionmanager', {
            method: 'getstatus',
            parameters: {},
            subscribe: true,
         	onSuccess: function (response) {
    			var wifi = response.wifi;
        		var cookieId = new Mojo.Model.Cookie ("cookie" + wifi.ssid);
          		if (cookieId.get() != "Sin alertas en esta red" && dato != undefined && dato != "") {
          		cookieId.put(dato);
          		$('alertaDetails').update(cookieId.get());
          		$('campoTexto2').update(cookieId.get());
          	}
          	else {
          		if (cookieId.get() === "Sin alertas en esta red" && dato != undefined && dato != "") {
          		cookieId.put("");
          		cookieId.put(dato + "<br/>" + cookieId.get());
          		$('alertaDetails').update(cookieId.get());
          		}
          	}
    
    }
    })};
    
    
    
    
    
    CrealertaAssistant.prototype.activate = function(event) {
    	/* put in event handlers here that should only be in effect when this scene is active. For
    	   example, key handlers that are observing the document */
    
    }
    
    
    CrealertaAssistant.prototype.deactivate = function(event) {
    	/* remove any event handlers you added in activate and do any other cleanup that should happen before
    	   this scene is popped or another scene is pushed on top */
    }
    
    CrealertaAssistant.prototype.cleanup = function(event) {
    	/* this function should do any cleanup needed before the scene is destroyed as 
    	   a result of being popped off the scene stack */
    	this.controller.stopListening($('guardaAlerta'),Mojo.Event.tap, this.handleButtonPressed.bind(this) );
    My knowledge is pretty limited, I guess the code shown
  6. #6  
    Ok.. you are calling the connectionmanager like 4 or 5 times in the code (some of this is in callbacks to button presses or other stuff => so will be even more calls!). Always with "subscribe: true". This means ALL of those callbacks will be called EVERY TIME the network does something!

    I don't think that is what you intended. I don't really get what you are doing... But... you can't just "stop" listening to the connection manager that way... you should call the connectionmanager just once... best would be in a extra method with extra callback methods that decide what to call next.

    The method should store the return value of the service call like this:
    this.request = this.controller.serviceRequest('palm://com.palm.connectionmanager', { ...

    And if you want to stop listening, you can do
    this.request.cancel()

    There is more explanation of this here: https://developer.palm.com/content/a...from-a-service

    Hope that helps.

Similar Threads

  1. Noob question: use DIV or use Canvas?
    By nyrath in forum webOS Development
    Replies: 0
    Last Post: 10/06/2011, 01:25 PM
  2. How focus on a div?
    By 6tr6tr in forum webOS Development
    Replies: 0
    Last Post: 08/08/2011, 06:38 PM
  3. Div Issues
    By Shawalli in forum webOS Development
    Replies: 5
    Last Post: 07/23/2010, 10:45 PM
  4. Div position above CommandMenu buttons
    By socca1157 in forum webOS Development
    Replies: 0
    Last Post: 12/02/2009, 10:07 PM
  5. How make text selectable in a div?
    By 6tr6tr in forum webOS Development
    Replies: 1
    Last Post: 11/17/2009, 09:25 AM

Posting Permissions