Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding class objects to the form on the fly
Message
From
03/08/2004 12:19:09
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brazil
 
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00930386
Message ID:
00930398
Views:
15
Hi Terry!
When you uses AddObject, the object created is a object of Form. With this you have to use ThisForm.myNewObject. In your case, try:
thisForm.&lcPanelName..Visible = .T.
I hope this help you.
Bye!


>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
Erick
Força Sempre!
Strength Always!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform