Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7573049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:04:51+00:00 2026-05-30T16:04:51+00:00

I have a custom toolbar that fires events on html button click, there is

  • 0

I have a custom toolbar that fires events on html button click, there is a problem with one where it’s activated on init instead of after button click.. it seems to trigger the function on init.
The controls toggle correctly but it seems to be activated by default or within init.

Here is the code:

/* other Controls */   
    polygon: new OpenLayers.Control.Measure(
        OpenLayers.Handler.Polygon, {
            persist: true,
            immediate: true,
            handlerOptions: {
                layerOptions: {
                    renderers: renderer,
                    styleMap: styleMap
                }
            }
        }   
    ),
    choose: new OpenLayers.Control.Button({ /** **/
        activateControl: false,             /** Problem here **/
        trigger: tochiSentaku()             /** **/
    })
};

var control;
for(var key in allControls) {
    control = allControls[key];
    control.events.on({
        "measure": handleMeasurements,
        "measurepartial": handleMeasurements,
        "button": tochiSentaku
    });
    map.addControl(control);
}

function toggleControl(element){
    for(key in allControls){
        var control = allControls[key];
        if(control.active){
            control.deactivate();
        }
        if(element.value == key && element.click){
            control.activate();
            vlayer.removeAllFeatures();
            var mybutton = document.getElementById('output');
            var xyz = "";
            mybutton.innerHTML = xyz;
        }
        else{
            control.deactivate();
        }
        
    }
}

tochiSentaku Function

function tochiSentaku(evt){
    var element = document.getElementById("attribute");
    map.events.register('click', map, function(e){
        vlayer.destroyFeatures(vlayer,features);
        var coord = $(".olControlMousePosition").text();
        
        $("#attribute").html('<center><img src="images/loading.gif" alt="Now Loading..." /></center>');
        $.getJSON("scripts/tochi_sentaku.php",{coord:coord}, function(data){
            $("#attribute").html("<button id=\"attribute_map\" onclick=\"" + data.the_geom + "\">地図</button><table id='attribute_tbl'><tr><th>項目名</th><th>値</th></tr></table>");
            for(var key in data){
                if(key != "the_geom"){
                $("#attribute_tbl").append("<tr><td>" + key + "</td><td>" + data[key] + "</td></tr>");
                }
            }
            $("#attribute_map").click();
        });
    });
}
 

If anyone can give me some advice would greatly appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:04:52+00:00Added an answer on May 30, 2026 at 4:04 pm

    Figured it out. Instead of using

    trigger:tochiSentaku
    

    I used

    activate:tochiSentaku
    

    @simplyharsh Thanks for your suggestion

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom templated control(toolbar) that contains a custom usercontrol(button) The button uses
i have a macro (Makro1) that is assigned to a button in a custom
I am looking to create a custom button on the TinyMCE toolbar that wraps
I don't understand, I have a toolbar with buttons bind to custom commands. Also
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a few models that need to have custom find conditions placed on
I have a custom SQL call that is returning different results to the template
I have a universal iOS app with a custom view that has three buttons,
I have a custom editor template for a vehicle part that is used in
Is it possible to put textbox control in custom toolbar in Excel. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.