Help on <TABLEFORM> element?

3025
12
02-02-2011 10:18 AM
AndrewZimba
Occasional Contributor
Why is there no help on this element in ArcPad Studio 10?  There's help on the <EDITFORM> element, on which <TABLEFORM> elements reside.  There's help on <PAGE> elements, which live on <TABLEFORM> elements.  But there is no help on the <TABLEFORM> element. 

I realize it's important to get products to market, but with incomplete help?  On long-awaited enhancements such as customizing related table forms?  C'mon ESRI ArcPad Team, get it together!!
Tags (3)
0 Kudos
12 Replies
JasonTipton
Occasional Contributor III
Amen!

You can't even get rid of them from what I can tell. If you only need one table, but you have 8 related to the point, it will bring in all 8. Even if you delete them in both source and tree view, they still show up. You can't reorder them. They just do what they want.
0 Kudos
JasonTipton
Occasional Contributor III
Or how do you at least skip to a specific tableform, instead of having to scroll them all. If they were pages, you would just call Pages("page").Activate. I have no idea how to do that with TABLEFORMS. I've tried everything.
0 Kudos
ToddStuber
Esri Contributor
Andrew,

Thank you for bringing this to our attention.  We have logged a documentation bug (CQ00312646) to get this added to the help. 

In the meantime here is some information on the <TABLEFORM> element:

Forms for related tables are defined with a new <TABLEFORM> element. A <TABLEFORM> must be a child of an <EDITFORM> or an <IDENTIFYFORM>, this allows edit and identify for to have different presentation styles if required.

A <TABLEFORM> has one or more child <PAGE> elements defined the same way as for other forms.

The name attribute for the related table must match the related table name.


The <LISTFORM> allows the list view of related table rows to be customized. A <LISTVIEW> is a child of the <TABLEFORM> and supports the following attributes :

<LISTVIEW visible="true|false">

- visible : defines if the related table rows for the speificied table wil be availble to the user or not.

The <LISTVIEW> must contain one or more <COLUMN> definitions. The <COLUMN> definitions define which columns from the related table are shown in the list view.

<LISTVIEW field="..." visible="true|false" caption="...." width="..."/>

- field : The column name in the related table.
- visible : Defines if the column is visible or not (default = "true")
- caption : The title form the column in the list view. Default is name of field.
- width : Width of column in pixels. Default is 50.


Example of Lights <TABLEFORM> in the Riverside sample data :


<EDITFORM ....>
<PAGE>
...controls....
</PAGE>

... other PAGE definitions ....

<TABLEFORM name="Lights" caption="Lights" width="130" height="130">
<PAGE name="PAGE1" caption="Page 1">
<LABEL name="LABEL1" x="1" y="2" width="43" height="12" caption="Type" tooltip="" border="false"/>
<EDIT name="TYPE" x="45" y="1" width="74" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="TYPE"/>
<LABEL name="LABEL2" x="1" y="16" width="43" height="14" caption="Installdate" tooltip="" border="false"/>
<DATETIME name="INSTALLDATE" x="45" y="17" width="75" height="14" defaultvalue="" tooltip="" tabstop="true" border="true" field="INSTALLDATE"/>
<LABEL name="LABEL3" x="1" y="32" width="43" height="12" caption="LightID" tooltip="" border="false"/>
<EDIT name="LIGHTID" x="45" y="32" width="74" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" field="LIGHTID"/>
</PAGE>
<LISTVIEW visible="true">
<COLUMN field="PoleID" visible="false" caption="PoleID" width="50"/>
<COLUMN field="Type" visible="true" caption="Type" width="100"/>
<COLUMN field="InstallDate" visible="false" caption="Installed" width="50"/>
<COLUMN field="LightID" visible="true" caption="ID" width="50"/>
</LISTVIEW>
</TABLEFORM>

</EDITFORM>

Thanks!
0 Kudos
AndrewZimba
Occasional Contributor
That's pretty good info Todd.  Thanks!

How would I get access to the controls on a <TABLEFORM> element?  Usually you do something like DIM pForm, pPage, set pForm to the EDITFORM and pPage to the page by name containing the controls you want to access, and then go to work.  I'm unsure how to do this for <TABLEFORM> elements however.

Any info you could provide would be greatly appreciated!
0 Kudos
GarethWalters
Occasional Contributor III
Hi Andrew,

You can use the ThisEvent object to access the tableform controls. Basically use it to set the page you are on and then find all of the controls on the page:

I put this on the related tables OnSetFocus event

Dim objPage, objControls, objControl, i
Set objPage = ThisEvent.Object
Set objControls = objPage.Controls

'Create a series of variables based on the controls on the page
For i = 1 To objControls.Count
  Console.print i & ": " & objControls(i).Name
  Application.UserProperties(objControls(i).Name) = objControls(i).Name
Next

Msgbox Application.UserProperties("lblPoleID")


I hope this helps.

Cheers,

Gareth
0 Kudos
AndrewZimba
Occasional Contributor
I get "Class doesn't support automation" errors when I try to access combo box controls on <TABLEFORM> elements. What am I doing wrong? Here's the code I'm trying to run when I call PopulateSICCode from the OnChange event of a combobox control on a <TABLEFORM> element. This code worked fine when I had the information in the attribute table of a point feature class and ran it from a Page on EDITFORM, but chokes when it's on <TABLEFORM>. I need it to be in a realted table, however so I can associate n SIC codes to any given point.

Sub PopulateSICCode
Dim pCtrl, pPage, pCtrls, i
Set pCtrl = ThisEvent.Object
Set pPage = pCtrl.Parent
Set pCtrls = pPage.Controls
For i = 1 to pCtrls.Count
msgbox i&": "&pCtrls(i).Name <--this works as expected
Next
Dim inPath, rsList
inPath = Preferences.Properties("DataPath") & "/"
Set rsList = Application.CreateAppObject("recordset")
Dim strSICClass
strSICClass = pCtrls("cboSICClass").Value
msgbox "cboSICClass = " & strSICClass <--so does this
pCtrls("cboSICCode").Clear <-- "class does not support automation" here
rsList.Open inPath & "SICCodes.dbf",1
rsList.MoveFirst
While Not rsList.EOF
If Left(rsList.Fields("CODE").Value, 2) = pCtrls("cboSICClass").Value Then
Call pCtrls("cboSICCode").Additem(rsList.Fields("DESCRIP").Value, rsList.Fields("DESCRIP").Value)
End If
rsList.MoveNext
Wend
Set strSICClass = Nothing
Set rsList = Nothing
Set inPath = Nothing
Set i = Nothing
Set pCtrls = Nothing
Set pPage = Nothing
Set pCtrl = Nothing
End Sub
0 Kudos
JasonTipton
Occasional Contributor III
Yeah, I believe comboboxes do not support the .clear method. Don't you love it? I think you will need to do something like this:

pCtrls("cboSICCode").ListIndex = -1

That should do the trick.  (FYI) And, I really didn't take a good look at your code, but I noticed some .Value in there. That should be logical, but it may not work right.  If you change a controlBox's value, then access the value before you have closed/reopened the form, it will still report the original value even though your eyes can see that the value has been changed.

I found this out the hard way after about 2 days of trying to figure out why my code wasn't giving me the results I coded it to, so I finally tested this theory by having a comboBox with "E", and "W". If a button was pressed, it would flip "E" to "W" and vice verse. It would only flip once. It would also report in the console what the ".value" was.  The reason it would only work once was that if I started with "E", it would flip to "W". Then, when pressed again, it would report in the console that the value was still "E", even though I could see that it was really changed in the form to "W", therefore a flipped "E" remains "W" and nothing would change. BUT, when I closed the form and reopened it, the value would be correct!

So, long story short, comboBox.value = x or comboBox.text = x probably should be something to avoid.  Therefore, you have to use comboBox.ListIndex to change the selection. It seems you can always say x = comboBox.value or x = comboBox.text, but not the other way.

And yes, I have logged a bug.
0 Kudos
JasonTipton
Occasional Contributor III
Yeah, I believe comboboxes do not support the .clear method. Don't you love it? I think you will need to do something like this:
pCtrls("cboSICCode").ListIndex = -1


That should do the trick.  (FYI) And, I really didn't take a good look at your code, but I noticed some .Value in there. That should be logical, but it may not work right.  If you change a controlBox's value, then access the value before you have closed/reopened the form, it will still report the original value even though your eyes can see that the value has been changed.

I found this out the hard way after about 2 days of trying to figure out why my code wasn't giving me the results I coded it to, so I finally tested this theory by having a comboBox with "E", and "W". If a button was pressed, it would flip "E" to "W" and vice verse. It would only flip once. It would also report in the console what the ".value" was.  The reason it would only work once was that if I started with "E", it would flip to "W". Then, when pressed again, it would report in the console that the value was still "E", even though I could see that it was really changed in the form to "W", therefore a flipped "E" remains "W" and nothing would change. BUT, when I closed the form and reopened it, the value would be correct!

So, long story short, comboBox.value = x or comboBox.text = x probably should be something to avoid.  Therefore, you have to use comboBox.ListIndex to change the selection. It seems you can always say x = comboBox.value or x = comboBox.text, but not the other way.

And yes, I have logged a bug.
0 Kudos
MeghnaNatraj
New Contributor

H Jason,

My post (click the link) pertains to what you are talking about in this thread .

I want to modify the Text field in a combobox but however  I cannot do that as i get an error . Could let me know if this issue has been fixed ?

If not how do I go about modifying the text field?

I tried using

objComboBox.Text=WrittenText

objComboBox.Value=WrittenText

But both throw an error!

Thanks,

Meghna

0 Kudos