KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

need help with ShowDialog, ShowModal (kf2.46)

 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
Dann Cox
KiXforms Novice
KiXforms Novice


Joined: 09 Jun 2003
Posts: 4
Location: Nanaimo, BC, Canada

PostPosted: Fri Jun 13, 2008 10:58 pm    Post subject: need help with ShowDialog, ShowModal (kf2.46) Reply with quote

I am trying to create a custom dialog. When I call it with either of these methods, I get a fatal exception error. Not at all certain I'm doing anything right. Confused
Dialog is setup in another script like any other form, except that the event loop is commented out. From the main script:
Code:
Function Load_IP_Dialog()
   If Not $IP_Dialog_Loaded = True
      Call @SCRIPTDIR + "\IP_Dialog.kix"
   EndIf
   $Load_IP_Dialog = $frmIPDialog.ShowModal()
   While $frmIPDialog.Visible
      $ = Execute($System.Application.DoEvents)
   Loop
EndFunction

_________________
Dann Cox, Infrastructure Administrator,
School District 68 (Nanaimo-Ladysmith)
Nanaimo, BC, Canada
(250) 741-5270
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jun 17, 2008 2:43 pm    Post subject: Reply with quote

Hi Dann,

Is there anyway you can condense your code into a small stand-alone example that we can use to reproduce this issue ? Its kinda tough to diagnose things with seeing everything in context.

In the meanwhile, will try reproducing ...

-Shawn
Back to top
View user's profile Send private message
Dann Cox
KiXforms Novice
KiXforms Novice


Joined: 09 Jun 2003
Posts: 4
Location: Nanaimo, BC, Canada

PostPosted: Tue Jun 17, 2008 5:52 pm    Post subject: stripped down sample code Reply with quote

I have retained the original dialog form, but stripped most of the controls and all the comments, regions, etc. I created a versy simple test form to call it, with two buttons. One executes the "normal" show method, the other the show modal method.
test (parent) form:
Code:
Break On
$System = CreateObject("KiXtart.System")

;~~< frmTEST_MAIN >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$frmTEST_MAIN = $System.Form()
$frmTEST_MAIN.Size = 300, 134
$frmTEST_MAIN.Text = "TEST FORM"
;~~< btnTESTnormal >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$btnTESTnormal = $frmTEST_MAIN.Controls.Button()
$btnTESTnormal.Size = 100,27
$btnTESTnormal.Text = "TEST normal"
$btnTESTnormal.Location = 25,23
$btnTestnormal.OnClick = "Load_IP_Dialog(0)"
;~~< btnTESTmodal >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$btnTESTmodal = $frmTEST_MAIN.Controls.Button()
$btnTESTmodal.Size = 100, 27
$btnTESTmodal.Text = "TEST MODAL"
$btnTESTmodal.Location = 150,23
$btnTestmodal.OnClick = "Load_IP_Dialog(1)"

$frmTEST_MAIN.Show
While $frmTEST_MAIN.Visible
   $=Execute($System.Application.DoEvents)
Loop

Function Load_IP_Dialog($Mode)
If Not $IP_Dialog_Loaded = True
   Call @SCRIPTDIR + "\IP_testDialog.kix"
   EndIf
   If $Mode = 0
      $frmIPDialog.Show
   Else   
      $Load_IP_Dialog = $frmIPDialog.ShowModal()
   EndIf   
   While $frmIPDialog.Visible
      $ = Execute($System.Application.DoEvents)
   Loop
EndFunction


IP Dialog (child) form:
Code:
Break On
;$System = CreateObject("KiXtart.System")

;~~< frmIPDialog >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$frmIPDialog = $System.Form()
$frmIPDialog.Size = 476, 235
$frmIPDialog.Text = "IP Information"
$frmIPDialog.ControlBox = 0
$frmIPDialog.StartPosition = 4
$frmIPDialog.FormBorderStyle = 3
;~~< btnCancel >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$btnCancel = $frmIPDialog.Controls.Button()
$btnCancel.Size = 60, 22
$btnCancel.Text = "Cancel"
$btnCancel.Location = 12, 175
$btnCancel.DialogResult = 2
$btnCancel.Cancel = True
;~~< pnlIP >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$pnlIP = $frmIPDialog.Controls.Panel()
$pnlIP.Size = 443, 107
$pnlIP.BorderStyle = 1
$pnlIP.Location = 12,62
$pnlIP.Backcolor = "LightSteelBlue"
;~~< lblName >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$lblName = $pnlIP.Controls.Label()
$lblName.TextAlign = 256
$lblName.Size = 65, 18
$lblName.Text = "Name"
$lblName.Location = 9, 1
;~~< txtName >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$txtName = $pnlIP.Controls.TextBox()
$txtName.Size = 175, 21
$txtName.Font = $System.Font("Microsoft Sans Serif",9.0,0)
$txtName.Location = 8, 24

Global $IP_Dialog_Loaded
$IP_Dialog_Loaded = True
$txtName.SetFocus

;$frmIPDialog.Show
;While $frmIPDialog.Visible
;   $=Execute($System.Application.DoEvents)
;Loop

_________________
Dann Cox, Infrastructure Administrator,
School District 68 (Nanaimo-Ladysmith)
Nanaimo, BC, Canada
(250) 741-5270
Back to top
View user's profile Send private message Send e-mail
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Tue Jun 17, 2008 9:48 pm    Post subject: Reply with quote

While Shawn reproduces... Oi matey, does Lori know?? Shocked


Umm, Dann, the condensed code you posted does exactly what you try to accomplish, at least it does on my box.
I saved the second part as .\IP_testDialog.kix and ran the main part. Apart from the fact that this could be easier accomplished wthin one single script, it works as announced (Modal and 'Normal')

My setup: XP SP2, wkix32 4.60, kf.classic 2.47.4.0

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Dann Cox
KiXforms Novice
KiXforms Novice


Joined: 09 Jun 2003
Posts: 4
Location: Nanaimo, BC, Canada

PostPosted: Wed Jun 18, 2008 12:57 am    Post subject: Problem found? Reply with quote

Jochen,
Thanks for taking your time to try this. I have found the problem. I noticed you were using wkix32.exe. I usually use kix32.exe in the ASE Editor because it seems to work better for debugging. I changed to wkix32.exe and the problem disappeared. I never thought to try that... Would you mind trying it with kix32.exe to see if you can confirm my finding?
I've just noticed that I get a fatal exception error calling the ShowModal or ShowDialog methods if a console window is open; i.e. debug is on. This seems quite consistent.

My setup is Windows server 2008, wkix32 4.60, kf.classic 2.46.55.0. The latter is the version installed with the latest version of the ASE Editor. I don't see 2.47 on kixforms.org?

BTW, I have the dialog form in a separate script while developing it so that I can pop it back into the Scriptform designer if needs be. In the final version I would paste it into the main module.

_________________
Dann Cox, Infrastructure Administrator,
School District 68 (Nanaimo-Ladysmith)
Nanaimo, BC, Canada
(250) 741-5270
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jun 19, 2008 2:31 pm    Post subject: Reply with quote

Dann, can you try testing this with Kix 4.53 as well. 4.60 has some COM issues.

-Shawn
Back to top
View user's profile Send private message
Dann Cox
KiXforms Novice
KiXforms Novice


Joined: 09 Jun 2003
Posts: 4
Location: Nanaimo, BC, Canada

PostPosted: Thu Jun 19, 2008 5:21 pm    Post subject: testing with KiX 4.53 Reply with quote

Using Kix32.exe, 4.53, if the "Command Window Stays open" option is turned on, the code works. If it is turned off, clicking the Test Modal button immediately kills the program, no error message at all.
Using wkix32.exe, 4.53, the program works regardless of the command window setting.

I see the following in the event log:
Quote:
The description for Event ID 5 from source KIXTART cannot be found........

Fatal exception occurred.
Error : (0xc0000005/-1073741819)

_________________
Dann Cox, Infrastructure Administrator,
School District 68 (Nanaimo-Ladysmith)
Nanaimo, BC, Canada
(250) 741-5270
Back to top
View user's profile Send private message Send e-mail
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Sat Jun 21, 2008 9:23 am    Post subject: Reply with quote

Dann, the 2.4.7.x versions are not to be found on the download links page because they are not yet released ... there is a topic in the announcements forum with the a link to the latest 'beta' release...

If I were you, I would first unregister kixforms.dll with regsvr32 -u [path\]kixforms.dll and then reregister (without the u parameter)
There might be an older release of kixforms registered on your machines where the method (.ShowModal) you use was unknown.
If it still fails, try the latest release mentioned above (as a rule of thumb: Always re-register kixforms)
If it fails still: try wkix 4.53


Oh, I see you have a working constellation... Hmmm, I never used kix32.exe for forms scripts, always wkix32.exe so I have no experience with this kind of behaviour Wink
It is anyways considered best practice to use the console-less version of KiXtart for forms scripts ...

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group