Page 1 of 2 12>
Topic Options
#89953 - 2002-11-28 09:02 PM KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
I'm a little unclear how to syntax the "cancel" button so that it, obviously cancels but also closes the current form window.

My main form has a couple of buttons, when you select one it opens a new window with some selecting options. (Which I'm still working on) Of course I want a cancel button, and for it to work. I know I need an if statement to cancel out of the loop, but I'm not sure how to syntax this portion.

Here's the section of code:
code:
Function cmdGet_List()
Dim $Wait
$Wait = CreateObject("Kixtart.FORM")
$Wait.CAPTION = "Select a Target"
$Wait.SCALEWIDTH = 200
$Wait.SCALEHEIGHT = 250
$Wait.FONTSIZE = 12
$Wait.FONTNAME = "Arial"
$Wait.PrintXY(20,20,"Select Computer Type")
$Wait.CENTER

$Corporate = $Wait.OptionButton
$Corporate.FONTSIZE = 11
$Corporate.FONTNAME = "Arial"
$Corporate.Caption = "Corporate"
$Corporate.Left = 45
$Corporate.Top = 50
$Corporate.Width = 100
$Corporate.Height = 25

$Stores = $Wait.OptionButton
$Stores.Caption = "Stores"
$Stores.Left = 45
$Stores.Top = 80
$Stores.Width = 100
$Stores.Height = 25

$All = $Wait.OptionButton
$All.Caption = "All Units"
$All.Left = 45
$All.Top = 110
$All.Width = 100
$All.Height = 25

$Failed = $Wait.OptionButton
$Failed.Caption = "Failed List"
$Failed.Left = 45
$Failed.Top = 140
$Failed.Width = 130
$Failed.Height = 25

$Button2 = $Wait.CommandButton("Ok")
$Button2.Left = 25
$Button2.Top = 205
$Button2.Width = 50
$Button2.Height = 25

$Button3 = $Wait.CommandButton("Cancel")
$Button3.Left = 105
$Button3.Top = 205
$Button3.Width = 75
$Button3.Height = 25
$Button3.OnClick = 0

$Wait.Show
$FORM.Refresh
While $Wait.Visible
$=Execute($Wait.DoEvents)
Loop
EndFunction

Any Suggestions? [Big Grin] [Big Grin]
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89954 - 2002-11-28 10:08 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi ArchAngle,

Number of ways to do this, tell you how I usually implement it. I leverage the TAG property that every object has - its a general-purpose, user-definable variant that you can use to store numbers and strings - in this instance, we will store a flag in the WAIT form tag that gets set depending on which button was clicked. Then we can build that flag into the DoEvents loop. Plus, using this strategy, one can check to see what button was click ... heres your code with the slight modifications:

code:
break on cls

cmdGet_List()

exit

Function cmdGet_List()

Dim $Wait

$Wait = CreateObject("Kixtart.FORM")
$Wait.CAPTION = "Select a Target"
$Wait.SCALEWIDTH = 200
$Wait.SCALEHEIGHT = 250
$Wait.FONTSIZE = 12
$Wait.FONTNAME = "Arial"
$Wait.PrintXY(20,20,"Select Computer Type")
$Wait.CENTER

$Corporate = $Wait.OptionButton
$Corporate.FONTSIZE = 11
$Corporate.FONTNAME = "Arial"
$Corporate.Caption = "Corporate"
$Corporate.Left = 45
$Corporate.Top = 50
$Corporate.Width = 100
$Corporate.Height = 25

$Stores = $Wait.OptionButton
$Stores.Caption = "Stores"
$Stores.Left = 45
$Stores.Top = 80
$Stores.Width = 100
$Stores.Height = 25

$All = $Wait.OptionButton
$All.Caption = "All Units"
$All.Left = 45
$All.Top = 110
$All.Width = 100
$All.Height = 25

$Failed = $Wait.OptionButton
$Failed.Caption = "Failed List"
$Failed.Left = 45
$Failed.Top = 140
$Failed.Width = 130
$Failed.Height = 25

$Button2 = $Wait.CommandButton("Ok")
$Button2.Left = 25
$Button2.Top = 205
$Button2.Width = 50
$Button2.Height = 25
$Button2.OnClick = "$$Wait.Tag=1" ; <--- here

$Button3 = $Wait.CommandButton("Cancel")
$Button3.Left = 105
$Button3.Top = 205
$Button3.Width = 75
$Button3.Height = 25
$Button3.OnClick = 0
$Button3.OnClick = "$$Wait.Tag=2" ; <--- and here

$Wait.Tag = 0 ; <--- here
$Wait.Show
$FORM.Refresh

While $Wait.Visible And Not $Wait.Tag ; <--- here
$=Execute($Wait.DoEvents)
Loop

If $Wait.Tag = 1
?"OK CLICKED"
EndIf

EndFunction

hope this helps.

-Shawn

[ 28. November 2002, 22:10: Message edited by: Shawn ]

Top
#89955 - 2002-11-28 10:14 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
One comment - since your DIMming the WAIT form local to the UDF (good idea) ... make sure to also DIM every other control that you use in the form ...
Top
#89956 - 2002-11-28 10:28 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
To get back to your original question re: closing the form - you might notice that there is NO explicit statement in the UDF that closes the form.

Because you have declared the FORM local to the UDF, it automatically closes when the $WAIT variable goes out of scope, and gets closed when the form is disposed.

-Shawn

[ 28. November 2002, 22:29: Message edited by: Shawn ]

Top
#89957 - 2002-11-29 01:37 AM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Ok, so I made the modifications you gave and now when I first click the button the second button disapears from the main form and it fails to return. Am I going to need to "DIM" the buttons too?

[ 29. November 2002, 02:10: Message edited by: ArchAngel96 ]
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89958 - 2002-11-29 02:19 AM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Theres no way I can tell without seeing all your code ... sounds to me like you got two controls with the same name ...
Top
#89959 - 2002-11-29 09:06 PM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Ok, do Dim'ing the buttons fixed the disappearing act. But I realised I got a little ahead of myself. My second window has radio buttons with the ok button. I want the combination of the radio button AND the ok button to perform a function. I've looked at the Kixforms page for a few hours and tried my own variations, but I don't seem to know what I'm doing on this one... Any one have any suggestions for me?
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89960 - 2002-11-29 09:09 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
easy [Wink]

nope, seriously... (<- something impossible for me)

anyway, what you want to check?
if user has selected a radiobutton, or if the radiobutton of initialization selection is different than currently selected?
_________________________
!

download KiXnet

Top
#89961 - 2002-11-29 09:09 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You mean processing like:

"If the OK button was click then check the RadioButtons - if RadioButton1 was click then do this, else if RadioButton2 was clicked then do something else..."

Kinda like that ?

Top
#89962 - 2002-11-29 09:12 PM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
There are 4 radio buttons on the "page". So what I want is the ability to click one, correct myself and click a different one, then hit the ok button to perform the function. I know, this is a little more like wishfull thinking, but I could try, right?

What I'm thinking now as I revisit this, is to set $$X=1, $$X=2, and so one and then do an if statement, based on this formula. But I'm wondering if this is correct.

[ 29. November 2002, 21:15: Message edited by: ArchAngel96 ]
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89963 - 2002-11-29 09:15 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh?
what you mean with that correct?
aren't allways able to change it until you click something which disables further changes, like ok-button which also hides the page...
_________________________
!

download KiXnet

Top
#89964 - 2002-11-29 09:16 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Sounds like maybe your attaching events to the RadioButtons, when what you might want to do is just check for the OK button click - then use the VALUE property of each RadioButton (maybe in a CASE statement) to perform the desired action, after the OK button has been clicked.

[edit]

RadioButtons in a case statement should work becuse each one is mutually exclusive.

[ 29. November 2002, 21:17: Message edited by: Shawn ]

Top
#89965 - 2002-11-29 09:32 PM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Does this seem right? (Its kinda hard to test me script since I'm home and its for work...)

code:
"OptionButton3".Onclick = "$x=3

If $Wait.Tag = 1
Goto cmdList()
EndIf

EndFunction

Function cmdList()

$temp = "%temp%\netview.tmp"
$list = "%temp%\list.tmp"

Shell '%comspec% /c net view >"$temp"'

Select
Case $x=1
;--------------------------------
; For all systems
;--------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,4) = "\\S0" OR $line AND SubStr($line,1,3) = "\\W" OR $line AND SubStr($line,1,3) = "\\L"
$hostname=SubStr($line,3,InStr($line," ")-1)
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=2
;-------------------------------------
; if statement for S'
;-------------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,4) = "\\S0"
$hostname=SubStr($line,3,InStr($line," ")-1)
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=3
;-----------------------------------
; if statement for Corporate
;-----------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,3) = "\\W" OR $line AND SubStr($line,1,3) = "\\L"
$hostname=SubStr($line,3,InStr($line," ")-1)
?"hostname=" $hostname
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=4
;---------------------------------
; use the failed list to run the
; inventory against.
;---------------------------------




EndFunction

_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89966 - 2002-11-29 09:39 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
as a quick reply, it seems that from the first line on, your lines and wrong...

if you put something in the event string "" you need to double the $-sign, otherwise it gets just printed to console window.

in this case, it seems easiest the way shawn said before.

remove the events from the radiobuttons and place one in ok-button.
code:
$ok_button.onclick="ok_clicked()"

then place a function at the bottom of the script file:
code:
function ok_clicked()
select
case $optionbutton1.value
;do something
case $optionbutton2.value
;do something
case $optionbutton3.value
;do something
case 1
$=messagebox("You must select a value!","ERROR",20) exit 1 ;exits the function
endselect
$form.hide
endfunction

_________________________
!

download KiXnet

Top
#89967 - 2002-11-29 09:50 PM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Ok, then I'm defiantely not clear on the "$Option1.Value". Does this actually have a value other than 1 and 0? I tried using value lastnight and it definately didn't work, at least for what I did... If you look at the top section I have $All, $Stores, $Corporate and $Failed. I'm assuming that I'm setting "$All.Value = 1", "$Corportate = 1" based on your last post. then in the case area I'm setting
code:
function ok_clicked()
select
case $Corporate.value
;do something
case $Stores.value
;do something
case $All.value
;do something
case $Failed.value
;do something
case 1 $=messagebox("You must select a value!","ERROR",20) exit 1 ;exits the function
endselect
$form.hide
endfunction

Is this assumtion correct?
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89968 - 2002-11-29 10:00 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, doesn't your script look just the same as mine?

if some control can have only 1 or 0 that most likely is a control for selecting.
and isn't that what you are after?

is there a problem with that?

you could post your current total code and tell what is missing from there...

anyway, hope that I'm not messing your head... here just to help.
_________________________
!

download KiXnet

Top
#89969 - 2002-11-29 10:06 PM Re: KixForms and the Cancel button
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
This is what I have so far. If you look at all my posts, you'll see what all I'm trying to do with this little wanna be "program". As far as looking like your's, not sure but I've used others work as examples for what it is that I'm trying to accomplish. I appologise if I'm stepping on anyone's "toes". I'm really just trying to teach myself kix and kixforms by doing this little exercise.

code:
Break On
Dim $Intro
Dim $Button2, $Button1
$x = 0

$Intro = CreateObject("Kixtart.Form")
$Intro.Icon = "SHELL32.DLL;19"

$Intro.Caption = "Hardware Inventory"
$Intro.SCALEHEIGHT = 402
$Intro.SCALEWIDTH = 600
$Intro.FONTNAME = "Arial"
$Intro.FONTSIZE = 9
$Intro.CENTER

$fraBanner = $Intro.PictureBox
$fraBanner.BACKCOLOR = $Intro.RGB(255,255,255)
$fraBanner.HEIGHT = 70
$fraBanner.Left = 10
$fraBanner.TOP = 10
$fraBanner.WIDTH = 585

$picBanner = $fraBanner.Image
$picBanner.Picture = "shell32.dll;16"
$picBanner.HEIGHT = 60
$picBanner.Left = 5
$picBanner.TOP = 5
$picBanner.WIDTH = 60

; Draw on the banner

$fraBanner.FONTSIZE = 12
$fraBanner.FONTNAME = "verdana"
$fraBanner.ForeColor = 0
$fraBanner.PrintXY(70,0,"This program is used to conduct a hardware inventory on")
$fraBanner.PrintXY(70,15,"the selected computers within the domain via remote.")
$fraBanner.PrintXY(70,30,"The information is retrieved with the use of WMI.")
$fraBanner.FONTBOLD = 1
$fraBanner.FONTSIZE = 10
$fraBanner.ForeColor = $Intro.RGB(0,100,100)
$fraBanner.PrintXY(73,46,"Powered by KiX v@KIX AND Kixforms v"+$Form.Version)
$fraBanner.FONTBOLD = 0
$fraBanner.FONTSIZE = 10

$Button1 = $Intro.CommandButton("Get List")
$Button1.FontSize = 12
$Button1.Left = 25
$Button1.Top = 115
$Button1.Width = 100
$Button1.Height = 25
$Button1.OnClick = "cmdGet_List()"

$fraGetList = $Intro.Frame("Details")
$fraGetList.HEIGHT = 75
$fraGetList.Left = 135
$fraGetList.TOP = 85
$fraGetList.WIDTH = 435

$Intro.FONTSIZE = 12
$Intro.FONTNAME = "verdana"
$Intro.ForeColor = 0
$Intro.PrintXY(145,101,"This will get a list of computers on the current ")
$Intro.PrintXY(145,117,"domain. The search paramiters for this search will ")
$Intro.PrintXY(145,135,"be: All, Corporate or Store Machines.")

$Button2 = $Intro.CommandButton("Get" + Chr(13)
+ Chr(10) + "Inventory")
$Button2.MultiLine = 1
$Button2.FONTNAME = "verdana"
$Button2.FontSize = 12
$Button2.Left = 25
$Button2.Top = 200
$Button2.Width = 100
$Button2.Height = 50


$Intro.FONTNAME = "Arial"
$Intro.FONTSIZE = 9
$fraGetInvent = $Intro.Frame("Details")
$fraGetInvent.HEIGHT = 75
$fraGetInvent.Left = 135
$fraGetInvent.TOP = 185
$fraGetInvent.WIDTH = 435

$Intro.FONTSIZE = 11
$Intro.FONTNAME = "verdana"
$Intro.ForeColor = 0
$Intro.PrintXY(145,200,"Use the selected list to conduct a hardware inventory.")
$Intro.PrintXY(145,216,"The inventory will get model type and hardware info ")
$Intro.PrintXY(145,235,"and port the data to a CSV file on DC01")

$ButtonExit = $Intro.CommandButton("Exit")
$ButtonExit.FONTNAME = "Arial"
$ButtonExit.FONTSIZE = 10
$ButtonExit.FONTBOLD = 1
$ButtonExit.TOP = 367
$ButtonExit.WIDTH = 129
$ButtonExit.HEIGHT = 23
$ButtonExit.Left = 445
$ButtonExit.OnClick = "quit()"

$Intro.Show
While $Intro.Visible
$=Execute($Intro.DoEvents)
Loop

Exit 1

Function cmdGet_List()

Dim $Wait

$Wait = CreateObject("Kixtart.FORM")
$Wait.CAPTION = "Select a Target"
$Wait.SCALEWIDTH = 200
$Wait.SCALEHEIGHT = 250
$Wait.FONTSIZE = 12
$Wait.FONTNAME = "Arial"
$Wait.PrintXY(20,20,"Select Computer Type")
$Wait.CENTER

$Corporate = $Wait.OptionButton
$Corporate.FONTSIZE = 11
$Corporate.FONTNAME = "Arial"
$Corporate.Caption = "Corporate"
$Corporate.Left = 45
$Corporate.Top = 50
$Corporate.Width = 100
$Corporate.Height = 25
$Corporate.OnClick = "$$x=1"

$Stores = $Wait.OptionButton
$Stores.Caption = "Stores"
$Stores.Left = 45
$Stores.Top = 80
$Stores.Width = 100
$Stores.Height = 25
$Stores.OnClick = "$$x=2"

$All = $Wait.OptionButton
$All.Caption = "All Units"
$All.Left = 45
$All.Top = 110
$All.Width = 100
$All.Height = 25
$All.OnClick = "$$x=3"


$Failed = $Wait.OptionButton
$Failed.Caption = "Failed List"
$Failed.Left = 45
$Failed.Top = 140
$Failed.Width = 130
$Failed.Height = 25
$Failed.OnClick = "$$x=4"

$Button2 = $Wait.CommandButton("Ok")
$Button2.Left = 25
$Button2.Top = 205
$Button2.Width = 50
$Button2.Height = 25
$Button2.OnClick = "$$Wait.Tag=1" ; <--- here

$Button3 = $Wait.CommandButton("Cancel")
$Button3.Left = 105
$Button3.Top = 205
$Button3.Width = 75
$Button3.Height = 25
$Button3.OnClick = 0
$Button3.OnClick = "$$Wait.Tag=2" ; <--- and here

$Wait.Tag = 0 ; <--- here
$Wait.Show
$Wait.Refresh

While $Wait.Visible AND NOT $Wait.Tag ; <--- here
$=Execute($Wait.DoEvents)
Loop

If $Wait.Tag = 1
Goto cmdList()
EndIf

EndFunction

Function cmdList()

$temp = "%temp%\netview.tmp"
$list = "%temp%\list.tmp"

Shell '%comspec% /c net view >"$temp"'

Select
Case $x=1
;--------------------------------
; For all systems
;--------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,4) = "\\S0" OR $line AND SubStr($line,1,3) = "\\W"
OR $line AND SubStr($line,1,3) = "\\L"
$hostname=SubStr($line,3,InStr($line," ")-1)
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=2
;-------------------------------------
; if statement for S'
;-------------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,4) = "\\S0"
$hostname=SubStr($line,3,InStr($line," ")-1)
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=3
;-----------------------------------
; if statement for Corporate
;-----------------------------------
If Open(1,"$temp") = 0
$line = ReadLine(1)
While @error=0
If $line AND SubStr($line,1,3) = "\\W" OR $line AND SubStr($line,1,3) = "\\L"
$hostname=SubStr($line,3,InStr($line," ")-1)
?"hostname=" $hostname
Open(2, "$list", 5) = 0
WriteLine(2, $hostname + Chr(13) + Chr(10))
Close(2)
EndIf
$line = ReadLine(1)
Loop
$_ = Close(1)
EndIf

Case $x=4
;---------------------------------
; use the failed list to run the
; inventory against.
;---------------------------------




EndFunction



[ 29. November 2002, 22:07: Message edited by: ArchAngel96 ]
_________________________
penny = the target the playing field = three football fields side by side you = only allowed to stand on the outside of the playing field tool you get to use to find the penny = a ONE INCH LAWN DART get the level of difficulty?

Top
#89970 - 2002-11-29 10:14 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, it looks like it could work.
anyway, why you insist on using that tag?
you can use it, but you could also direct all the events to the event function and check for the values there.
this way you don't need even:
code:
If $Wait.Tag = 1
Goto cmdList()
EndIf

which actually is not even kix.
it should be:
code:
If $Wait.Tag = 1
cmdList()
EndIf

there biggest problem here is not that you don't know what you are doing but that you are trying to learn really much.
normal kixforms newbie is long time kix user.
now you are also trying to learn kix as well which makes things a lot more difficult.

that said, your code is not bad at all.
_________________________
!

download KiXnet

Top
#89971 - 2002-11-29 11:23 PM Re: KixForms and the Cancel button
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I was thinking more along the lines of code like
this - to my mind, seems clean and simple and
straight-forward:

code:
break on cls

cmdGet_List()

exit

Function cmdGet_List()

Dim $Wait

$Wait = CreateObject("Kixtart.FORM")
$Wait.CAPTION = "Select a Target"
$Wait.SCALEWIDTH = 200
$Wait.SCALEHEIGHT = 250
$Wait.FONTSIZE = 12
$Wait.FONTNAME = "Arial"
$Wait.PrintXY(20,20,"Select Computer Type")
$Wait.CENTER

$Corporate = $Wait.OptionButton
$Corporate.FONTSIZE = 11
$Corporate.FONTNAME = "Arial"
$Corporate.Caption = "Corporate"
$Corporate.Left = 45
$Corporate.Top = 50
$Corporate.Width = 100
$Corporate.Height = 25

$Stores = $Wait.OptionButton
$Stores.Caption = "Stores"
$Stores.Left = 45
$Stores.Top = 80
$Stores.Width = 100
$Stores.Height = 25

$All = $Wait.OptionButton
$All.Caption = "All Units"
$All.Left = 45
$All.Top = 110
$All.Width = 100
$All.Height = 25

$Failed = $Wait.OptionButton
$Failed.Caption = "Failed List"
$Failed.Left = 45
$Failed.Top = 140
$Failed.Width = 130
$Failed.Height = 25

$Button2 = $Wait.CommandButton("Ok")
$Button2.Left = 25
$Button2.Top = 205
$Button2.Width = 50
$Button2.Height = 25
$Button2.OnClick = "$$Wait.Tag=1"

$Button3 = $Wait.CommandButton("Cancel")
$Button3.Left = 105
$Button3.Top = 205
$Button3.Width = 75
$Button3.Height = 25
$Button3.OnClick = 0
$Button3.OnClick = "$$Wait.Tag=2"

$Wait.Tag = 0
$Wait.Show
$FORM.Refresh

While $Wait.Visible And Not $Wait.Tag
$=Execute($Wait.DoEvents)
Loop

If $Wait.Tag = 1

Select

Case $Corporate.Value = 1

?"Corporate processing..."

Case $Stores.Value = 1

?"Stores processing..."

Case $All.Value = 1

?"All processing..."

Case $Failed.Value = 1

?"Failed processing..."

EndSelect

EndIf

EndFunction



[ 29. November 2002, 23:24: Message edited by: Shawn ]

Top
#89972 - 2002-11-29 11:28 PM Re: KixForms and the Cancel button
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm...
also, to shorten even from shawns code, I would tell you a shortcut...
instead of separately calling every controls left/top and so on properties, you can do it on init.

$control=$form.somecontrol(specific_or_empty,left,top,width,height)

so for example, ok button would be:
code:
$Button2 = $Wait.Button("Ok",25,205,50,25)$Button2.OnClick = "$$Wait.Tag=1" 

that's just fine tuning but once you learn to use it, you see your code size reducing to really small [Smile]
_________________________
!

download KiXnet

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 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

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

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