Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form's Caption_Assign
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00424701
Message ID:
00424844
Views:
12
>>>>>Thanks, Nick and Trey. Will do. It's simpler, than I thought :)
>>>>
>>>>Ok, I just did. Works fine, but there is a problem: how can I put version 1.0 at the right corner of the screen? IOW, calculate number of spaces between 'normal' caption and 'version 1.0'? Otherwise it doesn't look right.
>>>
>>>I can't play with it right now, but I assume you can try to use SYSMETRIC() function to determine available space for the form caption, minus width of button used in the title bar, and then adjust the number of required spaces in the middle of your caption.
>>
>>Ok, this code seems to do the work (25 is empirical width of controlbox+icon).
>
>SYSMETRIC(33) should give you the width of a button in a title bar.

Thanks, I've modified my code a little:
********************************************************************
*  Description.......: BtCrit.Caption_Assign
*  Calling Samples...:
*  Parameter List....:
*  Created by........: Nadya Nosonovsky 10/04/2000 10:37:20 AM
*  Modified by.......:
********************************************************************
lparameters vNewVal
if not 'version' $ vNewVal && not already there
     local lcCaption, lcFont, lnSize, lcStyle, lnCaptionWidth, lnSpaces
* Form.scalemode = 0 - Pixels
     lcFont = "MS Sans Serif"  && My title bar font settings
     lnSize = 8
     lcStyle = "B"
     lcCaption=rtrim(vNewVal) +'version ' +alltrim(str(this.nVersion,5,2))
     lnCaptionWidth=txtwidth(lcCaption,lcFont,lnSize,lcStyle)*;
          fontmetric(6,lcFont,lnSize,lcStyle)+iif(this.controlbox, 3*sysmetric(33)+sysmetric(16),0)
     lnSpaces = (this.width-lnCaptionWidth) / ;
          (txtwidth(" ",lcFont,lnSize,lcStyle) * fontmetric(6,lcFont,lnSize,lcStyle))
     vNewVal = rtrim(vNewVal) + space(lnSpaces)+'version ' +alltrim(str(this.nVersion,5,2))
endif
this.caption = m.vNewVal
Now I'm waiting for Geo to jump in :)
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