Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Textbox Width Off?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00507402
Message ID:
00507660
Vues:
18
Steve,

Read Barbara's suggestion. Actually, I made these corrections already, but I'm not sure, you've noticed them. You have to assign ControlSource to the column, not the TextBox, which should be lived with all default properties.

Also this is a method from our grid class, perhaps, you can grab some ideas:
********************************************************************
*  Description.......: wgGrid.FormatAndSetCaption - format all grid columns and set caption to be in Proper format
*  Calling Samples...:
*  Parameter List....:
*  Created by........: Nadya Nosonovsky 03/09/2000 02:03:22 PM
*  Modified by.......: Nadya Nosonovsky 03/29/2000 01:37:26 PM
********************************************************************
local loColumn, loControl, lnWidthTotal, lnSel,  ;
     lnFWidth, lnCWidth, lcFieldName, lcFieldType

lnSel=select() && save current area

if this.recordsourcetype=1 OR this.recordsourcetype=0 && Alias or table
     select (this.recordsource)
     lnWidthTotal= iif(this.recordmark, 10,0)+ iif(this.scrollbars>1,sysmetric(5),0) ;
          + 2 * this.gridlinewidth + iif(this.deletemark, 10,0)+10 && record marker & vertical scroll bar+deletion mark
     for each loColumn in this.columns
          * -- For each column determine the width and use the correct caption.  
          * -- Display the caption via the proper() function.
          lcFieldName=alltrim(substr(loColumn.controlsource,rat('.',loColumn.controlsource)+1))
          lcFieldType=type(lcFieldName)
          lnFWidth=iif(lcFieldType='D',13,iif(lcFieldType='T',28,fsize(lcFieldName)+3)) && Field size
          for each loControl in loColumn.controls
               if lower(loControl.baseclass) = "header"
                    * Handle condition of header set in grid.
                    if lower(left(loControl.caption,6))='header'  && Don't override a preset caption
                         * -- NSL Use the DBC caption if it exists.
                         loControl.caption=dbgetprop(loColumn.controlsource,'field','caption')  
                    endif
                    if empty(loControl.caption)  && There is no DBC caption, Just use the Field name
                         loControl.caption=proper(lcFieldName)
                    else
                         loControl.caption=proper(loControl.caption)  && If it has been coded in the grid, use it.
                    endif

                    lnCWidth=(txtwidth(loControl.caption,loControl.fontname,loControl.fontsize)+2) * ;
                         fontmetric(6,loControl.fontname,loControl.fontsize)+3 && Width of caption
               endif
               exit  && No need to ck the other controls
          endfor

          loColumn.width=round(max(lnFWidth*fontmetric(6,loColumn.fontname,loColumn.fontsize),lnCWidth),0)
          lnWidthTotal=lnWidthTotal+loColumn.width

** Nadya Nosonovsky 03/29/2000 01:35:47 PM added Incremental Search (could be added for ReadOnly grid)

          if this.lIncremental and lcFieldType='C' && We would use this feature only for char fields
               if lower(loColumn.currentcontrol)='text1' && standard text1 control
                    loColumn.removeobject('text1')
                    loColumn.newobject('text1','ingrid','wgcontrols.vcx') && Incremental search textbox
                    loColumn.text1.visible=.t.
                    *loColumn.ReadOnly=.t. && this is necessary condition     
                    loColumn.text1.cLocateExpression='upper('+lcFieldName+')'
               endif
          endif

*  Nadya Nosonovsky 03/29/2000 01:36:17 PM added Show Memo

          if this.lShowMemo and lcFieldType='M' && We want to show Memo field
               if lower(loColumn.currentcontrol)='text1' && standard text1 control
                    loColumn.removeobject('text1')
                    loColumn.newobject('text1','edtexpand','wgcontrols.vcx') && expandable editbox
                    loColumn.text1.visible=.t.
                    loColumn.sparse=.f.
               endif
          endif
     endfor

     this.width=min(this.width,lnWidthTotal)
endif
select (lnSel) && return to previous area
>>I stepped through the debugger a lot, checking every property on the grid textbox, and it appears that the .text value is always a single character, and is the first character of the column value. For example, if I look at the underlying table and the record pointer is on "Real Time Checking" then the value of GridGeneral1.Column1.Text1.Text = "R".
>>
>
>Steve,
>
>Check MaxLength property of the textbox, format and inputmask. They all should be default values. Other than that, it's odd and should not happen.
>
>Check the ControlSource property for the column. You don't have to set it for the textbox.
>
>>Why ?
>>
>>
>>I am going to re-visit the issue of parameter passing. I plan to use XML to do it, but that will come much later. For now, I just need to get the basics going.
>>
>>Thanks.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform