Page 1 of 2 12>
Topic Options
#91000 - 2003-01-14 10:15 PM KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Why does KixForms lock when I execute $Forms.DoEvents on the second form created? Yes, I am using CreateObject("Kixtart.Forms") twice, because I have several secondary applications running off a logon script with its own form. I searched the BB, can't find much.
Top
#91001 - 2003-01-14 10:18 PM Re: KixForms DoEvents lock w/ mult forms
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Eh Chef , throw in a sample of you DoEvents loop !
_________________________



Top
#91002 - 2003-01-14 10:18 PM Re: KixForms DoEvents lock w/ mult forms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it's by design.
one form at a time can do events.
also drawing the forms is a "event"
_________________________
!

download KiXnet

Top
#91003 - 2003-01-14 10:19 PM Re: KixForms DoEvents lock w/ mult forms
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Chef, whats cooking ?

Like the Captain said, some code would help us out ... plus when you say locked - do mean disabled or just frozen somehow.

[ 14. January 2003, 22:20: Message edited by: Shawn ]

Top
#91004 - 2003-01-14 10:21 PM Re: KixForms DoEvents lock w/ mult forms
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I predict he named the forms variables the same !
_________________________



Top
#91005 - 2003-01-14 10:22 PM Re: KixForms DoEvents lock w/ mult forms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, now just spin the wheel!
_________________________
!

download KiXnet

Top
#91006 - 2003-01-14 10:25 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Ok, when I say locked, my $InvForm refuses to respond to events, and when it loses the focus, refuses to regain focus, despite several experiments with OnLostFocus = {procedure to resest focus} or {procedure to have windows switch app focus} or so on and so forth. The full code is pretty hefty, but here is the loop:

While $InvForm.Visible
? "Looping"
$=Execute($InvForm.DoEvents)
Loop

When run with the console, I get one line of "looping", then kix32.exe must be killed. I can't end the process.

exit 1

Top
#91007 - 2003-01-14 10:26 PM Re: KixForms DoEvents lock w/ mult forms
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
We'll need to complete code as you are working with multiple forms!
_________________________
There are two types of vessels, submarines and targets.

Top
#91008 - 2003-01-14 10:27 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Oh yeah, I checked all vars. They are all different. I forgot to mention that the first form never uses DoEvents, it is merely there to display information, and is static except for a progress bar that isnt updated in the script using DoEvents. The script functions fine independantly, but called from the original, it fails.
Top
#91009 - 2003-01-14 10:29 PM Re: KixForms DoEvents lock w/ mult forms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm...
if you want to get multiple "loopings" in console, use:
code:
While $InvForm.Visible
? "Looping"
$=Execute($InvForm.DoEvents(1))
Loop

_________________________
!

download KiXnet

Top
#91010 - 2003-01-14 10:33 PM Re: KixForms DoEvents lock w/ mult forms
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hmmm ... me thinx that this is the cause of your problem ... never tried that though , but just add a DoEvent Loop in the first forms script ... Maybe it helps
_________________________



Top
#91011 - 2003-01-14 10:33 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Let me get to work on getting you guys some code that reproduces the error. I would give you everything I have, but the code is 50+K of configuration, network management WMI, NAS settings and so on.. There are just too many IPs and server names for me to feel comfortable posting. I'll try to cut it down.
Top
#91012 - 2003-01-14 10:35 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Lonkero:

Tried the

While $InvForm.Visible
? "Looping"
$=Execute($InvForm.DoEvents(1))
Loop

Same problem. Thanks though.

Top
#91013 - 2003-01-14 10:35 PM Re: KixForms DoEvents lock w/ mult forms
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh Yeah ,
do what the Lonk supposes .. Asynchronous events (will get a bit on CPU Utilization , so don't use it by default if you don't have to )

Now I am curious to see the full picture (scripts)
_________________________



Top
#91014 - 2003-01-14 10:37 PM Re: KixForms DoEvents lock w/ mult forms
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Damnit ... thought that'd help ... How about adding a loop in the first script ?

(Let us see what you do by posting some Code !)
_________________________



Top
#91015 - 2003-01-14 10:54 PM Re: KixForms DoEvents lock w/ mult forms
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well like (I think) was already mentioned - the first form you create is called "the main parent form" and all subsequent forms are "child popup forms". When a child form is made visible, the main parent form is disabled for user input. When the child form is hidden (or destroyed) the parent form is re-enabled. This is all by design and it was meant to help control serialization in the script.

It doesn't "have" to be this way but it was just a design decision that was made early on.

-Shawn

Top
#91016 - 2003-01-14 11:45 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Ok folks, sorry this took so long, and I am happy that you are all so willing to help. Here's the code, I had to cut it up. You will need to bypass the InGroup line if you wish to execute. The first script runs:

$Count = 0
$ThreeTry = "false"
$GoodGUI = "false"

;====================KixForms.dll regsvr32 registration=============
; Creates the KixGUI desktop object if KixGUI.dll has already
;been registered. If not registered, attempts registration by copying
;KixGUI.dll to C:\ and running regsvr32 /s 3 times before failure.
;(Registration will likely fail unless user is local admin)

$FormRoot = CreateObject("Kixtart.Form")
If NOT @Serror = "The operation completed successfully."
Do
Copy "\\MyDCserver\netlogon\Kixforms.dll" "C:\temp\Kixforms.dll"
Shell "%comspec% /c regsvr32 /s C:\temp\Kixforms.dll"
$FormRoot = CreateObject("Kixtart.Form")

If @Serror = "The operation completed successfully."
$ThreeTry = "true"
$GoodGUI = "true"
EndIf

$Count = $Count + 1

If $Count > 3
$ThreeTry = "true"
EndIf
Until $ThreeTry = "true"
Else
$GoodGUI = "true"
EndIf

;======================KixForms form creation=======================
; Creates the form trees and 3 forms that are displayed. 2 static
;picture forms and one dynamic progressbar form

If $GoodGUI = "true"
$X = $FormRoot.Screen.Width
$Y = $FormRoot.Screen.Height
$FormRoot.Caption = "MyOrg Dialog"
$FormRoot.Width = 600
$FormRoot.Height = 150
$FormRoot.Location = 10,$Y-(($FormRoot.Height)+40)

$ProgressBar = $FormRoot.ProgressBar("",8, ($FormRoot.Height-40), ($FormRoot.Width-20), 10)

$Banner = $FormRoot.PictureBox
$Banner.Top = 4
$Banner.Left = 4
$Banner.Width = $FormRoot.Width-15
$Banner.Height = $FormRoot.Height-70
$Banner.BackColor = $FormRoot.RGB(255,255,255)

$BannerLabel1 = $Banner.Label("Welcome to the @domain domain.",80,6,$Banner.Width - 80,30)
$BannerLabel1.FontBold = 1
$BannerLabel1.FontSize = 12
$BannerLabel1.FontWeight = 800
$BannerLabel1.FontName = "Arial"

$BannerLabel2 = $Banner.Label("@FullName, authenticates to @LSERVER",80,26,$Banner.Width - 80,30)
$BannerLabel2.FontBold = 1
$BannerLabel2.FontSize = 8
$BannerLabel2.ForeColor = $FormRoot.RGB(0,130,30)
$BannerLabel2.FontName = "Arial"

$BannerLabel3 = $Banner.Label("Adapter @address using IP @IPADDRESS0",80,40,$Banner.Width - 80,30)
$BannerLabel3.FontBold = 1
$BannerLabel3.FontSize = 8
$BannerLabel3.ForeColor = $FormRoot.RGB(0,130,30)
$BannerLabel3.FontName = "Arial"

$BannerLabel4 = $Banner.Label("Please be patient while the script configures your computer...",80,54,$Banner.Width - 80,30)
$BannerLabel4.FontBold = 1
$BannerLabel4.FontSize = 8
$BannerLabel4.ForeColor = $FormRoot.RGB(0,130,30)
$BannerLabel4.FontName = "Arial"

$BannerInfocon = $Banner.Label("INFOCON " + $Infocon,440,56,$Banner.Width - 80,30)
$BannerInfocon.FontBold = 1
$BannerInfocon.FontSize = 12
$BannerInfocon.FontName = "Arial"

Select
Case $Infocon = "NORMAL"
$BannerInfocon.ForeColor = $FormRoot.RGB(0,0,0)

Case $Infocon = "ALPHA"
$BannerInfocon.ForeColor = $FormRoot.RGB(0,130,30)

Case $Infocon = "BRAVO"
$BannerInfocon.ForeColor = $FormRoot.RGB(255,255,0)

Case $Infocon = "CHARLIE"
$BannerInfocon.ForeColor = $FormRoot.RGB(255,140,28)

Case $Infocon = "DELTA"
$BannerInfocon.ForeColor = $FormRoot.RGB(255,0,0)
EndSelect

$Icon3 = $Banner.Image
$Icon3.Picture = "shell32.dll;16"
$Icon3.Top = 8
$Icon3.Left = 8
$Icon3.Height = 60
$Icon3.Width = $Icon3.Height

$FormRoot.Show

EndIf

If InGroup("IPMSinventory")
UpdateProgressBar(2,10,"Please inventory your computer",22,24)
If $GoodGUI = "true"
Call "C:\inventorytest.kix"
EndIf
UpdateProgressBar(10,10,"Thanks!",22,24)
EndIf

Exit 1

;=============================================================
Function UpdateProgressBar($CurrentBar, $TotalBar, $TextUpdate, $IconNumber, $IconScale)
If $GoodGUI ="true"
$ProgressBar.Min = 0
$ProgressBar.Max = $TotalBar
$ProgressBar.Value = $CurrentBar

$TaskLabel = $FormRoot.Label($TextUpdate, 40, $FormRoot.Height - 58, $FormRoot.Width - 40, 16)
$TaskLabel.FontBold = 1
$TaskLabel.FontSize = 8
$TaskLabel.FontName = "Arial"
If NOT $Icon
$Icon = $FormRoot.Image
EndIf
$Icon.Visible = 0
$Icon.Picture = "shell32.dll;" + $IconNumber
$Icon.Top = $FormRoot.Height - 66
$Icon.Left = 10
$Icon.Height = $IconScale
$Icon.Width = $IconScale
$Icon.Visible = 1

EndIf

EndFunction

======================================
======================================
======================================
And the second script that runs DoEvent follows, with the "On-click" calls with that dash so that the BB doesnt think its html. The ReturnFocus function was just for me to experiment... Watch out for the registry entry, I've remmed it out. Also, you will need to replace the "less than". This dern BB keeps thinking its a link. I know theres a way around that, but I am about to punch something and I dont care.

Break on

$SecondTry = 0
$ADPEinventoryDate = "011503"

If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyOrg","ADPEinventoryDate") = $ADPEinventoryDate
Quit
EndIf

$InvForm = CreateObject("Kixtart.Form")

$InvForm.Top = 100
$InvForm.Width = 400
$InvForm.Height = 180
$InvForm.Caption = "MyOrg Inventory"

$InvFrame = $InvForm.Frame
;$InvFrame.Caption = "Notice"
$InvFrame.Left = 10
$InvFrame.Top = 7
$InvFrame.Width = $InvForm.Width-26
$InvFrame.Height = 85

$InvLabelExplain = $InvFrame.Label
$InvLabelExplain.FontBold = 1
$InvLabelExplain.Caption = " The MyOrg requires your assistance to locate and inventory computer equipment. Please take a moment to enter the building number where this computer is located, and the last four characters of the barcode number on this computer's IPMS label."
$InvLabelExplain.Left = 10
$InvLabelExplain.Top = 12
$InvLabelExplain.Width = $InvFrame.Width - 20
$InvLabelExplain.Height = $InvFrame.Height - 20

$InvHelpLink = $InvForm.HyperLink
$InvHelpLink.Value = "\\dcserver\NETLOGON\InventoryHelper.doc"
$InvHelpLink.Caption = "Click here for help"
$InvHelpLink.Top = 95
$InvHelpLink.Left = 300
$InvHelpLink.Height = 20

$InvLabelBldg = $InvForm.Label
$InvLabelBldg.Caption = "Building Number:"
$InvLabelBldg.Top = 100
$InvLabelBldg.Left = 20

$InvBldgText = $InvForm.TextBox
$InvBldgText.Top = 98
$InvBldgText.Left = 145
$InvBldgText.Width = 50
$InvBldgText.Height = 18
$InvBldgText.Alignment = 2
$InvBldgText.OnChange = "CheckEntriesOnKey()"

$InvLabelIPMS = $InvForm.Label
$InvLabelIPMS.Caption = "IPMS Barcode Last Four:"
$InvLabelIPMS.Top = 125
$InvLabelIPMS.Left = 20

$InvIPMSText = $InvForm.TextBox
$InvIPMSText.SelLength = 4
$InvIPMSText.Top = 123
$InvIPMSText.Left = 145
$InvIPMSText.Width = 50
$InvIPMSText.Height = 18
$InvIPMSText.Alignment = 2
$InvIPMSText.OnChange = "CheckEntriesOnKey()"

$InvSubmitButton = $InvForm.Button
$InvSubmitButton.Default = 1
$InvSubmitButton.Caption = "Submit"
$InvSubmitButton.FontBold = 1
$InvSubmitButton.Left = 246
$InvSubmitButton.Top = 118
$InvSubmitButton.Height = 25
$InvSubmitButton.Width = 90
$InvSubmitButton.On_Click = "SubmitOn_Click()"

$InvForm.Show
$InvForm.Visible = 1
$InvBldgText.SetFocus
$InvForm.OnLostFocus = "ReturnFocus()"

While $InvForm.Visible
? "looping"
$=Execute($InvForm.DoEvents)
Loop

exit 1
;===============================================

Function CheckEntriesOnKey()

If Len($InvIPMSText.Text) > 4
$InvIPMSText.Text = SubStr($InvIPMSText.Text, 1, 4)
$InvIPMSText.SelStart = 4
$InvIPMSText.SetFocus
EndIf

If Len($InvBldgText.Text) > 5
$InvBldgText.Text = SubStr($InvBldgText.Text, 1, 5)
$InvBldgText.SelStart = 5
$InvBldgText.SetFocus
EndIf

EndFunction

;===============================================

Function SubmitOn_Click()

Select

Case Len($InvBldgText.Text) "less than(damn html)" 4
MessageBox("Please enter a valid value for Building number!" + Chr(13) + Chr(10) + "(the value must be at least 4 digits)","Hey!",48)
SendKeys("~{TAB}")
$InvBldgText.SetFocus

Case Len($InvIPMSText.Text) = 0
MessageBox("Please enter a value For IPMS Serial Last Four!" + Chr(13) + Chr(10) + "(the value must be 4 characters in length)","Hey!",48)
SendKeys("~{TAB}")
$InvIPMSText.SetFocus

Case 1
$WriteError = 0
$ComputerName = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName")
$WriteError = $WriteError + Open(1, "\\server2\IPMSinventory\IPMSinventory.txt", 5)
$WriteError = $WriteError + WriteLine(1, $ComputerName + ";" + $InvBldgText.Text + ";" + $InvIPMSText.Text + ";" + @userid + Chr(13) + Chr(10))
$WriteError = $WriteError + Close(1)

If NOT $WriteError
MessageBox("These damn messageboxes give me html errors on the BB.","Thanks!",64,3)
$InvForm.Visible = 0
;WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Site","ADPEinventoryDate",$ADPEinventoryDate,"REG_SZ")
Else
If $SecondTry
$InvForm.Visible = 0
MessageBox("Network or file operation problems are preventing your computer from logging this information. Please try again at your next logon. If this problem persists, call the MyOrg Helpdesk at xxx-xxx","Error",16)
Else
MessageBox("The information you have provided was not logged. Please resubmit your building and IPMS information.","Submit Error",48,10)
SendKeys("~{TAB}")
EndIf
$SecondTry = "true"

EndIf
EndSelect

EndFunction

;===================================================

Function ReturnFocus()

$InvForm.SetFocus
$InvBldgText.SetFocus

EndFunction

Top
#91017 - 2003-01-14 11:47 PM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
Oh yeah, sorry about the KixGUI.dll remarks.. forgot to change that. Ma bad, Im lazy!
Top
#91018 - 2003-01-15 12:39 AM Re: KixForms DoEvents lock w/ mult forms
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, what part is failing?
I ran the second script with 4.12 and 4.20 beta

no problems what so ever.
anyway, as you have the looping there, it makes the setfocus cry and runs cpu usage to 100%

when took of that "looping" line, it ran just fine.
_________________________
!

download KiXnet

Top
#91019 - 2003-01-15 12:48 AM Re: KixForms DoEvents lock w/ mult forms
The Chef Offline
Fresh Scripter

Registered: 2003-01-08
Posts: 23
Loc: New Jersey
see, the problem is when the original script calls the second script. Thats what I have been trying to tell you. No, the CPU usage does not go to 100%, I am not sure what you think is going on, but the script (when run alone, and works) sits in the loop for a single event, and then loops.

The second script works fine on its own.

Top
Page 1 of 2 12>


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.073 seconds in which 0.028 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org