Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Here's something I should know ...
Message
From
10/02/2002 05:55:38
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
09/02/2002 16:40:19
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00617913
Message ID:
00617990
Views:
23
Hi Charles,
the problem with KEYPRESS and fieldupdate is, that keypress runs in front of elements VALID(). But valid have to be run to update the value to the field.
SETFOCUS() to the control itself runs VALID(). (just trace the events). The problem with the grid is, that _VFP.ActiveForm.ActiveControl points to the Grid not to the control in column. _VFP.ActiveForm (or APPLICATION.ActiveForm) may also point to somewhere else or to nowhere.

To solve this:
IF;
  TYPE('.ACTIVECONTROL')=T_Object;
  AND !ISNULL(.ACTIVECONTROL) THEN
 lvActive = .ACTIVECONTROL
 IF LOWER(lvActive.BASECLASS)='grid' THEN
  lcGrid    = SYS(1272,lvActive)
  IF TYPE('THISFORMSET')='O'
   lcGrid = 'THISFORMSET'+SUBSTR(lcGrid,AT(".",lcGrid))
  ELSE
   lcGrid = 'THISFORM'   +SUBSTR(lcGrid,AT(".",lcGrid))
  ENDIF
  lnColumn  = lvActive.ACTIVECOLUMN
  lnColumn  = IIF(EMPTY(lnColumn),1,lnColumn)
  IF !EMPTY(lvActive.COLUMNCOUNT) THEN
   lcControl = lvActive.COLUMNS(lnColumn).CURRENTCONTROL
*Assuming column.name is allways COLUMNnn
   lvActive  = EVALUATE(lcGrid+'.COLUMN'+ALLTRIM(STR(lnColumn,3,0))+'.'+lcControl)
  ENDIF
 ENDIF
*comparsion of Objects introduced with VFP 6.0?
*only if there is an ACTIVEFORM (VFP 7.0 dockable Windows causes errors)
 IF;
   TYPE(APPLICATION.ACTIVEFORM)='O';
   AND !ISNULL(APPLICATION.ACTIVEFORM);
   AND APPLICATION.ACTIVEFORM=THISFORM THEN
  lvActive.SETFOCUS()
 ENDIF
ENDIF
This fails with ActiveX objects like DateTimePicker.

Agnes
>I have a very basic form where the keypress event traps ctrl+up or down arrow to skip records. On this form are fields for editing data. When I type information in the field and do a ctrl+arrow without first exiting the field, the data is not written to the field. What is it I have to do in order to force the data to be written (a form.refresh does nothing)?
>
>Thanks in advance
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]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform