Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Move placement of field based on length of another field
Message
 
To
26/09/2006 14:06:40
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01157231
Message ID:
01157314
Views:
22
>>Jay,
>>
>>You can put the 2 fields on top of each other and PADL the FIELD02 expression with the number of space it takes to move it away from FIELD01.
>>
>>
>>Step 1: Change FIELD02's left to be the same as FIELD01's left
>>Step 2: Change FIELD02's width to match its original right edge
>>Step 3: Change FIELD02's expression to be something like this:
>>
>>    PADL(FIELD02, ExtraSpaces(FIELD01))
>>
>>Step 4: Create an ExtraSpaces( ) function:
>>
>>FUNCTION ExtraSpaces(lcField1Value)
>>   ** Font info for field 1
>>   lcName1 = "Arial"
>>   lcSize1 = 12
>>   lcStyle1 = "B"
>>
>>   ** Font info for field 2
>>   lcName2 = "Arial"
>>   lcSize2 = 10
>>   lcStyle2 = "N"
>>
>>   lnTextWidth = TXTWIDTH(lcField1Value,lcName1,lcSize1,lcStyle1)*;
>>            FONTMETRIC(6,lcName1,lcSize1,lcStyle1)
>>
>>   lnSpaceWidth = TXTWIDTH(SPACE(1),lcName2,lcSize2,lcStyle2)*;
>>            FONTMETRIC(6,lcName2,lcSize2,lcStyle2)
>>
>>   lnSpaces = CIELING(lnTextWidth/lnSpaceWidth)
>>
>>   RETURN lnSpaces
>>ENDFUNC
>>
>>
>>I hope this makes sense. I can send you a sample if you need it.
>
>Ok, that works great, but of course there is another catch (just can't remember them all). The fields may be longer than the width available and could wrap. I think this kills your idea. I can't think of a way to move Field02 down depending on the length of Field01. Very sad; I liked how your worked.



How many rows FIELD01+field02 can have? Because with OLE control you didn't have Stretch with overflow
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform