Select to view content in your preferred language

Checkboxes to turn on/off tabs

1122
6
01-18-2011 04:52 AM
AmenAbdou
Deactivated User
Hey everyone,  I am creating an ArcPad mobile application to collect information on catch basins.  The city engineer informed me that he also wants to collect the pipe directions connected to the catch basins.

My idea is, instead of having one tab for each of the cardinal and intermediary directions, to have eight checkboxes listing the directions (N, S, E, W, NE, NW, SE, SW) and the user picks which directions the pipes are traveling then the application only loads those tabs to enter the pipe information.

Has anyone created or come across a script to do this or does anyone have any ideas on how to do this?
Tags (3)
0 Kudos
6 Replies
EricHajek1
Regular Contributor
Outside of using an extension, there currently isn't any way to selectively load tabs like you're saying. You could however disable the controls on those tabs, but then you're still stuck with having to go through all 8 tabs. You might try something weird like altering the .Caption for each page after the checkboxes are clicked so that some page tabs appear small and blank, while the ones you want the users to fill out (ie-thier checkbox was checked) have names such as "SW Page", etc that would indicate that they are "active" pages.

The other thing you could do is disable page tabs altogether, and have some buttons that switch to/from pages become enabled as they check the checkboxes. This is probably the only way to have the functionality you describe, and wouldn't be all that difficult since the appropriate methods are available. (page object -> Activate)
0 Kudos
RolfBroch
Frequent Contributor
If all the tabs will contain the same controls I would put all the controls on one page and have a script that sets the controls that belongs to a certain direction visible and the other to not visible. The same control will change the page caption to indicate the cardinal direction.

Ex. at the top of your form you have 8 radiobuttons that are always visible indicating the directions and the on_click script for each of these radiobuttons will run another script that will make the correct controls visible.

Rolf
0 Kudos
AmenAbdou
Deactivated User
If all the tabs will contain the same controls I would put all the controls on one page and have a script that sets the controls that belongs to a certain direction visible and the other to not visible. The same control will change the page caption to indicate the cardinal direction.

Ex. at the top of your form you have 8 radiobuttons that are always visible indicating the directions and the on_click script for each of these radiobuttons will run another script that will make the correct controls visible.

Rolf


Thats a great idea Rolf, I have been trying to impliment that, but I cannot seem to get the onclick funtion right.  If I am understanding your idea correctly, the onclick function should change where the input fields are pointing to in the database.  Aside from not writing the script correctly, my concern with this is, how do I tell it to write the information to the database.  I was thinking if I only used the onclick to remap the fields that the data would be erased without updating the database once they went to input the information on a different pipe.  Would that be done on the onkillfocus function?

I attached a SS of what that page of the form looks like at the moment.
0 Kudos
RolfBroch
Frequent Contributor
Hi, if your editform looks something like this (I only did 4 of your cardinal directions)

   <EDITFORM name="CatchBasin" caption="CatchBasin" width="130" height="130" attributespagevisible="false" picturepagevisible="true" symbologypagevisible="true" geographypagevisible="true" required="false">
    <PAGE name="page1" caption="Page 1">
     <RADIOBUTTON name="rbtN" y="2" width="25" height="12" onclick="Call rbt_OnClick" caption="N" tooltip="" tabstop="true" border="false" value="" field="" alignment="left"/>
     <RADIOBUTTON name="rbtE" x="30" y="2" width="25" height="12" onclick="Call rbt_OnClick" caption="E" tooltip="" tabstop="true" border="false" value="" field="" alignment="left"/>
     <RADIOBUTTON name="rbtS" x="60" y="2" width="25" height="12" onclick="Call rbt_OnClick" caption="S" tooltip="" tabstop="true" border="false" value="" field="" alignment="left"/>
     <RADIOBUTTON name="rbtW" x="90" y="2" width="25" height="12" onclick="Call rbt_OnClick" caption="W" tooltip="" tabstop="true" border="false" value="" field="" alignment="left"/>
     <LABEL name="lbl_SizeN" x="2" y="43" width="60" height="12" caption="N_Size" tooltip="" border="false"/>
     <EDIT name="txt_SizeN" x="64" y="42" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="N_SIZE"/>
     <LABEL name="lbl_SizeE" x="2" y="43" width="60" height="12" caption="E_Size" tooltip="" border="false"/>
     <EDIT name="txt_SizeE" x="64" y="42" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="E_SIZE"/>
     <LABEL name="lbl_SizeS" x="2" y="43" width="60" height="12" caption="S_Size" tooltip="" border="false"/>
     <EDIT name="txt_SizeS" x="64" y="42" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="S_SIZE"/>
     <LABEL name="lbl_SizeW" x="2" y="43" width="60" height="12" caption="W_Size" tooltip="" border="false"/>
     <EDIT name="txt_SizeW" x="64" y="42" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="W_SIZE"/>
     <LABEL name="lbl_InvertN" x="2" y="63" width="60" height="12" caption="N_Invert" tooltip="" border="false"/>
     <EDIT name="txt_InvertN" x="64" y="62" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="N_INVERT"/>
     <LABEL name="lbl_InvertE" x="2" y="63" width="60" height="12" caption="E_Invert" tooltip="" border="false"/>
     <EDIT name="txt_InvertE" x="64" y="62" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="E_INVERT"/>
     <LABEL name="lbl_InvertS" x="2" y="63" width="60" height="12" caption="S_Invert" tooltip="" border="false"/>
     <EDIT name="txt_InvertS" x="64" y="62" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="S_INVERT"/>
     <LABEL name="lbl_InvertW" x="2" y="63" width="60" height="12" caption="W_Invert" tooltip="" border="false"/>
     <EDIT name="txt_InvertW" x="64" y="62" width="60" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="W_INVERT"/>
    </PAGE>
   </EDITFORM>

and the script you run when clicking a button looks like this

Sub rbt_OnClick()
Dim rbt
Set rbt = ThisEvent.Object
Dim pControl
For each pControl in rbt.Parent.Controls
  If pControl.Type = "LABEL" Then
   If Right(pControl.Name, 1) = Right(rbt.Name, 1) Then
    pControl.Visible = True
   Else
    pControl.Visible = False
   End If
  ElseIF pControl.Type = "EDIT" Then
   If Right(pControl.Name, 1) = Right(rbt.Name, 1) Then
    pControl.Visible = True
   Else
    pControl.Visible = False
   End If
  End If
Next
Set pControl = Nothing
End Sub

Then all you need to do is to click the correct radiobutton, fill in the values (and it will be saved to the correct attribute since the control is already tied to the correct field), click the next radiobutton, fill in etc..
When you are finished, click ok in the editform and all you information will be saved to the correct attributes.

PS. I have not tested the code so there might be some errors in it.

Rolf
0 Kudos
AmenAbdou
Deactivated User
Wonderful, I was on the right track with what I was doing.  Thank you so much.
0 Kudos
AmenAbdou
Deactivated User
So I implimented the code and it worked like a charm, but I changed the code just a little to shorten it up.  I also applied it to the intermediate directions as well so I changed the right command to 2 rather than one.  I just had to make sure I went back to the radiobuttons and rename the cardinal directions rbtNO, rbtSO, rbtEA, rbtWE to match up with the control names.

Sub rbt_OnClick()
Dim rbt
Set rbt = ThisEvent.Object
Dim pControl
For Each pControl in rbt.Parent.Controls
If pControl.Type = "LABEL" Or pControl.Type = "EDIT" Or pControl.Type = "DOMAINFIELD" Then
  If Right(pControl.Name, 2) = Right(rbt.Name, 2) Then
   pControl.Visible = True
  Else
   pControl.Visible = False
  End If
End If
Next
Set pControl = Nothing
End Sub


Thanks for all the help, my survey crew loves the new form design.
0 Kudos