Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RemoveObject in Init
Message
 
 
To
28/02/2001 12:52:20
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00480229
Message ID:
00480615
Views:
11
>Nadya:
>
>I will research Add Object, AddObject, and RemoveObject a little further and I
>will post my findings on UT.
>
>> I saved both grids as independant classes and instead of removing one object,
>> I add object in Run-time. This works like a charm and I also save time of
>> instantiating this object. Perhaps, this solution could be used in your case
>> too.
>
>Adding is usually preferable to Removing but you cannot add controls at runtime
>without code in something other than the control. The objects to remove are
>intended to be dropped on containers and their mere presence triggers a set of
>checks and events.
>
>Daniel

Daniel,

I'm not 100% sure, I'm following you. I added objects in Form Init method without problems (BTW, I use NewObject METHOD - new in VFP 6.0). Objects could be added to container object or to form itself.

This is how I modified the original code (Form.Init):
with this
     .caption = space(20)+"De-Duper for " + alltrim(lcCity)+", "+lcState+"     FY Year: "+lcFY

     do case
     case .dedupetype = DDJC_TRNX               && Weekly Transaction Processing
*       this.removeobject('grdBldmstr2')          && remove grid for parcel processing mode
          .newobject('grdBldMstr','grdBldMstrTrxn','deductrl.vcx')
          .grdBldMstr.left=12
          .grdBldMstr.top=6
          .grdBldMstr.visible=.t.
          .caption = .caption + " - " + DDJD_TRNX

     case this.dedupetype = DDJC_PRCL               && Parcel Processing
*       this.removeobject('grdBldmstr')               && remove grid for weekly transaction processing mode
*       this.grdBldmstr2.name = 'grdBldmstr'     && rename parcel processing to primary grid name
          .cmdDelBldgInfo.visible=.t.
          .newobject('grdBldMstr','grdBldMstrParc','deductrl.vcx')
          .grdBldMstr.left=12
          .grdBldMstr.top=6
          .grdBldMstr.visible=.t.
          .caption = this.caption + " - " + DDJD_PRCL

     case this.dedupetype = DDJC_TRNM               && TranMstr Maintenance
          .caption = this.caption + " - " + DDJD_TRNM
          wait window 'DEDUMAIN.Init: "' + DDJC_TRNM + '" mode of de-duping is not yet supported.'
          return .f.                                        && fail

     otherwise
          wait window 'DEDUMAIN.Init: unknown de-duping job type.  Must be "' ;
               + DDJC_TRNX + '" or "' + DDJC_PRCL + '".'
          return .f.                                        && fail
     endcase
endwith
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform