Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activecontrol
Message
From
21/07/2001 08:04:55
 
 
To
21/07/2001 04:11:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00530617
Message ID:
00533490
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hi Yashodhan

>> I am using a form named BaseForm as a template to create another forms. In the new form, I am trying to provide the master file lookup for certain fields with the help of textbox.Name. I am writing the code in the keypress event of the BaseForm so that it can be used in any form as is it. With the help of your previous message (which I have marked as ‘answer’), I could send the name of the active textbox to the LookUp Form. <<

You mean you are trying to writes a "searchable" form where you can search on any field in the form and a little popup search form? If this is the case, I have an example of this sort of thing (complete with sample forms and the actual classes) in "1001 Things You Always wanted to Know about VFP" Hentzenwerk May 2000. It really is too much code to post for you here <s>.

You just look for this in Chapter 11 of the book:

How do I search for particular records? (Example: SearchDemo.scx and Srch.scx)
The ability to find a specific record based on some sort of search criterion is a very common requirement. We have created a generic 'pop-up' form (Srch.scx) which can be used to search for a match on any field in a given table. You just need to be sure that any form that calls it, does so with the following parameters in the order in which they are listed.

>>
DO FORM LookUp WITH Thisform.Name, Thisform.Activecontrol.Name TO m_Returned
<\PRE>
Now, I want to assign m_Returned to textbox.value. So, the next line in the keypress event says
<PRE>
Thisform.Activecontrol.Value = m_Returned
This line generates the error that Activecontrol is not an object. <<

It probably isn't. Try this:

Before you call your popup form, save a reference to the activeControl in a form property (call it oActiveControl). Then, when you get your return value from the popup form, you can assign it like this:
Thisform.oActiveControl.Value = m_returned.
But you have to make sure that your active control is a textbox before you call the popup form like so:
IF TYPE( 'Thisform.ActiveControl.Name' ) = 'C' AND;
   LOWER( Thisform.ActiveControl.BaseClass ) = 'textbox'
  Thisform.oActiveControl = Thisform.ActiveControl
HTH

Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform