Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bindevent on specific Grid column
Message
De
12/03/2021 02:32:49
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
11/03/2021 18:19:09
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01678862
Message ID:
01678921
Vues:
59
J'aime (1)
>>Hello ,
>>
>>good evening
>>I hope you are all well!
>>I need help to create a BINDEVENT in my GRID for a given column where the controlsource is: BI.LOBS3 (see coding)
>>If the column with this conrolsource name exists, if you double-click on the Textbox and this line nº 1 contain the supplier number: 100, then i will go to open my supplier form the Supplier number 100, but if the second line contain the supplier nº 200, then i will go to open my supplier form on the Supplier number 200.
>>
>>First, i must sure that my bindevent only work where the column controlsource are BI.LOBS3, but depending on which line i dblclick, they must respect the activecell value.
>>
>>At this moment I cannot enter on the procedure to display the messagebox!?
>>
>>Public oManipulador As Manipulador
>>
>>* - Instancia o objeto manipulador
>>oManipulador = Createobject("Manipulador")
>>
>>Select BI
>>
>>oGrid = SBO.Pageframe1.Page1.Cont1.Grid1
>>For i = 1 to oGrid.ColumnCount 
>>        IF oGRid.Columns(i).controlsource == "BI.LOBS3"
>>           Bindevent(oGrid,"DblClick", oManipulador, "OnDblClick")
>>       Endif
>>EndFor
>>
>>Define Class Manipulador As Custom
>>	Procedure OnDblClick
>>	Messagebox("you have dblclick on the right column")
>>	Return
>>	Endproc
>>Enddefine
>>
>>
>>Thank you for your help,
>>Best regards
>>Ls
>
>That will work only if your grid has AllowCellSelection = .f.
>If that i snot the case then you should bind to the column currenct control doubleclick
>
>Hello Borislav,
>
>i cannot be able to make my bindevent working, also i don´t know how to change my coding to bind, like you said , on Current Control.
>I also know that my column number is 13, but nothing else more..!
>
>Could you help me please !!
>
>Best regards,
>Ls

Luis
I try from scratch

Add a method like OnDblClick to your form
procedure OnDblClick
loObj?"this is the handler"
endproc
Assuming your grid is populated with all objects, and forms BindControls is set .T. Also I assume, you use standard grid objects.
in your forms init:
BINDEVENT(THIS.ogrid.COLUMNS(lnLoop1).Text1,'DblClick',THISFORM,'OnDblClick')
I guess you can not bind to column.currentcontrol.
Explanation of my idea:
Assuming your column has two controls, for cheap COLUMNS1.Text1 and COLUMNS1.Text2.
in the moment you call BINDEVENT in the init CurrentControl points to one of both. This object is bound, the other not. Because the object is bound, not the property.
IOW CurrentControl is just a pointer to one of both objects, not the object itself.

So you must eventbind both
BINDEVENT(THIS.ogrid.COLUMNS(lnLoop1).Text1,'DblClick',THISFORM,'OnDblClick')
BINDEVENT(THIS.ogrid.COLUMNS(lnLoop1).Text2,'DblClick',THISFORM,'OnDblClick')
if you neeed to know which object fires, use AEVENTS() in OnDblClick. But you shouldn't, since the CurrentControl is controlled by something you can easily query in code.

If you do not know the number of controls in the column, you must iterade through it like
for each loObj in THIS.ogrid.COLUMNS(lnLoop1).Objects foxobject
   if loObj.BaseClass='Header' then
*we will not bind to header
      loop
   endif
   BINDEVENT(loObj,'DblClick',THISFORM,'OnDblClick')
endfor
HTH
Lutz
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform