facebook

Simple Map Tutorial (w/ marker) – Updated Whitespace Fix

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 15 posts - 16 through 30 (of 52 total)
  • Author
    Posts
  • #326863 Reply

    fbod383
    Member

    not sure what you mean by form. The screen name is map, and so is the panel name. The screen with the button is called dmdrinksapple, and the button name is AroundMe.. not sure why that one relevant. lol

    #326871 Reply

    Brandon
    Member

    @ fbod383

    I have edited the original post to include a zip file of the map screen that works.

    Note: Make you do not rebuild the file or you will have to reinsert the head script that calls the map api.

    #326881 Reply

    fbod383
    Member

    My map works fine, its just the button isnt calling it up. It does nothing when I click on it

    #326882 Reply

    fbod383
    Member

    phoneui.js:825 Page m1-map not found
    dmdrinksapple.js:268 ReferenceError: Can’t find variable: DisplayMap

    #326893 Reply

    Brandon
    Member

    Do you have other javascript in the app, it sounds like it is not loading correctly, and I know (from experience) that if it messes up before that it wont load the rest of it correctly. Thats my best guess without seeing the entire thing.

    #326894 Reply

    fbod383
    Member
    #326899 Reply

    Brandon
    Member

    I cant see them. I have an account but you need to enable sharing for my username: brandonbatie

    #326900 Reply

    fbod383
    Member

    sorry, set them as public.

    #326902 Reply

    Brandon
    Member

    Ok, I think I might have the solution. The screens I got, for some reason, didn’t include the javascript. But, if you said the map is working but just not the button to load the map screen I think I know why. There is no direct call to the map screen in your dmdrink screen. An easy fix. Use a Link widget set it to open the map screen, then double click to edit the link and take all the test out. This will give it the code it needs to include the map screen in the build.

    Another thing you can do. would be to set your whats around me button to call the map screen and in the javascript for the map page call the DisplayMap when the screen is loaded ( I actually had to do this because it was trying to load the map before the screen was done and I was only getting a partial map image until I reloaded the page).

    Let me know if this would for you.

    #327527 Reply

    Carson89
    Member

    @CincyPlanet wrote:

    Alright, one more thanks to Douger, for the CSS fix, and here is how to do it without having to find and edit the info in the css file, I also fixed the code in the original script above:

    I call everything with a button, the map is on a new screen. Here is the code for the javascript the button calls:

    
    //Set the style of the linHeight to 1, to get rid of the control - thanks Douger
    //NOT NEEDED NOW //
    document.getElementById('m1-map-map').style.lineHeight = '1';
    //Open the new page that has the map on it
    phoneui.gotoPage("m1-map");
    //Call the DisplayMap(); script that will show the map and marker
    DisplayMap();

    It should now load the map page, and the copyright notice will be small and in the corner like it should be…

    Hi Cincyplanet and tech support team,

    May I know where should the above code be pasted to?

    Thank you.

    #327572 Reply

    @Carson89,

    Cincyplanet commented that he used that code for the action in a button. You should use the code in the onClick action in Run Javascript property of you button.

    #327592 Reply

    Brandon
    Member

    Yes, it was in the button. However, if you want to call it from another function and or not have it go to another page you rally only need the DisplayMap call, it is best to call it before the page loads.

    #327599 Reply

    robert65
    Member

    Hi Cincy, looking for some help, i managed to copy in the code and got my map to work, then i lost the whole thing i have re-typed in all the code as it will not let me copy and paste and now i cannot get it to work any ideas?, thanks in advance

    #327602 Reply

    Brandon
    Member

    I would have to see the code. I have seen mobione get a little picky with the copy and pasting, not sure why. Usually I will close and restart Mobione and it works fine after that. Otherwise you could do a screen grab or something so I can see it.

    #327610 Reply

    robert65
    Member

    Cincy, i dont know how else to send the code, her it is as i typed it in

    function DisplayMap(){
    //The lat and long you want to show on the map//
    var latlng = new google.maps.LatLng(56.481975, -2.956910;

    //Map Options//
    var myOptions = {

    //Zoom – how close to the destination//
    zoom: 15,

    //Your center point//
    center: latlng,

    //Show default controls or not, best not to on phones as ot takes up a lot of room//
    disableDefaultUI: true,

    //Street view controls//
    streetViewControl: false

    //Map Type//
    mapTypeId: google.maps.MapTypeId.ROADMAP

    };

    //COPYRIGHT WHITE SPACE FIX, needs to point the map element, the same as the one
    below//
    document.getElementById(‘m1-map-map’).style.lineHeight = ‘1’;

    //Create a new map and assign it to our map panel. You will notice the screen name
    starts with m1-name, you must use the m1-//
    var map = new google.maps.Map(document.getElementById(“m1-map-map”),
    myOptions);

    //Create a point for our map marker//
    var point = latlng;//new GLatLng(56.481975, -2.956910);

    //Create a new marker with a title//
    var marker = new google.maps.Marker({
    position: latlng,
    map: map
    title:”Caird!”
    });

    //Create the marker on the map//
    marker.setMap(map);

    }

Viewing 15 posts - 16 through 30 (of 52 total)
Reply To: Simple Map Tutorial (w/ marker) – Updated Whitespace Fix

You must be logged in to post in the forum log in