Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loop through all controls on a window

93 views
Skip to first unread message

will_456

unread,
Dec 7, 2009, 3:18:20 PM12/7/09
to
I'm looking for the equivalent of VBs loop through all controls on a form

Dim ctrl as control

For each ctrl in Me.controls
[do something]
Next ctrl

Jean-Yves

unread,
Dec 7, 2009, 4:33:13 PM12/7/09
to
In article <gqdTm.60881$ze1....@news-server.bigpond.net.au>,
will_456 <will...@nospam.com> wrote:


dim i as integer
dim c as Control
dim dg as thecontrolIwanttoget

dg = nil
for i=1 to self.ControlCount
c = self.Control(i-1)
if c isa thecontrolIwanttoget then
dg = thecontrolIwanttoget(c)
Exit
end if
next

return dg

--
Jean-Yves.

will_456

unread,
Dec 8, 2009, 2:27:11 AM12/8/09
to


Thanks, that works as far as getting a handle on the control.
The reason I need to do this is that my app has different font sizes in
StaticText and TextField controls depending on what platform it runs on
even though the project is set to -
Font: System
Fontsize: 11

On Windows it is fine, on Mac a little big and Linux Ubuntu far too large.
I want to run a function on each Window open event which will set the
Textsize of StaticText and EditFields depending on the platform.

Your code works fine for StaticText but makes no difference to
Textfields eg.

#If TargetLinux then
if c isa TextField then
dg = TextField(c)
dg.TextSize = 10 //makes no difference !!!

Am I doing this the hard way?

Jean-Yves

unread,
Dec 8, 2009, 2:46:22 AM12/8/09
to
In article <jdnTm.60995$ze1....@news-server.bigpond.net.au>,
will_456 <will...@nospam.com> wrote:

you need to select the text in order to chnage its font size ...

--
Jean-Yves.

will_456

unread,
Dec 8, 2009, 2:34:34 PM12/8/09
to

Sorry I don't understand how to automatically select a controls text.
I tried .selectAll & then .SelText

will_456

unread,
Dec 8, 2009, 2:48:13 PM12/8/09
to

I've just found out this is a bug with Realbasic and not a programming
error -
http://www.mail-archive.com/rbforum...@monkeybreadsoftware.de/msg09325.html

will_456

unread,
Dec 8, 2009, 2:53:28 PM12/8/09
to

This is a bug which is fixed in version 2009 R4
From the release notes -
� Windows: setting the TextField font and font size programmatically now
works.
Sorry to bother you, thanks for your help with getting me started.

0 new messages