ObjectAction failure


#1

I have an ObjectAction “Open” statement at the end of a long procedure, which fails to open the Text Editor object. However, I can use a single line procedure using the same statement to open the object. Has anyone else experienced this? Perhaps I am missing something.


#2

You would need to post more details about your long procedure. For starters, have you verified that the objectaction statement is even getting executed? I would put a message or nsnotify statement right in front of it to make sure the program is getting that far. If the objectacation statement has the correct object name, I highly doubt that it would not work if it is actually being run. The code is the same as what happens when you press the tab key to start editing.


#3

Yes, I am able to show that the procedure runs up to the ObjectAction statement. However, the procedure will not execute the ObjectAction. I can run a separate short single statement procedure, an exact copy of the statement in the long procedure, and the short procedure works. My statement is: ObjectAction “AccountIncrease”,“Open” Note that I am working inside a tab panel object, so this may add a layer of complexity.


#4

Using a tab panel does not matter, as long as the AccountIncrease object is visible on the form.


#5

Is it possible you used setactivedatabase earlier in the procedure and forgot to reset back to the original database with setactivedatabase “”?


#6

Or used a secret window?


#7

I am a little slow at following up on this issue, but I may have figured it out. PanoramaX has the cool Tab Panel object which can be a real time saver. The tab panel object, according to my understanding, can be assigned a file global variable to keep track of the current tab. The tab panel object also can be assigned a procedure allowing manipulation of the database, depending on the current tab (or value of the file global variable). There are two ways to invoke the tab panel procedure. The user can click on an actual tab which triggers the procedure, or the user can assign a new tab value to the file global variable. In other words, you can change the tab with an external procedure. Therein lies the problem. The tab panel procedure, which contains the ActiveObject Open command, does not work precisely the same when activated with a procedure compared to clicking on a tab. I created a simple tab panel procedure that uses the ActiveObject Open command. If I choose the panel by clicking on the appropriate tab, the target object is indeed opened. However, if I run an external procedure to select the tab, the tab panel procedure is invoked, but the ActiveObject Open command does not work. Here’s some more detail. My file global variable is fgPanel. My external procedure is fgPanel = “Split” followed by ShowVariables fgPanel. The change in fgPanel invokes the tab panel procedure, but when the procedure is triggered this way, the ActivObject Open command does not work. Let me know if my thinking is wrong or if there may be an issue here.


#8

Without knowing the exact code, I am guessing, but it sounds like perhaps the objectaction open statement is running before the Text Editor Object has actually been moved into place on the form. If that is the problem I would probably use a timer to open the object after a slight delay, like this.

starttimer "open editor",
    "repeat",1,
    "code",{objectaction "my editor object","open"}

I think the code above will cause enough delay for it to work, but if not, you could put in a 1 second delay:

starttimer "open editor",
    "repeat",1,
    "next",supernow()+1,
    "code",{objectaction "my editor object","open"}

Note: The timer name, "open editor", is arbitrary. You can use any name you want as long as it is not currently in use by another timer.