PDA

View Full Version : hmm what object is this



Quailco
2016-02-09, 14:32
Hello all

1. This question is about a conversion of an existing VFP application without rewriting into the Lianja vision.
2. No pages or sections are created; a form is placed on the screen and is filled by processing metadata.
3. The business rules or validation methods for each form are accessed by determining what object is being processed.

The problem i am trying to conquer is that I so far have found no crash proof way of identifying the current object.
I have a set of code I have attached to the form in the keypress method as follows:
When I find the right event i add code to it to tell the prog what the current object is.

I suspect if the grid weren't present then the query to active row would also crash.

debugout 'CONSO'
debugout grid1.activerow
DEBUGOUT grid1.ActiveColumn
*DEBUGOUT tabindex
*DEBUGOUT this.activecontrol
GROW=grid1.activerow
GCOL= grid1.activeCOLUMN
debugout mcurobj
IF GROW=0 Or GCOL=0
DEBUGOUT 'EXIT CONSO NULL GRID'
*debugout this.baseclass
RETURN
ENDI
NFLD=grid1.column(gcol).controlsource
*DEBUGOUT oldval(grid1.ActiveColumn.controlsource)
DEBUGOUT THIS.NAME
retur


Tabindex, name, activecontrol, baseclass all crash Lianja when they are null or its equivalent. If I could tell that no valid object was in focus,
I could avoid the problem but everything crashes so thats not an option.

Any suggestions or questions will be appreciated. :)

Jim

barrymavin
2016-02-09, 22:13
If something does not work as expected provide us with a SMALL reproducible example NOT the whole of your application as I have to install this on my development machine to determine what is causing the crash.

Also be more specific about "crash". Is it your application or the app builder.

Look at the is_object() function in the doc too.

Quailco
2016-02-10, 12:46
Crash = "Lianja has stopped working' msg from windows.

Is object() according to its documentation tells me if a specific name exists as an object. What I want is not if a name exists but rather what is the name of the specific object in focus. As i said in the first comment, The form is populated via metadata. The program must ask what the object is; it does not know what the object is and therefore does not know what validation rules to apply.

The solution turns out to be simple as many are the correct command is
This.activeccontrol.name

but it took a long time to find :\

thank you

:)

Jim

barrymavin
2016-02-10, 19:07
Glad you figured it out but not does not help us fix the crash you are referring to unless you provide a small reproducible example.