dodefault() set classlib to ccontrol.vcx additive this.mcButtonName = this.Name + sys(2015) this.parent.AddObject( (this.mcButtonName), "cmdLabelButton", this ) local loObject loObject = evaluate( "this.parent." + this.mcButtonName ) with loObject .Visible = .t. .TabIndex = this.TabIndex + 1 endwithThe cmdLabelButton class has these methods:
* cmdLabelButton.Init() lparameter roLabel dodefault() with this .Top = roLabel.Top - 2 .Left = roLabel.Left - 2 .mcLabelName = roLabel.Name .Zorder( 1 ) endwith * cmdLabelButton.GotFocus() if ( dodefault() ) * have to set this because AutoSize labels size isn't set till it's way too late local loObject loObject = evaluate( "this.parent." + this.mcLabelName ) with this .Width = loObject.Width + 4 .Height = loObject.Height + 4 endwith endif * cmdLabelButton.Click() local loObject loObject = evaluate( "this.parent." + this.mcLabelName ) loObject.Click()So the button establishes a name based reference the the label it's attached to. I do this instead of an object reference to keep from having destruct sequence dangling oject reference problems. In the GotFocus() the button sizes itself to be slightly larger than the label. You can not do this at Init time because a Label's .Height and .Width are not set until they are painted the first time. The Click() method hands the click event back to the label.Click().