Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid class to know if any control is double clicked
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
00971672
Message ID:
00971994
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
>Hi Gregory
>
>>The best check is imo
>>this.Parent.BaseClass = 'Column'
>
>Did just that.
>
>>oh, and pass the object reference as well: this.parent.parent.dblclick(this). You'll find out you need it
>
>I'll keep this in mind.
>
>Anyway I came to a problem area. This grid is dynamically created, I assign the rowsource/controlsouce at run-time. The fields created using textbox are of the default variety. It does not use my classes.
>
>Anyway I can get it to use my textbox subclasses?
>
>Merry Christmas

Oh, yes. See sample code below which you'll have to change

I suppose your grid is subclassed
&& grid base class init()
=this.ProcessColumns()  && amongst other things

&& ProcessColumns()
local i

for i =  this.ColumnCount to 1 step -1  && decreasing: in clase you delete a column further down

	=this.ProcessColumn(this.Columns(m.i))
endfor

&& ProcessColumn

lparameters obj

local i, s, cs, t, cs_table, cs_Field

do case
case this.NoInit  && to set if the grid is done with the designer and you do not want to have it touched

case type('m.obj.PostProcessed') == T_LOGICAL

otherwise
    =m.obj.AddProperty('PostProcessed')

    cs = lower(m.obj.ControlSource)
    t = type(m.cs)
    t = iif(inlist(m.t, T_UNDEFINED),  vartype(eval(m.cs)), m.t)

    cs_Field = substr(m.cs, at('.', m.cs)+1)
    cs_table = left(m.cs, at('.', m.cs)-1)

    
   do case
   case inlist(m.t, T_CURRENCY)
        obj.Text1.Visible = FALSE
        =obj.RemoveObject('Text1')
        =obj.AddObject('_Currency', '_currency')
        obj._Currency.Visible = TRUE
        m.obj.Sparse = FALSE
        s = 'iif(' + obj.ControlSource + '<$0, rgb(255,0,0), rgb(0,0,0))'
	obj.DynamicForeColor = m.s

    case inlist(t, T_LOGICAL )
        obj.Text1.Visible = FALSE
	=obj.RemoveObject('Text1')
	=obj.AddObject('_Checkbox', '_Checkbox')
	obj._Checkbox.Visible = TRUE
        m.obj.Sparse = FALSE

    case inlist(m.t, T_DATE, T_DATETIME )
	obj.Format = 'D'	&& 2 or 4 chars
        obj.Text1.Visible = FALSE
	=obj.RemoveObject('Text1')
        =obj.AddObject('text1', '_TextBox)
        obj._Checkbox.Visible = TRUE

    case ( m.t == T_MEMO )
        obj.Text1.Visible = FALSE
	obj.RemoveObject('Text1')
	obj.AddObject('Text1', '_editbox')
	obj.Text1.Scrollbars = 0
	obj.Sparse = FALSE
	obj.Text1.Visible = TRUE

    case && and so on

    endcase


    if( !inlist(m.t, T_MEMO, T_LOGICAL ) )
	obj.Alignment = 3
    endif


    =m.obj.Setall('FontSize', 8)
    =m.obj.Setall('BorderStyle', 0 )
    =m.obj.Setall('Margin', 0)

endcase
ProcessColumns or ProcessColumn(obj) can be called when you need it from other methods, eg recordSource_assign



My grid.init() on a form looks like this
&& add/remove columns

=DoDefault()

&& postprocess, eg add another control, change Dynmamic...
Success, and Merry Christmas too
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform