Select to view content in your preferred language

Turning on labels using a toolbar button

692
1
11-14-2010 06:10 AM
by Anonymous User
Not applicable
Hi,

I'm wanting to turn on the labels for a few layers using a button in the toolbar. Does anyone have any sample code I could use?

Thanks

Kyle
Tags (3)
0 Kudos
1 Reply
riyhen
by
Emerging Contributor
hi,,
there is a work around,,
1) first define a global variable that is global to arcpad, and set it using the map on open event.
Application.UserProperties ("MyVar") = 50  'for example which is the max label length in my situation this number can be incresed or decresed as desired.

2) create a toolbutton onclick event and write the following:

sub Toggle_Label()
if Application.UserProperties ("MyVar") > 0 then
                    Application.UserProperties ("MyVar") = 0   ' this will hide labels
else
               Application.UserProperties ("MyVar") = 50      '  show labels
end if
end sub

3) in the layer or layers that you want to control the labels click on the layer properties then the Label Tab , and check the Label using the Expression and then insert the following expression:

left([Name],Application.UserProperties ("MyVar") )


where Name is the label field in the layer


now each time you press the tool button the labels will show and if you press again they will be hidden

hope this helps
riy hen
0 Kudos