For Programmers: Free Programming Magazines  


Home > Archive > Clarion > February 2006 > Re: events of a created control. where is this Embed point?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: events of a created control. where is this Embed point?
sandinzz@yahoo.com

2006-02-10, 3:55 am

Hi. I had similar problem.

1. When you "deal with" windows controls, in fact you deals with fields
equate lebels.
So, you must reserve FEQs for all controls you will create during run
time.
Assume that you have some controls already created in App designer, so
we will start
to reserve FEQ for new controls from number 101.
In some Clarion examples ?MyField is used for FEQ, so I'll do similar:
for label ?MyFieldL_1 you must reserve 101, for ?MyFieldL_2 you must
reserve number 102, etc.
Fortunatelly there is ITEMIZE directive which helps you to this, if you
have LOT of controls.
Itemize shows the power of Clarion language and reminded me on C
language.

! Put this code in:
! "Local Data After Object Declarations"
! 101 is "seed" - starting value for your FEQs

ITEMIZE(101)
?MyFieldL_1 EQUATE
?MyFieldL_2 EQUATE
?MyFieldL_3 EQUATE

! ...
! ... etc
! ...

END

2.
After a fer experiments, I found that it is good to use LOOP and ARRAY
for changing properties of controls, (and finding position of controls
on the window later).
So define an array which will help you to do this

! "Local Data After Object Declarations"
! you can use BYTE, or SHORT.
! I do not remember why I initialized this array to 1
! I had unknown number (!!!) of controls (or buttons) so I put 100 for
dimension for array

MyFieldL SHORT(1),DIM(100)

3. Now, in Init() procedure, you must associate MyFieldL array with FEQ

you have reserved for creation of new controls

MyFieldL[1] = ?MyFieldL_1
MyFieldL[2] = ?MyFieldL_2
MyFieldL[3] = ?MyFieldL_3

!
! etc
!

So. to deal with ?Button1, you will use MyFieldL[1], to deal with
?Button2, you will use MyFieldL[2] etc ...
Maybe there is better and shorter way for doing all this. But do not
get .

4. You probably know how to create button.This is how to create button
using array

INDEX_B += 1
CREATE(MyFieldL[INDEX_B],CREATE:Button)

! INDEX_B is current number of created buttons
! Set any property and unhide

MyFieldL[INDEX_B]{Prop:TRN} = TRUE
UnHide(MyFieldL[INDEX_B])

If you like all this. raply me and we will continue. Zoran

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com