Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable size form message window

Status
Not open for further replies.

jaym

MIS
Apr 7, 2000
7
US
New to VFP..<br>Tried passing a message to display on a variable width form with a single label<br>who's caption property is the passed parameter.&nbsp;&nbsp;Want the form to auto-size to slightly larger than the centered message.<br>Have can't seem to pass the parameter to the caption property in the label by assiging it to the parameter in the init function.<br>What am I doing wrong?<br><br>-jaym
 
Assuming you want to pass the variable text to the <b>form</b>, put an LPARAMETER statement in the form's init (not the label's init), then set the caption of the label and the form width.&nbsp;&nbsp;Something like this:<br><br>* begin code<br>* -- form's init<br>lParameter cTextToShow<br>This.lblMyLabel.Caption=cTextToShow<br>This.Width=This.lblMyLabel.Width+30<br>* end code<br><br>That should do it, if I've correctly understood what you are trying to accomplish.<br><br>-FoxDev<br><A HREF=" TARGET="_new">
 
Thanks.. it works fine. Yes, I had my inits messed up.<br>The only other problem is that I had to trial and<br>error place the label so that it would automatically center in the<br>form.&nbsp;&nbsp;Is there a better way to do this.<br><br>-Jaym
 
I think you want to:<br><br>* make the label's Alignment property = 2-Center<br><br>* move the label to the far left of the form (with a small margin, of course)<br><br>* either set the label's AutoSize to .T., or<br>set the width at runtime based on the length of the text being passed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top