Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find which control and alias is active ?

Status
Not open for further replies.

kosta

Programmer
Feb 9, 2001
186
CA
Hi All,
i want to do with my toolbar like below,

i have standart toolbar and its loading while application start,and i am using this technic (_vfp.activeform.addnew() all of codes ) to tell the toolbar what to do .with the non relational forms there is no problem . with OneToMany forms i want to do that , for example when the user click to any txt textbox then click edit or delete or new button toolbar should use parent table when user click to grid toolbar should use the child table and add,new,edit buttons behavior for row insert,delete and edit .

How can i do this ?

TIA
Soykan OEZCELIK
Comp.Prog / MSFoxPro Programmer Developer
soykanozcelik@web.de
ICQ#93291682
 
Not sure if I understand your question in the first paragraph, but to answer the question asked in the thread title

'how to find which control and alias is active'

WAIT WIND _SCREEN.ActiveForm.ActiveControl.Name

or

WAIT WIND oMain.ActiveControl.Name

and

WAIT WIND ALIAS()
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Hi Chris,
thanks for the reply,

exactly i want to find active table for toolbar add,delete actions . i have base form and methods on it addnew,delete,edit so on..and toolbar uses only this commands _vfp.activeform.addnew() or _vfp.activeform.delete
all of action codes are on the forms

with alias() i think i can do like under;

if _screen.activeform.activecontrol.name="grid1"
select (thisform.lcfile2) &&lcfile is a property on the form
appe blank
else
select (thisform.lcfile1) && parent table
endif

what is your comment or suggestion Soykan OEZCELIK
Comp.Prog / MSFoxPro Programmer Developer
soykanozcelik@web.de
ICQ#93291682
 
kosta

What you have posted should work - using an object reference for the form would be more reliable than _SCREEN.ActiveForm

You could always add a new form property called .cAlias and in the .GotFocus() event of any object put :-

WITH THISFORM
[tab]IF EMPTY(ALIAS())
[tab][tab].cAlias = [NoTableSelected]
[tab]ELSE
[tab][tab].cAlias = ALIAS()
[tab]ENDI
ENDW

This would always tell you the active table or not at any time.
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
dickylam,
That's a good link, but by using _SCREEN.ActiveForm you avoid the formset problem. i.e. Change:
Code:
WAIT WINDOW   THISFORM.ACTIVEFORM.NAME
To:
WAIT WINDOW   _SCREEN.ACTIVEFORM.NAME
I tested this in VFP 6 SP5, 7 SP1 and 8.

In other words, "Not all Activeform properties are the same!".

Rick


 
Hi Mike,

"You could always add a new form property called .cAlias and in the .GotFocus() event of any object put :- "


to add .calias method each forms is OK but to the each object gotfocus is coming to me so hard . I think must be more easy way for this.



Soykan OEZCELIK
Comp.Prog / MSFoxPro Programmer Developer
soykanozcelik@web.de
ICQ#93291682
 
kosta

I assumed you have your own subclassed controls?

If so you add it to each class.
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top