Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inconsistent execution
Message
 
To
22/03/2001 10:26:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00487608
Message ID:
00487891
Views:
9
Jeremy,
First, I'd use the Keypress method of the listbox to trap the Delete key instead of OKL. OKL worked fine is FPDOS and FPWindows, but Keypress is better for VFP.

Second, instead of referring to Application.ActiveForm.ActiveControl.DeleteItem, you can pass the control as an object to your procedure code:
** Code to call the DelItemList procedure
DelItemList(this)      && "THIS" passes an object referring to the listbox

** In the DelItemList function
function delitemlist
  lParameter oCallingObject   && This is the object referring to your listbox
  if PEMSTATUS(this, "DeleteItem", 5)
         *5 is 'does it exist?'. make it through here
     this.deleteitem()
  endif
return .T.
Note I haven't tested this, but you should be able to see how a procedure call can handle a form object.

HTH
Barbara


>the following will run fine if i do right-click run from (after setting to
>proc.. in command window), but gives "object not found error" if running the
>exe.
>
>it deletes a item from a listbox when you press the del key, the DeleteItem
>holds the place where the delete code exits ( that way you can use a generic
>trap for the delete key rather then XXX on key label functions to manage)
>
>on init of listbox:
>this.addProperty("DeleteItem", thisform.name + ".DelAccessg") && ok
>
>on when of same listbox:
>on key label DEL do DelItemlist && seems ok, calls the function
>
>in proc file:
>procedure delitemlist
> PUSH KEY CLEAR
> if PEMSTATUS(Application.ActiveForm.ActiveControl, "DeleteItem", 5)
> *5 is 'does it exist?'. make it through here
> private cStmt
> cStmt = Application.ActiveForm.ActiveControl.DeleteItem
> &cStmt && <----------------------------------- error occurs here
> endif
> POP KEY
>endproc
>
>thanks
>- jer
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform