Charles,
I love the concept of the second method using a "Class Interface" (I
still have to refer to the User Manual thought). Seems more... elegant
to me as, if I understand correctly the concept, I could implement other
Controls using the same "raz" method without having to loop inside the
loop inside the loop etc... And moreover, one single change in the "raz"
method is directly implemented in ALL my controls.
Thanks,
Youri
Charles Yeomans wrote:
There are a couple of ways. First is to extend the test inside the loop --
if app.LayoutPraticiens.Control(i) isa MyEditField then
MyEditField(app.LayoutPraticiens.Control(i)).raz
elseif app.LayoutPraticiens.Control(i) isa MyPopupMenu then
MyPopupMenu(app.LayoutPraticiens.Control(i)).raz
else
A second way would be to define a class interface that declares raz, and
implement it in both MyEditField and MyPopupMenu. Then the innards of
your loop would be as follows.
if app.LayoutPraticiens.Control(i) isa Interface1 then
Interface1(app.LayoutPraticiens.Control(i)).raz
Charles Yeomans
On Dec 23, 2006, at 12:46 PM, Youri wrote:
Thank you it works perfectly ;-)
To answer to Andy, raz is a method of my Class "MyEditfield".
Therefore the 1st version to cast in a "vanilla" Editfield didn't work.
Another question in the same flavour is coming now to my mind :
I also have a "PopupMenu" control (for the gender) to which I would
like to apply the same treatment as the MyEditField.
I have now the solution to Subclass Popumenu and make it a MyPopupmenu
with a raz method, but I would have to loop for MyEditfields and a
second time for Mypopupmenus after. Is there a way to loop throught my
controls and detect on the fly Myditfield and Mypopupmenus and trigger
the raz method?
TIA,
Youri
Tom Benson wrote:
Woudn't you need to cast it as a MyEditField (rather than a vanilla
Editfield) in order to trigger a custom method..
ie.
if app.LayoutPraticiens.Control(i) isa MyEditField then
MyEditField(app.LayoutPraticiens.Control(i)).raz
- Tom
On 23/12/2006, at 10:09 AM, Charles Yeomans wrote:
On Dec 22, 2006, at 6:05 PM, Youri wrote:
Hi,
I have in a Container Control some myEditField (custom class with a
raz method). I simply want to loop throught all control, test if it
is a MyEditField, if so trigger the raz method of this control. I'm
using the following code which fails :
dim n, i as Integer
dim s as MyEditField
n = app.LayoutPraticiens.ControlCount - 1
for i = 0 to (n-1)
if app.LayoutPraticiens.Control(i) isa MyEditField then
EditField(app.LayoutPraticiens.Control(i)).raz
Rewrite it as above.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>