Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent() on grid.KeyPress does not fire
Message
De
24/06/2016 05:10:41
 
 
À
24/06/2016 04:30:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01637629
Message ID:
01637635
Vues:
145
This message has been marked as the solution to the initial question of the thread.
J'aime (1)
>>>Hi,
>>>
>>>Can't get a delegate method on grid.KeyPress() to fire:
>>>
>>>local grdKeyPressBindEvent
>>>grdKeyPressBindEvent = CreateObject('grdKeyPressBindEvent')
>>>grdKeyPressBindEvent.Show(1)
>>>
>>>define class grdKeyPressBindEvent as Form
>>>
>>>add object grd as grid with;
>>>   top = 10;
>>> , left = 10;
>>>
>>>procedure LOAD
>>>create cursor Test(Test1 C(10), Test2 C(10))
>>>insert into test values ('Test11', 'Test12')
>>>insert into test values ('Test21', 'Test22')
>>>go 1
>>>
>>>procedure init
>>>BindEvent(this.grd, 'KeyPress', this, 'grdKeyPress')
>>>
>>>procedure grdKeyPress
>>>lparameters nKeyCode, nShiftAltCtrl
>>>wait window Textmerge([grd.KeyPress(<<m.nKeyCode>>, <<m.nShiftAltCtrl>>)]) nowait noclear timeout 5 && never shows up
>>>
>>>enddefine
>>>
>>>
>>>Any idea why?
>>>
>>>Thanks
>>
>>grd.AllowCellSelection must be set to .F., otherwise KeyPress() event fires at the textbox level.
>
>Thanks Antonio,
>
>Event tracking logs grid.KeyPress() firing (see attached event log screen shot)

Fires but does not execute, just passes to the contained object. You can see the difference that AllowCellSelection makes in the process.
#define DEF_ALLOWCELLSELECTION	.F.

WAIT CLEAR

local grdKeyPressBindEvent
grdKeyPressBindEvent = CreateObject('grdKeyPressBindEvent')
SET EVENTLIST TO KeyPress
SET EVENTTRACKING TO "EVENTS.LOG"
SET EVENTTRACKING ON
grdKeyPressBindEvent.Show(1)
SET EVENTTRACKING OFF
SET EVENTTRACKING TO
SET EVENTLIST TO
MODIFY FILE "EVENTS.LOG"

define class grdKeyPressBindEvent as Form

add object grd as grid with;
   top = 10;
 , left = 10, AllowCellSelection = DEF_ALLOWCELLSELECTION ;

procedure LOAD
create cursor Test(Test1 C(10), Test2 C(10))
insert into test values ('Test11', 'Test12')
insert into test values ('Test21', 'Test22')
go 1

procedure init
BindEvent(this.grd, 'KeyPress', this, 'grdKeyPress')

procedure grdKeyPress
lparameters nKeyCode, nShiftAltCtrl
wait window Textmerge([grd.KeyPress(<<m.nKeyCode>>, <<m.nShiftAltCtrl>>)]) nowait noclear timeout 5 && never shows up

enddefine
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform