Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: 84. Is it a Focus Problem? 1

Status
Not open for further replies.

rustychef

Technical User
Sep 2, 2004
63
0
0
US
Honestly I don't know if this belongs in HTML, or VBScript... I am trying to update a graphic editing HTML based tool. Here's how its set up:
====================================================================================================

1. QA.htm contains procedure Sub LoadFile() written in vbscript. The file defines 2 frames: "header" and "mainFrm"

</HEAD>
<frameset rows="64,*">
<frame name="header" src="header.htm" scrolling="no">
<frame name="mainFrm" src="Toc.htm" scrolling="auto">
</frameset>
</HTML>

2. header.htm contains a form (<form name="myform" action="checkboxes.asp" method="post">) that holds a table of controls that the user uses to set up display options

3. Toc.htm is a list of graphic filenames that the user can click to load the graphic to view. Code example:

<BR><a href="JavaScript:top.LoadFile('abc123-001')">abc123-001</a>

4. ig.htm sets up the "view graphic" object with a few viewing tools (zoom in/out, highlight line, etc)

5. IG_Vert.htm is a "shell" that sets up two instances of ig.htm in vertical side-by-side frames

<HTML><HEAD></HEAD>
<frameset cols="50%,*">
<frame name="IG1" src="IG.htm" scrolling="no" maginwidth="0" marginheight="0">
<frame name="IG2" src="IG.htm" scrolling="no" maginwidth="0" marginheight="0">
</frameset>
</HTML>

6. IG_Horz.htm is a "shell" that sets up two instances of ig.htm in horizontal stacked frames

<HTML><HEAD></HEAD>
<frameset rows="50%,*">
<frame name="IG1" src="IG.htm" scrolling="no">
<frame name="IG2" src="IG.htm" scrolling="no">
</frameset>
</HTML>

====================================================================================================
HOW IT WORKS:
When the user opens QA.htm they see the header frame at the top and the mainFrm on the bottom. Initially mainFrm contains a list of filenames from Toc.htm. When they click on a filename, the Toc.htm link calls the procedure LoadFile() using: <BR><a href="JavaScript:top.LoadFile('abc123-001')">abc123-001</a>

Inside LoadFile() the graphic variable are set up, then the frame mainFrm changes to show IG_Horz.htm (This is accomplished with the statement: top.mainFrm.location="IG_Horz.htm"), and finally the graphics are loaded.

Here's an excerpt from LoadFile()

sub LoadFile (filename)
.
.
.
[LINE 47] top.mainFrm.location="IG_Horz.htm"
[LINE 48] top.header.myform.Diagram.value = currentFile
[LINE 49] top.mainFrm.IG1.file_name.value = CStr(currentFile & "." & currentExtension)
[LINE 50] top.mainFrm.IG1.IGView1.LoadFileVP CStr(subdir1 & currentFile & "." & currentExtension), "allnocolors"
[LINE 51] top.mainFrm.IG1.IGView1.SetHome CStr(subdir1 & currentFile & "." & currentExtension), "allnocolors"

end sub

====================================================================================================
HERES THE PROBLEM:
When I run the code as displayed, I get the following error when I hit LINE 49:

An error has occured in this dialog
Error: 84
Unspecified error.

No other information is given, no line number or character, etc.

Now, before you ask to see all the code, please read this... I know what line number causes the error because I went back and inserted "Msgbox" all over until I found the problem. Funny thing about it tho, is that if the function message box is inserted into the code after [LINE 47], but before [LINE 49], everything works just fine (see below).

This is the reason I didn't just to a code dump. I know everything works (when Msgbox is used). I seems like its a "focus" issue almost like the program gets lost after mainFrm source file is changed to IG_Horz.htm.

[LINE 47] top.mainFrm.location="IG_Horz.htm"
Msgbox "1"
[LINE 48] top.header.myform.Diagram.value = currentFile
[LINE 49] top.mainFrm.IG1.file_name.value = CStr(currentFile & "." & currentExtension)
[LINE 50] top.mainFrm.IG1.IGView1.LoadFileVP CStr(subdir1 & currentFile & "." & currentExtension), "allnocolors"
[LINE 51] top.mainFrm.IG1.IGView1.SetHome CStr(subdir1 & currentFile & "." & currentExtension), "allnocolors"

Here's what I've tried to do. I have tried to set the focus to one of the other frames with top.header.myform.Diagrm.focus() (also tried parent. window. window.parent .frames(1) .frames("header") etc) I tried taking [LINE 47] out of LoadFile() and put it in its own function (still works identically the same as long as Msgbox is put between it and [LINE 49], tried swapping [LINE 49] and [LINE 50] around, and probably a couple of other things I can't remember.

So if you've run across this before, I would appreciate any help.

Let me know if you need more information, but keep in mind that everything works just great as long as Msgbox is in there. And for those of you who are thinking it, NO, I dont want to leave Msgbox in there! I dont want the user to have to click on an extra button for no reason.
 
If everything works out fine with a msgbox then perhaps that's your answer. The msgbox adds a delay between redefining the namespace (myFrame) and creating new objects within that namespace (myFrame.IG1).

You may want to code in a short delay between 47 and 49.

Beware, I could have completely missed the mark on this.

-Geates
 
Kudos to Geates!

You were right about requiring a short delay! After I change the frame source .htm, I inserted a .25 second delay BEFORE I tried to load the graphic data, and everything works. No need to keep msgbox() in the code anymore.

DelayFrameLoad() starts a 250 millisecond timer. After the timer is done, the first argument of window.setTimeout calls the function LoadFrameGraphics() that delets the timer (so it doesnt execute every 250ms), then it runs the code to load graphic data.

DelayFrameLoad() is inserted into the main code where my "graphic data load" code used to be.

For any interested, heres the code:

Sub DelayFrameLoad
idTimer = window.setTimeout("LoadFrameGraphics", 250, "VBScript")
End Sub

Sub LoadFrameGraphics
top.mainFrm.IG1.file_name.value = CStr(currentFile & "." & curExt1)
top.mainFrm.IG1.IGView1.LoadFileVP CStr(subDir1 & currentFile & "." & curExt1), "allnocolors"
top.mainFrm.IG1.IGView1.SetHome CStr(subDir1 & currentFile & "." & curExt1), "allnocolors"
top.mainFrm.IG2.file_name.value = CStr(currentFile & "." & curExt2)
top.mainFrm.IG2.IGView1.LoadFileVP CStr(subDir2 & currentFile & "." & curExt2), "allnocolors"
top.mainFrm.IG2.IGView1.SetHome CStr(subDir2 & currentFile & "." & curExt2), "allnocolors"
window.clearTimeout(idTimer)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top