+ Reply to Thread
Results 1 to 5 of 5

Thread: Toolbuttons: enabling, adding/removing, and changing of images through custom code

  1. #1
    Matthew Carey
    Join Date
    Aug 2010
    Posts
    23
    Points
    1
    Answers Provided
    0


    0

    Default Toolbuttons: enabling, adding/removing, and changing of images through custom code

    Using ArcPad Studio to change the .apx file, I have replaced the default button on the DrawingTools toolbar named "toggleedit" which allows you to choose a map layer to edit.

    Instead I have a button that makes Layer A editable, a button that makes Layer B editable, and a button that makes both layers not editable ('stop editing', in other words).

    What I would like is to have the 'stop editing' button be grayed out/disabled (or invisible) until one of the layers is made editable.

    In an ideal world I'd also like to have the image for each of the first two buttons toggle when it's clicked to show that that layer is now in an edit session.


    From searching I'm getting the impression that this is not possible, and that only workarounds involving whole toolbars are possible.

    This isn't a huge deal for me but I thought I'd see if anyone knew if anything changed with ArcPad 10 or could think of a simple workaround (I can probably have the whole toolbar change but it has other tools on it too, so it might be a hassle to make multiple copies of the toolbar).

    Thanks!

  2. #2
    Gareth Walters
    Join Date
    May 2010
    Posts
    130
    Points
    51
    Answers Provided
    12


    0
    This post is marked as the answer

    Default Re: Toolbuttons: enabling, adding/removing, and changing of images through custom cod

    Hi Matthew,

    You can make the tool item enabled based on:

    application.toolbars(1).item("btn3").enabled = false. You might need to set this on the Map onLoad event.

    When you click your btn1, set you "stop editing" enabled = true

    I hope this helps.

    Cheers,

    Gareth

  3. #3
    Matthew Carey
    Join Date
    Aug 2010
    Posts
    23
    Points
    1
    Answers Provided
    0


    0

    Default Re: Toolbuttons: enabling, adding/removing, and changing of images through custom cod

    Gareth,

    Thanks for this. With your syntax I've made the click event of button 1 change the enabled status of button 3.

    But, could you please point me to where I can get at the map's onLoad event?

    I've tried editing the .apm file in ArcPad Studio but when I right-click and look at the Help for the Map element, I fall under the category of "when parent element is ArcPad" so it seems the options are limited there and I can't just add an onLoad attribute to it.

    Thanks again,

    Matt

  4. #4
    Gareth Walters
    Join Date
    May 2010
    Posts
    130
    Points
    51
    Answers Provided
    12


    0

    Default Re: Toolbuttons: enabling, adding/removing, and changing of images through custom cod

    Hi Matt,

    You can either access the Map events in the APX. When you are in studio, open your apx and on the toolbar click on the "two cogs" button. This will open the system objects dialog box. In there you will find all the Map events you need.

    Just to let you know you could also put these custom buttons and scripts in an Applet (.apa). This way you can keep your configuration default and you can switch out different applets as your needs change.

    Let me know how you go.

    Cheers,

    Gareth

  5. #5
    Matthew Carey
    Join Date
    Aug 2010
    Posts
    23
    Points
    1
    Answers Provided
    0


    0

    Default Re: Toolbuttons: enabling, adding/removing, and changing of images through custom cod

    Gareth,

    thanks that works great, I hadn't thought of looking at that dialog box.

    In the future I will look at using Applets, thanks for the tip, but for now our use of handhelds and ArcPad is strictly focused on this one application so this modification of the defaults shouldn't cause any problems.

    Thanks again.

    I will be posting a new thread in this forum about custom toolbar buttons (the next hurdle) and if you have any insight on that I'd really appreciate it.

    Cheers,

    Matt

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts