#116818 - 2004-03-25 12:38 PM
kixforms : display multiples lines
|
denayer
Fresh Scripter
Registered: 2000-04-28
Posts: 11
Loc: brussels,belgium
|
i want to display a number of lines and resize my form automaticly. To resize my form, no problem, bud when i want to display the lines, only the last one is ok, i think i have a problem whit the variables. ------------------------------------------------------------ code: $shareline= 50 ; higt of the line to insert $nombre=1 ; numbers of lines to display Break On Cls $nul=SetConsole("Hide") $share = "bla bla" ; just to have a temp output ;------------------------------------------------ ; Main Form ;------------------------------------------------ $FrmRoot = CreateObjet("Kixtart.Form") IF @Error $msgbx=Messagebox("Please contact your Administrator, KiXForms.dll is not installed/ registred",32) Exit(1) Endif
$FrmMain1 = CreateObject("Kixtart.Form") $FrmMain1.Size = 600,(200+($nombre*$shareline)) $FrmMain1.Left = 100 $FrmMain1.Top = 100 $FrmMain1.Text = "MIGRATION SCRIPT" $FrmMain1.center
;Listbox $FraUser = $FrmMain1.Frame $FraUser.Size = 270,100 $FraUser.left = 10 $FraUser.Top = 10 $FraUser.Text = "Source Server"
;Listbox $FraUser1 = $FrmMain1.Frame $FraUser1.Size = 270,100 $FraUser1.left = 310 $FraUser1.Top = 10 $FraUser1.Text = "Destination Server"
$LblFName = $FraUser.Label("Source Server : $pad3",5,22,165,15) $lblfName1 = $FraUser.Label("IPAdress : $sourceip",5,42,165,15) $LblFName.Alignement = 1
$LblLServer = $FraUser1.Label("Target Server : $pad4",5,22,165,15) $lblLServer1 = $FraUser1.Label("IPAdress : $destip",5,42,165,15) $LblLServer.Alignement = 1
$Lblshare1 = $frmmain1.Label("Select Share",10,130) $Lblshare2 = $frmmain1.Label("ShareName",100,130) ;*********************************************************** if $nombre<>0 For $i = 1 To $nombre
$CheckBox="$CheckBox"+$i $arreyshare="$arreyshare"+$i $Lbldsk1="$Lbldsk1"+$i $Button1="$Button1"+$i $Lbldsk2="$Lbldsk2"+$i $Button2="$Button2"+$i $Lbldsk3="$Lbldsk3"+$i $Button3="$Button3"+$i
$CheckBox = $FrmMain1.CheckBox(" ",30,(100+($i*$shareline)),30,15) $arreyshare = $frmmain1.Label("$share",100,(100+($i*$shareline)),100,20)
$Lbldsk1 = $frmmain1.Label("C:",200,(70+($i*$shareline))) $Button1 = $FrmMain1.OptionButton $Button1.Caption = " " $Button1.Left = 200 $Button1.Top = (100+($i*$shareline)) $Button1.Width = 10 $Button1.Height = 10
$Lbldsk2 = $frmmain1.Label("D:",230,(70+($i*$shareline))) $Button2 = $FrmMain1.OptionButton $Button2.Caption = " " $Button2.Left = 230 $Button2.Top = (100+($i*$shareline)) $Button2.Width = 10 $Button2.Height = 10
$Lbldsk3 = $frmmain1.Label("E:",260,(70+($i*$shareline))) $Button3 = $FrmMain1.OptionButton $Button3.Caption = " " $Button3.Left = 260 $Button3.Top = (100+($i*$shareline)) $Button3.Width = 10 $Button3.Height = 10; next endif
;*********************************************************** $CmbOk = $FrmMain1.CommandButton("Connect") $CmbOk.Left = 450 $CmbOk.Top = (140+($nombre*$shareline)) $CmbOk.Width = 50 $CmbOk.Heigt = 30 $CmbOk.OnClick = "Ok_Click()"
$CmbExit = $FrmMain1.CommandButton("Cancel") $CmbExit.Left = 520 $CmbExit.Top = (140+($nombre*$shareline)) $CmbExit.Width = 50 $CmbExit.Heigt = 30 $CmbExit.OnClick = "Exit_Click()"
; Show the screen
$FrmMain1.Show While $FrmMain1.Visible $ = Execute($FrmmAin1.DoEvents) Loop Exit 1
$rc=$rc.Close $oXL.Application.Quit
;------------------------------------------------ ; Functions ;------------------------------------------------
Function Ok_Click() $Selection=Messagebox("in order tot hier","Alert",33) Quit() EndFunction
Function Exit_click() Quit() EndFunction
end code ---------------------------------------------
Is Ther a solution
Thank you
|
|
Top
|
|
|
|
#116819 - 2004-03-25 02:17 PM
Re: kixforms : display multiples lines
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
hi, think the problem might be that in your for/next loop, your over-writing (and therefore destroying) each "dynamic" control you create because your "re-using" the same variable name, over and over ... here is a quicky modified version of your code using the "Controls" collection version of the contructor ... using Controls keeps a reference to the control internally to the form, and therefore the control stays alive ... the other way of doing this would be to create something called a "Control Array" to hold references to the controls ...
Code:
Break On Cls
$shareline= 50 ; higt of the line to insert $nombre=6 ; numbers of lines to display
$share = "bla bla" ; just to have a temp output
;------------------------------------------------ ; Main Form ;------------------------------------------------ $FrmRoot = CreateObject("Kixtart.Form") IF @Error $msgbx=Messagebox("Please contact your Administrator, KiXForms.dll is not installed/ registred",32) Exit(1) Endif
$FrmMain1 = CreateObject("Kixtart.Form") $FrmMain1.Size = 600,(200+($nombre*$shareline)) $FrmMain1.Left = 100 $FrmMain1.Top = 100 $FrmMain1.Text = "MIGRATION SCRIPT" $FrmMain1.center
;Listbox $FraUser = $FrmMain1.Frame $FraUser.Size = 270,100 $FraUser.left = 10 $FraUser.Top = 10 $FraUser.Text = "Source Server"
;Listbox $FraUser1 = $FrmMain1.Frame $FraUser1.Size = 270,100 $FraUser1.left = 310 $FraUser1.Top = 10 $FraUser1.Text = "Destination Server"
$LblFName = $FraUser.Label("Source Server : $pad3",5,22,165,15) $lblfName1 = $FraUser.Label("IPAdress : $sourceip",5,42,165,15) $LblFName.Alignement = 1
$LblLServer = $FraUser1.Label("Target Server : $pad4",5,22,165,15) $lblLServer1 = $FraUser1.Label("IPAdress : $destip",5,42,165,15) $LblLServer.Alignement = 1
$Lblshare1 = $frmmain1.Label("Select Share",10,130) $Lblshare2 = $frmmain1.Label("ShareName",100,130) ;*********************************************************** if $nombre<>0 For $i = 1 To $nombre
$CheckBox="$CheckBox"+$i $arreyshare="$arreyshare"+$i $Lbldsk1="$Lbldsk1"+$i $Button1="$Button1"+$i $Lbldsk2="$Lbldsk2"+$i $Button2="$Button2"+$i $Lbldsk3="$Lbldsk3"+$i $Button3="$Button3"+$i
$CheckBox = $FrmMain1.Controls.CheckBox(" ",30,(100+($i*$shareline)),30,15) $arreyshare = $frmmain1.Controls.Label("$share",100,(100+($i*$shareline)),100,20)
$Lbldsk1 = $frmmain1.Controls.Label("C:",200,(70+($i*$shareline))) $Button1 = $FrmMain1.OptionButton $Button1.Caption = " " $Button1.Left = 200 $Button1.Top = (100+($i*$shareline)) $Button1.Width = 10 $Button1.Height = 10
$Lbldsk2 = $frmmain1.Controls.Label("D:",230,(70+($i*$shareline))) $Button2 = $FrmMain1.OptionButton $Button2.Caption = " " $Button2.Left = 230 $Button2.Top = (100+($i*$shareline)) $Button2.Width = 10 $Button2.Height = 10
$Lbldsk3 = $frmmain1.Controls.Label("E:",260,(70+($i*$shareline))) $Button3 = $FrmMain1.OptionButton $Button3.Caption = " " $Button3.Left = 260 $Button3.Top = (100+($i*$shareline)) $Button3.Width = 10 $Button3.Height = 10; next endif
;*********************************************************** $CmbOk = $FrmMain1.CommandButton("Connect") $CmbOk.Left = 450 $CmbOk.Top = (140+($nombre*$shareline)) $CmbOk.Width = 50 $CmbOk.Heigt = 30 $CmbOk.OnClick = "Ok_Click()"
$CmbExit = $FrmMain1.CommandButton("Cancel") $CmbExit.Left = 520 $CmbExit.Top = (140+($nombre*$shareline)) $CmbExit.Width = 50 $CmbExit.Heigt = 30 $CmbExit.OnClick = "Exit_Click()"
; Show the screen
$FrmMain1.Show While $FrmMain1.Visible $ = Execute($FrmmAin1.DoEvents) Loop Exit 1
$rc=$rc.Close $oXL.Application.Quit
;------------------------------------------------ ; Functions ;------------------------------------------------
Function Ok_Click() $Selection=Messagebox("in order tot hier","Alert",33) Quit() EndFunction
Function Exit_click() Quit() EndFunction
end code
-Shawn
|
|
Top
|
|
|
|
#116822 - 2004-03-25 03:39 PM
Re: kixforms : display multiples lines
|
denayer
Fresh Scripter
Registered: 2000-04-28
Posts: 11
Loc: brussels,belgium
|
Works fine , thank you
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 2375 anonymous users online.
|
|
|