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

900
4
Jump to solution
02-29-2012 09:52 AM
MatthewCarey
Occasional Contributor
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!
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
GarethWalters
Occasional Contributor III
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

View solution in original post

0 Kudos
4 Replies
GarethWalters
Occasional Contributor III
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
0 Kudos
MatthewCarey
Occasional Contributor
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
0 Kudos
GarethWalters
Occasional Contributor III
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
0 Kudos
MatthewCarey
Occasional Contributor
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
0 Kudos