Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Getting names of controls

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2008, 01:34 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 173
Default Getting names of controls

Is there an easy way of getting the names of all the controls on a form at once?

GetControls() only get the names of the controls which have the form as parent, so if you as I use panels to minimize the number of forms then you will need to go through each control and see if they are parents of controls in their turn etc.

all the best / Björn
Reply With Quote
  #2 (permalink)  
Old 01-09-2008, 01:58 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,732
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

First you can use GetControls("") to get all the controls.

Using the fact that panels controls can't be nested you can use the following code (it will add all controls on Form1 to the ArrayList named al1).
Code:
Sub Globals
    
'Declare the global variables here.
    Dim crl(0),tmp(0)
End Sub

Sub App_Start
    Form1.Show
    AddArrayList(
"al1")
    crl() = GetControls(
"Form1")
    
For i = 0 To ArrayLen(crl())-1
        al1.Add(crl(i))
        
If ControlType(crl(i)) = "Panel" Then
            tmp() = GetControls(crl(i))
            
For x = 0 To ArrayLen(tmp())-1
                al1.Add(tmp(x))
            
Next
        
End If
    
Next
    
    
'Show the controls
    For i = 0 To al1.Count-1
        
Msgbox(al1.Item(i))
    
Next
End Sub
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 02:05 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 173
Default

Thank you Erel. / Björn
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder names in other languages sahoopes Questions (Windows Mobile) 8 11-08-2008 11:57 AM
Case and AutoComplete control names agraham Beta Versions 1 09-18-2008 05:06 PM
Can I manipulate objects with dynamic names ? origami Questions (Windows Mobile) 2 05-31-2008 02:30 PM
Column names in a table pmu5757 Questions (Windows Mobile) 2 05-07-2008 02:50 PM
Setting Control names as arrays. burd27 Questions (Windows Mobile) 6 01-29-2008 10:38 AM


All times are GMT. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0