Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disparar um método no rightclick do header do grid
Message
From
21/07/2003 13:57:36
 
 
To
21/07/2003 13:39:03
Cleber Ferrari
Capta Tecnologia
Brazil
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00811779
Message ID:
00812085
Views:
53
Cleber,

>Na linha :
>
>BindEvent( loControl, "RightClick", this,["ordenar(]+locolumn.ControlSource+[)"])
>
>
>Recebo o erro :
>
>Property "ordenar(config.codigo)" is not found.
>
>Se no BindEvent eu colocar :
>
>BindEvent( loControl, "RightClick", this,"ordenar")
>
BindEvent vincula los dos eventos, pasando al segundo los parámetros de entrada del primero. Para saber desde dónde está siendo llamado, deberías buscar otro método.

Creo que lo que quieres hacer se logra mejor usando las nuevas Member Classes.

Te adjunto un ejemplo:
DEFINE CLASS msColumn AS Column

HeaderClass = "msHeader"
HeaderClassLibrary = "msBaseClass.prg"

ENDDEFINE


DEFINE CLASS msHeader AS Header

Alignment = 2 && Center
FontSize = 8

PROCEDURE RightClick()

   If this.FontBold
      * Is already indexed by this column; leave it as is
   Else
      Local lnBuffer as Number, ;
       llSuccess as Boolean, ;
       lcExpression as String, ;
       lcThisColumnName as String, ;
       loColumn as Object
		
      llSuccess = .t.
      Try
         lcExpression = this.Parent.ControlSource
         * Always index strings on uppercase
         If Type(lcExpression) = "C"
            lcExpression = "Upper("+lcExpression+")"
         EndIf 
	
         Index On &lcExpression tag SelOrder
         Catch to oError
            llSuccess = .f.
            Assert .f. message "Indexing failed !" + ParseError( oError )
      EndTry
		
      If llSuccess
         *... switch the FontBold property
         lcThisColumnName = this.Parent.name

         For each loColumn in this.Parent.parent.Columns
				
            * Bold for this header, normal for any other one
            loColumn.Controls[1].FontBold ;
             = ( loColumn.name = lcThisColumnName )
         Next
			
         * If succesfully reordered, restores the record pointer
         locate
         this.Parent.parent.refresh()
      EndIf 
   EndIf 

ENDPROC

ENDDEFINE
Para usar estas clases, en tu clase MEUGRID debes declarar en la propiedad MemberClass "msColumn", y en MemberClassLibrary, el nombre del prg en que hayas guardado este código.

Mucha suerte,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform