Mike72677
(Fresh Scripter)
2004-11-26 07:36 PM
Kixform InputBox Cancel Button

I have a simple Kixform InputBox that I can't get to work right. The box has an OK and cancel button and a box where you can type in. If you leave the text box blank and click OK, I want it to prompt you to enter a name to continue and then loop. (I have that part working). But if you click Cancel, I want the script to just end. What code do I need to get the cancel button to work? Thanks!! Here's that part of my script.

Code:
  
break on
$=setconsole("hide")

:top
$FORM = CREATEOBJECT("Kixtart.FORM")

$Name = $Form.InputBox("Enter name:", "User & PC Finder","")

IF $NAME = ""
MESSAGEBOX ("You MUST Enter A Name In To Continue", "No Name Entered", 16)
GOTO TOP
ENDIF



ShawnAdministrator
(KiX Supporter)
2004-11-26 08:03 PM
Re: Kixform InputBox Cancel Button

There is no way to tell if the user entered a blank value versus hitting the cancel button - what version of Kixforms you running ?

Mike72677
(Fresh Scripter)
2004-11-26 08:23 PM
Re: Kixform InputBox Cancel Button

I seen an older post with this in it:

Code:
  
$ButtonCancel = $FormQuestion.Button('Cancel', $ButtonOK.Right + 10, $TextBoxAnswer.Bottom + 5, 40, 16)
$ButtonCancel.Cancel = 1
$ButtonCancel.OnClick = 'GOSUB ButtonCancel_Click'



But wasn't sure how/if it worked. My kixfroms.dll is showing version 2.2.0.37. Thanks!


ShawnAdministrator
(KiX Supporter)
2004-11-26 10:24 PM
Re: Kixform InputBox Cancel Button

The example you provided is/was from a custom hand-jobbed form, where you have to do all the work in building/driving the form. InputBox is a simpler/canned form and is easier to use. For what your doing, I would suggest sticking with InputBox. Question becomes how does one trap the cancel button ... hmmmm ...

If your willing to upgrade to the latest DEV build of Kixforms ... can "fix" this up for you...


Mike72677
(Fresh Scripter)
2004-11-26 10:33 PM
Re: Kixform InputBox Cancel Button

What do I need to do to my script if I upgrade to the current version of Kixforms?

ShawnAdministrator
(KiX Supporter)
2004-11-26 10:36 PM
Re: Kixform InputBox Cancel Button

Probably nothing ... but give the build a try ... here it is ...

Kixforms Development Build

Let me know if your script looks/behaves the same, if so - we can talk.


Mike72677
(Fresh Scripter)
2004-11-26 10:39 PM
Re: Kixform InputBox Cancel Button

Same thing. The only way to get out of the script is to type in something and click OK. Even typing something in and clicking Cancel just loops the script.

ShawnAdministrator
(KiX Supporter)
2004-11-26 10:53 PM
Re: Kixform InputBox Cancel Button

ja, you should be getting the same thing ... i'm going to enhance the development build to support detecting the cancel button, it means that you will have to do things a little different though ... but this is something i've been meaning to do for a while now, you just prompted me to actually go do it ....

Will post a new build tonight hopefully ... stay tuned (if you can) ...



Mike72677
(Fresh Scripter)
2004-11-26 11:04 PM
Re: Kixform InputBox Cancel Button

I'll be waiting! Thanks!!

ShawnAdministrator
(KiX Supporter)
2004-11-26 11:06 PM
Re: Kixform InputBox Cancel Button

don't go anywhere ... its done ... let me repost the build (5 minutes) then write a little sample script (10 minutes), be back in 15 minutes ...

-Shawn


ShawnAdministrator
(KiX Supporter)
2004-11-26 11:19 PM
Re: Kixform InputBox Cancel Button

Ok, download the latest DEV build again (should be special build 6), and try this script ... it uses the InputBox object, and something called the "DialogResult" property, which is documented in the old CHM ... here's the script ...

Code:

Break On

$System = CreateObject("Kixtart.System")

$InputBox = $System.InputBox()

:TOP

$Name = $InputBox.Show("Enter name:", "User & PC Finder","")

If $InputBox.DialogResult = 2 ; Cancel
?"Quiting..."
Quit
Endif

If $Name = ""
$= MESSAGEBOX ("You MUST Enter A Name In To Continue", "No Name Entered", 16)
GOTO TOP
Endif

?"Name = " $Name

Exit 0



Let me know if you have any questions ...

-Shawn


Mike72677
(Fresh Scripter)
2004-11-26 11:30 PM
Re: Kixform InputBox Cancel Button

Script error : unknown command !
$InputBox = $System.InputBox()

I got the latest build (2.4.0.46) Or do I not have the latest build?


ShawnAdministrator
(KiX Supporter)
2004-11-26 11:45 PM
Re: Kixform InputBox Cancel Button

What does this script give you ?

Break On

$Form = CreateObject("Kixtart.Form")

?"Build=" $Form.Build

Exit 0

-Shawn


Mike72677
(Fresh Scripter)
2004-11-26 11:48 PM
Re: Kixform InputBox Cancel Button

Build=46

ShawnAdministrator
(KiX Supporter)
2004-11-26 11:56 PM
Re: Kixform InputBox Cancel Button

Scratching my head over this one. Can you do two things ...

1) Search your entire hard drive for instances of kixforms.dll, look to see how many you got kicking around ...

2) Go to the folder that has the latest build (look at the DLL properties and look for Special Build = 6), then re-register the dll, making sure to provide the fully qualified path to the DLL on the command-line ...



ShawnAdministrator
(KiX Supporter)
2004-11-27 12:00 AM
Re: Kixform InputBox Cancel Button

Wait a sec, think i posted the wrong version of the DLL, try downloading the DEV build again and try again ...

Sorry about that ...

-Shawn


Mike72677
(Fresh Scripter)
2004-11-27 12:02 AM
Re: Kixform InputBox Cancel Button

Reregistering the DLL appears to have fixed it! Cancel works GREAT now! Thanks!! All is well now for me! Works GREAT!!

NTDOCAdministrator
(KiX Master)
2004-11-27 12:52 AM
Re: Kixform InputBox Cancel Button

I would recommend always making sure users do the following before other trouble shooting methods.

regsvr32 /u kixforms.dll

Then delete old kixforms.dll then copy new one into %windir%\system32 (excluding Windows 9x)

Then run

regsvr32 kixforms.dll

Then run new scripts

p.s. What's with the GOTO


Les
(KiX Master)
2004-11-27 01:16 AM
Re: Kixform InputBox Cancel Button

...and QUIT without a parm? tsk, tsk

"Quitting..."?
Quit 0


ShawnAdministrator
(KiX Supporter)
2004-11-27 03:04 AM
Re: Kixform InputBox Cancel Button

you boys are really ream'n the old man tonight ;0)

Les
(KiX Master)
2004-11-27 03:40 AM
Re: Kixform InputBox Cancel Button

old man huh? pfft!

I think DOC is older than you and I know I am way older than DOC!


AllenAdministrator
(KiX Supporter)
2004-11-27 04:21 AM
Re: Kixform InputBox Cancel Button

Shawn, looking through your example script I noticed that you used the inputbox like this:

Code:
$InputBox = $System.InputBox()
$RemotePC = $InputBox.Show("Enter Remote PC Name","Remote",$lastremotepc)



In one of my scripts I used the following:
Code:
$remotepc=$form.inputbox("Enter Remote PC Name","Remote",$lastremotepc)  




It been a long time since I wrote this particular script... has the syntax changed in KFs or is KFs forgiving and this was not correct to start with?



ShawnAdministrator
(KiX Supporter)
2004-11-27 05:53 AM
Re: Kixform InputBox Cancel Button

They're both correct. The first version (your version) was the first InputBox that was done - and it emulates the VB one. The second one is a more "object-oriented" version of InputBox - afaik no other language or library has an InputBox quite like this one ... it allows you to specify and capture information not other-wise availble, like the dialogresult. Was meaning to have some other properties as well (like title and default), might do them this weekend.