Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The incredible shrinking column
Message
From
04/12/2001 02:28:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
03/12/2001 13:36:12
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00588828
Message ID:
00589092
Views:
34
>Hi All,
>
>I am having strange behavior in the textboxes in my grid columns. Because the grid is used for several different cursors, I have to redefine it for each one. I needed code in the DBLCLICK event, so I had to do a DEFINE to create the textbox. What is happening is when the grid appears everything looks great. But, as soon as I click on any of the columns (textboxes). The visible display of the data is cut short (Truncated?). What showed as 50+ characters now shows 12. I can?t seen to find why. Any ideas.

50 seems to be pretty much the length of the standard textbox. Since you're setting the columncount to -1 first, then to 6, you'll basically end up with the grid being recreated each time. One thing I'd change in this code would be to remove the .SETALL("CURRENTCONTROL", 'txtbox', "COLUMN") part, and put six .COLUMN3.RemoveOBJECT( 'text1') statements instead.

A better thing to do would be to do all this only once, and base the grid on one readwrite cursor, which would be zapped as needed and filled from other cursors as needed. That would be faster than rebuilding the grid each time. You could keep the PKs of the original cursors in this cursor (even record numbers would do) so you could even save the changes before zapping. I've tried this in VFP5 and it was both reliable and blazingly fast - I had an automatic processing thing (matching payments with invoices) and had the results showing in a grid, based on a cursor which was zapped few times each second. Worked like magic.

>DEFINE CLASS dblclktext AS TEXTBOX
>
> VISIBLE = .T.
> SPECIALEFFECT = 1
> BORDERSTYLE = 0
> BACKCOLOR = RGB(255,255,254)
> * This is the required procedure.
> PROCEDURE DBLCLICK
> DO CASE
> CASE req_detl
> THISFORM.contDetail.cmdMoreInfo.CLICK
> CASE win_shop
> THISFORM.contDetail.cmdQuit.CLICK
> ENDCASE
>ENDDEFINE
>
>WITH .grid1
> .RECORDSOURCE = ""
> .COLUMNCOUNT = -1
> .SCROLLBARS = 2
> .ALLOWROWSIZING = .F.
> .DELETEMARK = .F.
> .COLUMNCOUNT = 6
> .RECORDSOURCE = "curreq"
> .column1.WIDTH = 25
> .column2.WIDTH = 150
> .column3.WIDTH = 90
> .column4.WIDTH = 75
> .column5.WIDTH = 75
> .column6.WIDTH = 350
> .SETALL("BOUND", .F., "COLUMN")
> .SETALL("SPARSE", .F., "COLUMN")
> .COLUMN1.ADDOBJECT( 'txtbox', 'dblclktext' )
> .COLUMN2.ADDOBJECT( 'txtbox', 'dblclktext' )
> .COLUMN3.ADDOBJECT( 'txtbox', 'dblclktext' )
> .COLUMN4.ADDOBJECT( 'txtbox', 'dblclktext' )
> .COLUMN5.ADDOBJECT( 'txtbox', 'dblclktext' )
> .COLUMN6.ADDOBJECT( 'txtbox', 'dblclktext' )
> .SETALL("CURRENTCONTROL", 'txtbox', "COLUMN")
> .column1.txtbox.CONTROLSOURCE = "curreq.ord_ln_no"
> .column2.txtbox.CONTROLSOURCE = "curreq.user_part_no"
> .column3.txtbox.CONTROLSOURCE = "curreq.cost_amt"
> .column4.txtbox.CONTROLSOURCE = "curreq.qty_ord"
> .column5.txtbox.CONTROLSOURCE = "curreq.uom"
> .column6.txtbox.CONTROLSOURCE = "curreq.part_desc"
> .column1.header1.CAPTION = "No."
> .column2.header1.CAPTION = IIF( nLangue = 1, "No. PIÈCE", "PART Number" )
> .column3.header1.CAPTION = IIF( nLangue = 1, "COÛT STD", "STD COST" )
> .column4.header1.CAPTION = IIF( nLangue = 1, "QTÉ", "QTY" )
> .column5.header1.CAPTION = "UOM"
> .column6.header1.CAPTION = "DESCRIPTION"
> .SETALL( "MOVABLE", .F., "COLUMN" )
> .SETALL( "RESIZABLE", .F., "COLUMN" )
> .SETALL( "READONLY", .T., "COLUMN" )
> .SETALL( "ALIGNMENT", 0, "COLUMN" )
> .SETALL( "ALIGNMENT", 2, "HEADER" )
> .SETALL("FONTBOLD", .T., "HEADER")
> .SETALL("FORECOLOR", RGB(0,0,255), "HEADER")
> .SETALL("BACKCOLOR", RGB(192,192,192), "HEADER")
>ENDWITH
>
>VFP6 SP5
>
>TIA
>Mike

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform