error control not defined

93 views
Skip to first unread message

Ronaldo Geniais

unread,
Jul 15, 2021, 10:58:07 AM7/15/21
to Harbour Users
unexpected error
I have an application that opens a form with several controls (buttons, grids, labels, etc.) in this form there is a button that opens another form, and sometimes randomly, an undefined control error occurs, as if the control was not more defined. I put additional code to test if the control is defined, and it passes normally, but when referencing the control, control not defined error occurs. But as I said, this happens randomly, someone can tell me what I'm wrong. I don't use FRM, I define the form inside the PRG directly.

example :

If _IsControlDefined ("Grid_ItensPC","FRM_PEDCOMPRA")
   WAIT WINDOW "Pesquisando itens do pedido..." nowait
   FRM_PEDCOMPRA.Grid_ItensPC.DisableUpdate
   DELETE ITEM ALL FROM Grid_ItensPC Of FRM_PEDCOMPRA    (ERROR GRID_ITENSPC NOT DEFINED)

Auge & Ohr

unread,
Jul 15, 2021, 11:35:34 PM7/15/21
to Harbour Users
hi

you can write

   <Windowname>.<ControlName>.DisableUpdate()
Or
   Domethod(cWindowname,cControlName,'DisableUpdate')

but sometime i got same NOT DEFINED Error like you when using 1st. Syntax
it seem to work better with 2nd Syntax

   Domethod(cWindowname,cControlName,'DeleteAllItems')

Jimmy
p.s. are you using GRID with DBF or Array ?

Appliserver

unread,
Jul 16, 2021, 5:08:54 AM7/16/21
to harbou...@googlegroups.com
--

[In HMG] I experienced a similar problem. A main window on start called a procedure that in turn opened a variable number of other windows. If in one of these windows a control was defined that referred to the next control (in the program source), it failed, aka the subsequent control was not recognized. If the second control was placed before the offending control, it worked. In my case I had to change the program logic. I was not able to fix the problem: it seems that defining new windows from a procedure called on main window's init procedure does not work properly.

I don't know if the problem is related with yours, anyway: maybe there is a problem with DisableUpdate... HTH

Dan

--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/74942ed4-1250-4b9d-b4b9-5f6a01c85cafn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages