Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding class objects to the form on the fly
Message
De
03/08/2004 11:54:39
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Adding class objects to the form on the fly
Divers
Thread ID:
00930386
Message ID:
00930386
Vues:
57
Hi, guys

Here's my problem:

I have a class in the form of a horizontal panel, with combos on it. It's used for creating user equations, with selected fields, i.e. select a field from combo, select a multiplier factor from combo, select an operator, then select another field in a similar fashion. So the resulting equations is of the form:

(field1 * factor1) +-/* (field2 * factor2)

Now the form has one of these classes on it to start, but the user may want to use the result of this in another equation, or create another equation anyway. So, when they click OK another similar panel class is supposed to appear underneath (similar to adding fields in table builder, or adding fields to a query in query builder). I lengthen the form by the depth of a panel (+ a bit for the pot), but need to control the placement of the next panel. I also want to name each panel, cntMixAP1,2,3, etc. so's to refer to them later in code. Consider the snippet below:
LOCAL	lcPanelName, loNewPanel

With Thisform
  .nMixPanelNo		= .nMixPanelNo + 1
  .Height			= .Height + 62			&& Add enough room for another calc panel
  .nPanelTop		= .nPanelTop + 62
  lcPanelName		= "cntMixAP" + ALLTRIM( STR( .nMixPanelNo))
*TPMcD*	  loNewPanel	= CREATEOBJECT( "mclCntMixAP")
*TPMcD*	  With loNewPanel
*TPMcD*	  	.Left	= Thisform.nPanelLeft
*TPMcD*	  	.Top	= Thisform.nPanelTop
*TPMcD*	    .Visible	= .T.
*TPMcD*	  Endwith 
  .AddObject( lcPanelName, "mclCntMixAP")
  .Refresh()
  lcPanelName.Visible	= .T.
Endwith 
As it stands, I get:
"lcPanelName is not an object"
when I run
lcPanelName.Visible = .T.
as is to be expected

If I run the commented out code, with CreateObject() instead of .AddObject(), to give it an object ref, the new panel doesn't appear and, from trace and locals windows, I'm not convinced it's there anyway.

I don't think you can use macro subs for container/containee objects so I'm a bitr screwed as to what to do here. Any suggestions would be greatly appreciated. Sergey??? {bg}

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform