Page 1 of 1 1
Topic Options
#189879 - 2008-09-25 02:45 PM Need help!
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
Hello...
I need help! In this script I would like to go from the window B to the window A! Use so the back-button...


PS. I speak very badly in English! :(

;debug on
cls
setconsole("hide")
break on

$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.BackColor = Green
$Form.Width = 340
$Form.Height = 610
$Form.Text = "A"

$Form.Button1 = $Form.Controls.button("Button")
$Form.Button1.Width = 120
$Form.Button1.Height = 50
$Form.Button1.Text = "A"
$Form.Button1.Top = 10
$Form.Button1.Left = 10
$Form.Button1.OnClick = "ButtonA()"

$Form.Button8 = $Form.Controls.button("Button")
$Form.Button8.Width = 120
$Form.Button8.Height = 50
$Form.Button8.Text = "Exit"
$Form.Button8.Top = 500
$Form.Button8.Left = 205
$Form.Button8.OnClick = "quit"

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

Function ButtonA()


$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Width = 340
$Form.Height = 610
$Form.BackColor = Green
$Form.Text = "B"

$Form.Button1 = $Form.Controls.Button("Button")
$Form.Button1.Width = 120
$Form.Button1.Height = 50
$Form.Button1.Text = "1"
$Form.Button1.Top = 10
$Form.Button1.Left = 10
$Form.Button1.OnClick = "OnButtonClick()"

$Form.Button2 = $Form.Controls.Button("Button")
$Form.Button2.Width = 120
$Form.Button2.Height = 50
$Form.Button2.Text = "2"
$Form.Button2.Top = 65
$Form.Button2.Left = 10
$Form.Button2.OnClick = "OnButtonClick()"

$Form.Button3 = $Form.Controls.Button("Button")
$Form.Button3.Width = 120
$Form.Button3.Height = 50
$Form.Button3.Text = "3"
$Form.Button3.Top = 120
$Form.Button3.Left = 10
$Form.Button3.OnClick = "OnButtonClick()"

$Form.Button4 = $Form.Controls.Button("Button")
$Form.Button4.Width = 120
$Form.Button4.Height = 50
$Form.Button4.Text = "4"
$Form.Button4.Top = 175
$Form.Button4.Left = 10
$Form.Button4.OnClick = "OnButtonClick()"

$Form.Button5 = $Form.Controls.button("Button")
$Form.Button5.Width = 120 ; Breite
$Form.Button5.Height = 50 ; Länge
$Form.Button5.Text = "Exit"
$Form.Button5.Top = 500
$Form.Button5.Left = 205
$Form.Button5.OnClick = "quit"

$Form.Button6 = $Form.Controls.Button("Button")
$Form.Button6.Width = 120
$Form.Button6.Height = 50
$Form.Button6.Text = "Back"
$Form.Button6.Top = 500
$Form.Button6.Left = 10
$Form.Button6.OnClick = "OnButtonClick()"



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

EndFunction


Can somebody help me???
Thx.... :)

Top
#189882 - 2008-09-25 03:35 PM Re: Need help! [Re: Nick2]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Try the KiXforms BB at http://www.kixforms.org

But in answer, you are creating 2 objects with the same name, you can't do that.

Create your second form as $Form2, no need to reinstantionate (sp) the kixforms system, you have already done that

You have to define your functions for the "ONBUTTONCLICK" events, what do you want to happen when you click the button....

Check out the KiXforms BB and you will find a wealth of information.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#189888 - 2008-09-25 08:50 PM Re: Need help! [Re: Gargoyle]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Hi Nick2 and Welcome to the board.

Just a side note, you should place any code you have between Code Tags, it makes it easier to read and to help you when you need it.
Here is a link that will help you with that. Help

Try this code and let me know if this is what you are looking for.
 Code:
;region Setup Variables
$Version = "Build(1.0.0.1)"
$System = CreateObject("Kixtart.System")
;endregion

Break on
If Not $System
   $= MessageBox("KiXforms Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf

;region Main Form
$FormA = $System.Form()
$FormA.Text = "Form A " + $Version
$FormA.Size = 600,400
$FormA.SysMenu = 0

$FormBButton = $FormA.Controls.button("Button")
$FormBButton.Width = 120
$FormBButton.Height = 50
$FormBButton.Text = "Form B"
$FormBButton.Top = 10
$FormBButton.Left = 10
$FormBButton.OnClick = "SwitchForms('FormB')"

$FormAQuitButton = $FormA.Controls.button("Button")
$FormAQuitButton.Width = 120
$FormAQuitButton.Height = 50
$FormAQuitButton.Text = "Exit"
$FormAQuitButton.Top = 285
$FormAQuitButton.Left = 10
$FormAQuitButton.OnClick = "ExitForms()"

$FormA.Center
$FormA.Show()

;region Startup
CreateFormB()
;endregion

$Running = 1
While $Running = 1
  $Nul = Execute($FormA.DoEvents())
  $Nul = Execute($FormB.DoEvents())
Loop
Exit 0
;endregion

;region Startup Functions
Function CreateFormB()
  $FormB = $System.Form()  
  $FormB.Text = "Form B " + $Version
  $FormB.Size = 600, 400
  $FormB.SysMenu = 0
  
  $FormAButton = $FormB.Controls.button("Button")
  $FormAButton.Width = 120
  $FormAButton.Height = 50
  $FormAButton.Text = "Form A"
  $FormAButton.Top = 10
  $FormAButton.Left = 10
  $FormAButton.OnClick = "SwitchForms('FormA')"
  
  $FormBButton1 = $FormB.Controls.Button("Button")
  $FormBButton1.Width = 120 
  $FormBButton1.Height = 50 
  $FormBButton1.Text = "1"
  $FormBButton1.Top = 65
  $FormBButton1.Left = 10
  $FormBButton1.OnClick = "OnButtonClick('1')"
  
  $FormBButton2 = $FormB.Controls.Button("Button")
  $FormBButton2.Width = 120 
  $FormBButton2.Height = 50 
  $FormBButton2.Text = "2"
  $FormBButton2.Top = 120
  $FormBButton2.Left = 10
  $FormBButton2.OnClick = "OnButtonClick('2')"
  
  $FormBButton3 = $FormB.Controls.Button("Button")
  $FormBButton3.Width = 120 
  $FormBButton3.Height = 50 
  $FormBButton3.Text = "3"
  $FormBButton3.Top = 175
  $FormBButton3.Left = 10
  $FormBButton3.OnClick = "OnButtonClick('3')"
  
  $FormBButton4 = $FormB.Controls.Button("Button")
  $FormBButton4.Width = 120 
  $FormBButton4.Height = 50 
  $FormBButton4.Text = "4"
  $FormBButton4.Top = 230
  $FormBButton4.Left = 10
  $FormBButton4.OnClick = "OnButtonClick('4')"
  
  $FormBQuitButton = $FormB.Controls.button("Button")
  $FormBQuitButton.Width = 120
  $FormBQuitButton.Height = 50
  $FormBQuitButton.Text = "Exit"
  $FormBQuitButton.Top = 285 
  $FormBQuitButton.Left = 10
  $FormBQuitButton.OnClick = "ExitForms()"
  
EndFunction
;endregion

;region Common Functions
Function SwitchForms($FormName)
  Select
    Case $FormName = "FormA"
      $FormB.Hide
      $FormA.Center
      $FormA.Show()
    Case $FormName = "FormB"
      $FormA.Hide
      $FormB.Center
      $FormB.Show()
  EndSelect
EndFunction

Function OnButtonClick($Button)
  Select
    Case $Button = 1
      ? 'Button 1 Pressed'
    Case $Button = 2
      ? 'Button 2 Pressed'
    Case $Button = 3
      ? 'Button 3 Pressed'
    Case $Button = 4
      ? 'Button 4 Pressed'
  EndSelect
EndFunction

Function ExitForms()
  $Running = 0  
EndFunction
;endregion

_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#189992 - 2008-10-02 03:41 PM Re: Need help! [Re: Benny69]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
Thank you for your help!
Real is that after which I look. Only I would still want:
from the main window go to Window_1 and than back,
from the main window go to Window_2 and than back,
from the main window go to Window_3 and tahn back.
What is wrong here???

 Code:
setconsole("hide")
$Version = "Version 1.0"
$System = CreateObject("Kixtart.System")


$Form1 = $System.Form()
$Form1.Text = "Window " + $Version
$Form1.BackColor = Green
$Form1.Size = 600,400
$Form1.SysMenu = 0

$Form2Button = $Form1.Controls.button("Button")
$Form2Button.Width = 120
$Form2Button.Height = 50
$Form2Button.Text = "GoTo_Window_1"
$Form2Button.Top = 10
$Form2Button.Left = 10
$Form2Button.OnClick = "SwitchForms('GoTo_Window_1')"

$Form3Button = $Form1.Controls.button("Button")
$Form3Button.Width = 120
$Form3Button.Height = 50
$Form3Button.Text = "GoTo_Window_2"
$Form3Button.Top = 65
$Form3Button.Left = 10
$Form3Button.OnClick = "SwitchForms2('GoTo_Window_2')"

$Form4Button = $Form1.Controls.button("Button")
$Form4Button.Width = 120
$Form4Button.Height = 50
$Form4Button.Text = "GoTo_Window_3"
$Form4Button.Top = 120
$Form4Button.Left = 10
$Form4Button.OnClick = "SwitchForms3('GoTo_Window_3')"

$Form1QuitButton = $Form1.Controls.button("Button")
$Form1QuitButton.Width = 120
$Form1QuitButton.Height = 50
$Form1QuitButton.Text = "Exit"
$Form1QuitButton.Top = 285
$Form1QuitButton.Left = 10
$Form1QuitButton.OnClick = "ExitForms()"

$Form1.Center
$Form1.Show()


CreateForm2()

$Running = 1
While $Running = 1
  $Nul = Execute($Form1.DoEvents())
  $Nul = Execute($Form2.DoEvents())
  Loop
Exit 0

;======================WINDOW_1==========================

Function CreateForm2()
$Form2 = $System.Form()  
$Form2.Text = "GoTo_Window_1 " + $Version
$Form2.BackColor = Green
$Form2.Size = 600, 400
$Form2.SysMenu = 0
  
$Form1Button = $Form2.Controls.button("Button")
$Form1Button.Width = 120
$Form1Button.Height = 50
$Form1Button.Text = "Back"
$Form1Button.Top = 10
$Form1Button.Left = 10
$Form1Button.OnClick = "SwitchForms('Back')"

$Form2QuitButton = $Form2.Controls.button("Button")
$Form2QuitButton.Width = 120
$Form2QuitButton.Height = 50
$Form2QuitButton.Text = "Exit"
$Form2QuitButton.Top = 285 
$Form2QuitButton.Left = 10
$Form2QuitButton.OnClick = "ExitForms()"
  
EndFunction

Function SwitchForms($FormName)
  Select
    Case $FormName = "Back"
      $Form2.Hide
      $Form1.Center
      $Form1.Show()
    Case $FormName = "GoTo_Window_1"
      $Form1.Hide
      $Form2.Center
      $Form2.Show()
   EndSelect
EndFunction


;======================WINDOW_2============================

CreateForm3()

$Running = 1
While $Running = 1
  $Nul = Execute($Form1.DoEvents())
  $Nul = Execute($Form3.DoEvents())
  Loop
Exit 0

Function CreateForm3()
$Form3 = $System.Form()  
$Form3.Text = "GoTo_Window_2 " + $Version
$Form3.BackColor = Green
$Form3.Size = 600, 400
$Form3.SysMenu = 0
  
$Form3QuitButton = $Form3.Controls.button("Button")
$Form3QuitButton.Width = 120
$Form3QuitButton.Height = 50
$Form3QuitButton.Text = "Exit"
$Form3QuitButton.Top = 285 
$Form3QuitButton.Left = 10
$Form3QuitButton.OnClick = "ExitForms()"

EndFunction

Function SwitchForms2($FormName)
  Select
     Case $FormName = "GoTo_Window_2"
      $Form1.Hide
      $Form3.Center
      $Form3.Show()
EndSelect
EndFunction


;======================WINDOW_3============================

CreateForm4()

$Running = 1
While $Running = 1
  $Nul = Execute($Form1.DoEvents())
  $Nul = Execute($Form4.DoEvents())
  Loop
Exit 0

Function CreateForm4()
$Form4 = $System.Form()  
$Form4.Text = "GoTo_Window_3 " + $Version
$Form4.BackColor = Green
$Form4.Size = 600, 400
$Form4.SysMenu = 0
  
$Form4QuitButton = $Form4.Controls.button("Button")
$Form4QuitButton.Width = 120
$Form4QuitButton.Height = 50
$Form4QuitButton.Text = "Exit"
$Form4QuitButton.Top = 285 
$Form4QuitButton.Left = 10
$Form4QuitButton.OnClick = "ExitForms()"

EndFunction

Function SwitchForms3($FormName)
  Select
     Case $FormName = "GoTo_Window_3"
      $Form1.Hide
      $Form4.Center
      $Form4.Show()
EndSelect
EndFunction


Function ExitForms()
  $Running = 0  
EndFunction

Top
#190000 - 2008-10-02 04:39 PM Re: Need help! [Re: Nick2]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Hi Nick,

you should realy include this code at the begining of your KiXforms script, it is your verification that KiXforms is installed and working correctly.

 Code:
Break on
If Not $System
  $ = MessageBox("KiXforms Not Initiated. This Script Will Now Close.", "Error", 16)
  Quit()
EndIf


also, you dont need to use this command if you use wkix32.exe rather than kix32.exe:
 Code:
SetConsole("hide")



here is a re-work of your code, let me know if this is what you are looking for.

 Code:
$Version = "Version 1.0"
$System = CreateObject("Kixtart.System")

Break on
If Not $System
  $ = MessageBox("KiXforms Not Initiated. This Script Will Now Close.", "Error", 16)
  Quit()
EndIf

$Form1 = $System.Form()
$Form1.Text = "Window " + $Version
$Form1.BackColor = Green
$Form1.Size = 600, 400
$Form1.SysMenu = 0

$Form2Button = $Form1.Controls.button("Button")
$Form2Button.Width = 120
$Form2Button.Height = 50
$Form2Button.Text = "GoTo_Window_1"
$Form2Button.Top = 10
$Form2Button.Left = 10
$Form2Button.OnClick = "SwitchForms('GoTo_Window_1')"

$Form3Button = $Form1.Controls.button("Button")
$Form3Button.Width = 120
$Form3Button.Height = 50
$Form3Button.Text = "GoTo_Window_2"
$Form3Button.Top = 65
$Form3Button.Left = 10
$Form3Button.OnClick = "SwitchForms('GoTo_Window_2')"

$Form4Button = $Form1.Controls.button("Button")
$Form4Button.Width = 120
$Form4Button.Height = 50
$Form4Button.Text = "GoTo_Window_3"
$Form4Button.Top = 120
$Form4Button.Left = 10
$Form4Button.OnClick = "SwitchForms('GoTo_Window_3')"

$Form1QuitButton = $Form1.Controls.button("Button")
$Form1QuitButton.Width = 120
$Form1QuitButton.Height = 50
$Form1QuitButton.Text = "Exit"
$Form1QuitButton.Top = 285
$Form1QuitButton.Left = 10
$Form1QuitButton.OnClick = "ExitForms()"

$Form1.Center
$Form1.Show()

CreateForm2()
CreateForm3()
CreateForm4()

$Running = 1
While $Running = 1
  $Nul = Execute($Form1.DoEvents())
  $Nul = Execute($Form2.DoEvents())
  $Nul = Execute($Form3.DoEvents())
  $Nul = Execute($Form4.DoEvents())
Loop
Exit 0

;======================WINDOW_1==========================

Function CreateForm2()
  $Form2 = $System.Form()  
  $Form2.Text = "GoTo_Window_1 " + $Version
  $Form2.BackColor = Green
  $Form2.Size = 600, 400
  $Form2.SysMenu = 0
    
  $Form2BackButton = $Form2.Controls.button("Button")
  $Form2BackButton.Width = 120
  $Form2BackButton.Height = 50
  $Form2BackButton.Text = "Back"
  $Form2BackButton.Top = 10
  $Form2BackButton.Left = 10
  $Form2BackButton.OnClick = "SwitchForms('Back')"
    
  $Form2QuitButton = $Form2.Controls.button("Button")
  $Form2QuitButton.Width = 120
  $Form2QuitButton.Height = 50
  $Form2QuitButton.Text = "Exit"
  $Form2QuitButton.Top = 285 
  $Form2QuitButton.Left = 10
  $Form2QuitButton.OnClick = "ExitForms()"
    
EndFunction

;======================WINDOW_2============================

Function CreateForm3()
  $Form3 = $System.Form()  
  $Form3.Text = "GoTo_Window_2 " + $Version
  $Form3.BackColor = Green
  $Form3.Size = 600, 400
  $Form3.SysMenu = 0
      
  $Form3BackButton = $Form3.Controls.button("Button")
  $Form3BackButton.Width = 120
  $Form3BackButton.Height = 50
  $Form3BackButton.Text = "Back"
  $Form3BackButton.Top = 10
  $Form3BackButton.Left = 10
  $Form3BackButton.OnClick = "SwitchForms('Back')"
  
  $Form3QuitButton = $Form3.Controls.button("Button")
  $Form3QuitButton.Width = 120
  $Form3QuitButton.Height = 50
  $Form3QuitButton.Text = "Exit"
  $Form3QuitButton.Top = 285 
  $Form3QuitButton.Left = 10
  $Form3QuitButton.OnClick = "ExitForms()"
    
EndFunction

;======================WINDOW_3============================

Function CreateForm4()
  $Form4 = $System.Form()  
  $Form4.Text = "GoTo_Window_3 " + $Version
  $Form4.BackColor = Green
  $Form4.Size = 600, 400
  $Form4.SysMenu = 0
      
  $Form4BackButton = $Form4.Controls.button("Button")
  $Form4BackButton.Width = 120
  $Form4BackButton.Height = 50
  $Form4BackButton.Text = "Back"
  $Form4BackButton.Top = 10
  $Form4BackButton.Left = 10
  $Form4BackButton.OnClick = "SwitchForms('Back')"
  
  $Form4QuitButton = $Form4.Controls.button("Button")
  $Form4QuitButton.Width = 120
  $Form4QuitButton.Height = 50
  $Form4QuitButton.Text = "Exit"
  $Form4QuitButton.Top = 285 
  $Form4QuitButton.Left = 10
  $Form4QuitButton.OnClick = "ExitForms()"
    
EndFunction

Function SwitchForms($FormName)
  Select
    Case $FormName = "Back"
      $Form2.Hide
      $Form3.Hide
      $Form4.Hide
      $Form1.Center
      $Form1.Show()
    Case $FormName = "GoTo_Window_1"
      $Form1.Hide
      $Form2.Center
      $Form2.Show()
    Case $FormName = "GoTo_Window_2"
      $Form1.Hide
      $Form3.Center
      $Form3.Show()
    Case $FormName = "GoTo_Window_3"
      $Form1.Hide
      $Form4.Center
      $Form4.Show()
  EndSelect
EndFunction

Function ExitForms()
  $Running = 0  
  Quit()
EndFunction
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#190038 - 2008-10-07 01:17 PM Re: Need help! [Re: Benny69]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
Hi Benny69

Yes this is that what I looking for! Thank you! \:\) ;\)

Top
#190117 - 2008-10-14 01:58 PM Re: Need help! [Re: Nick2]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
Hi
I have another question...

I click on button 1 and on the right site must come one button...
if I on button 2 click ---> on the right site comes two buttons....
and if i on button 3 klick ---> on the rights site comes three buttons...

 Code:
$System = CreateObject("KiXtart.System")

Break on
If Not $System
  $ = MessageBox("KiXforms Not Initiated. This Script Will Now Close.", "Error", 16)
  Quit()
EndIf

;~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$Form1 = $System.Form()
$Form1.Text = "Nick"
$Form1.SysMenu = 0

;~~< SplitContainer1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$SplitContainer1 = $Form1.Controls.SplitContainer()
$SplitContainer1.Location = 0, 0
$SplitContainer1.Size = 292, 271
$SplitContainer1.BackColor = "Red"
$SplitContainer1.SplitterDistance = 121
$SplitContainer1.Panel1.BackColor = 192, 255, 255
$SplitContainer1.Panel1.Size = 121, 271
$SplitContainer1.Panel1.Location = 0, 0

;~~< 1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$1 = $SplitContainer1.Panel1.Controls.Button('Button')
$1.Size = 92, 23
$1.Text = "1"
$1.Location = 10, 10
;$1.OnClick = "SwitchForms('Open1')"

;~~< 2 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$2 = $SplitContainer1.Panel1.Controls.Button('Button')
$2.Size = 92, 23
$2.Text = "2"
$2.Location = 10, 40
;$2.OnClick = "SwitchForms('Open2')"

;~~< 3 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$3 = $SplitContainer1.Panel1.Controls.Button('Button')
$3.Size = 92, 23
$3.Text = "3"
$3.Location = 10, 70
;$3.OnClick = "SwitchForms('Open3')"

;~~< Exit >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$Exit = $SplitContainer1.Panel1.Controls.Button('Button')
$Exit.Size = 92, 23
$Exit.Text = "Exit"
$Exit.Location = 13, 230
$Exit.OnClick = "ExitForms()"

$SplitContainer1.Panel2.BackColor = 128, 255, 128
$SplitContainer1.Panel2.Size = 167, 271
$SplitContainer1.Panel2.Location = 125, 0
$SplitContainer1.Panel2.Cursor = $System.CursorStyle.Arrow
$SplitContainer1.Panel2.TabStop = -1

$Form1.Show
$Form1.Center

While $Form1.Visible 
 $=Execute($Form1.DoEvents) 
Loop 


Function ExitForms()
Quit()
EndFunction

Top
#190118 - 2008-10-14 03:16 PM Re: Need help! [Re: Nick2]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
not going to try your script but I would say create the 3 buttons but make the not needed ones non visible.
_________________________
!

download KiXnet

Top
#190126 - 2008-10-15 08:33 AM Re: Need help! [Re: Lonkero]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
.....for example i would like open with one click on button 3... three other buttons on the right site....
Top
#190134 - 2008-10-15 03:16 PM Re: Need help! [Re: Nick2]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
 Code:
$button3.click = "EnableButton("4~5~6")"

Function EnableButton($Input)
 $Array = Split($Input,"~")
 For Each $Element in $Array
  Execute("$Button"+$Element+".Enabled = True")
 Next
EndFunction


Just one of many ways that you could do it.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#190138 - 2008-10-16 12:09 PM Re: Need help! [Re: Gargoyle]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
How can I insert it in my Script?

 Originally Posted By: Gargoyle
 Code:
$button3.click = "EnableButton("4~5~6")"

Function EnableButton($Input)
 $Array = Split($Input,"~")
 For Each $Element in $Array
  Execute("$Button"+$Element+".Enabled = True")
 Next
EndFunction


Just one of many ways that you could do it.

Top
#190140 - 2008-10-16 02:25 PM Re: Need help! [Re: Nick2]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
First you need to create the buttons where you want them, then set the property .enabled to false

Use the above example to enable them when you click the button of your choice.

The code was not meant to be working code, just an example.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#190141 - 2008-10-16 03:27 PM Re: Need help! [Re: Gargoyle]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
And on a second read of your post, I may have misunderstood what you wanted.

When you press your 3rd button, are you looking to activate 3 more buttons or do the actions of 3 buttons?
_________________________
Today is the tomorrow you worried about yesterday.

Top
#190146 - 2008-10-17 07:58 AM Re: Need help! [Re: Gargoyle]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
If I press 3rd button, I wnat to activate 3 more buttons on Panel2!
If I press 2nd button, I want to activate 2 more buttons on Panel2!

 Code:
$System = CreateObject("KiXtart.System")

Break on
If Not $System
  $ = MessageBox("KiXforms Not Initiated. This Script Will Now Close.", "Error", 16)
  Quit()
EndIf

;~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$Form1 = $System.Form()
$Form1.Text = "Nick"
$Form1.SysMenu = 0

;~~< SplitContainer1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$SplitContainer1 = $Form1.Controls.SplitContainer()
$SplitContainer1.Location = 0, 0
$SplitContainer1.Size = 292, 271
$SplitContainer1.BackColor = "Red"
$SplitContainer1.SplitterDistance = 121
$SplitContainer1.Panel1.BackColor = 192, 255, 255
$SplitContainer1.Panel1.Size = 121, 271
$SplitContainer1.Panel1.Location = 0, 0

;~~< 1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$1 = $SplitContainer1.Panel1.Controls.Button('Button')
$1.Size = 92, 23
$1.Text = "1"
$1.Location = 10, 10
;$1.OnClick = "SwitchForms('Open1')"

;~~< 2 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$2 = $SplitContainer1.Panel1.Controls.Button('Button')
$2.Size = 92, 23
$2.Text = "2"
$2.Location = 10, 40
;$2.OnClick = "SwitchForms('Open2')"

;~~< 3 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$3 = $SplitContainer1.Panel1.Controls.Button('Button')
$3.Size = 92, 23
$3.Text = "3"
$3.Location = 10, 70
;$3.OnClick = "SwitchForms('Open3')"

;~~< Exit >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$Exit = $SplitContainer1.Panel1.Controls.Button('Button')
$Exit.Size = 92, 23
$Exit.Text = "Exit"
$Exit.Location = 13, 230
$Exit.OnClick = "ExitForms()"

$SplitContainer1.Panel2.BackColor = 128, 255, 128
$SplitContainer1.Panel2.Size = 167, 271
$SplitContainer1.Panel2.Location = 125, 0
$SplitContainer1.Panel2.Cursor = $System.CursorStyle.Arrow
$SplitContainer1.Panel2.TabStop = -1

$Form1.Show
$Form1.Center

While $Form1.Visible 
 $=Execute($Form1.DoEvents) 
Loop 


Function ExitForms()
Quit()
EndFunction

Top
#190151 - 2008-10-17 03:22 PM Re: Need help! [Re: Nick2]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Okay, so create all of your buttons. The buttons that are on Panel2 should have their property .enabled set to false

When you press a button on Panel1, you can use the code that I provided earlier to change the property to true.

On your Panel1 Buttons for the .click event you need to pass the string of what buttons you want to enable.

For example
 Code:
$panel1_Button1.click = "EnableButton(Panel2_Button1)"
$panel1_Button2.click = "EnableButton(Panel2_Button1~Panel2_Button2)"
$panel1_Button3.click = "EnableButton(Panel2_Button1~Panel2_Button2~Panel2_Button3)"


Of course this does not just plug and play, you have to change it to work with your code.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#190152 - 2008-10-17 03:49 PM Re: Need help! [Re: Gargoyle]
Nick2 Offline
Fresh Scripter

Registered: 2008-09-25
Posts: 8
OK thank you, I will try to write new scrips.
Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.066 seconds in which 0.023 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