KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Can't get RichTextBox to update

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Fri Nov 03, 2006 11:23 am    Post subject: Can't get RichTextBox to update Reply with quote

Hi!

I have a script where I search AD and it works... partly...

I write a username in a textbox an push the search-button <--- fine!
(it shows the info I want)

I then write a new username in the box and push search <--- Error
(It dosen't update the RichTextBox I have with the new info...)

Here's the "functions" I use
(haven't done the cleaning-part yet, so any golfing/suggestions is very welcome)

Code:
; *************************************
Function Anv_Sok()
  $anv = $Anv_Namn_Text.Text
  $aWhat = "sAMAccountname", "Name", "telephoneNumber", "cn"
  $bWhat = "description"
  $cWhat = "proxyAddresses"
  $aFilter = "(sAMAccountname=" + $anv + ")"
  $aResult = fnLDAPQuery($aWhat,,$aFilter)
  $chkres = Ubound($aResult)
 
  If $chkres <> 0
   $nul = Messagebox("Inget resultat, kontrollera stavningen.","Fel!",4144,10)
  Else
    $konto = $aResult[0,0]
    $namn = $aResult[0,1]
    $tel = $aResult[0,2]
    $CN = $aResult[0,3]

    $bResult = fnLDAPQuery($bWhat,,$aFilter)
    For Each $bResu in $bResult
      For Each $bRes in $bResu
        $bes = $bRes
      Next
    Next

    $usr = $CN + $AdPath
    $User = GetObject("LDAP://CN=" + $usr)
    $Alias = ""
    $SEmail = ""
    For Each $email in $User.proxyAddresses
      Select
        Case Left($email,5) == "SMTP:"
          $PEmail = Substr($email,6)
        Case Left($email,5) == "smtp:"
          $Alias = $Alias + "," + Substr($email,6)
      Endselect
    Next
   
    ; *********** Skapa rtf-fil med info ******************
    Del $usrfile
    $nul = Open(1,$usrfile,5)
    $nul = Writeline(1,$rtfline1 + $namn + $rtfline2 + $bes + $rtfline3 + $tel + $rtfline4 + $PEmail + $rtfline5)
    ; *****************************************************
   
    If $Alias  <> ""
      $aliases = Split(Substr($Alias,2),",")
      $i = 1
      For Each $adr in $aliases
        $nul = Writeline(1,"\ul\b Alias adress " + $i + ":\ulnone\b0\par" + @Crlf + $adr + "\par" + @Crlf)
        $i = $i + 1
      Next
    Endif
    $nul = Writeline(1,$rtfendline)
    $nul = Close(1)
   
    $Anv_Namn_Text.Text = ""
    $Anv_Namn_Text.Focus
           
    ;************** Visa fliken med informationen *****************************

    $TabControl1 = $System.TabControl()
    $TabControl1.Height = 185
    $TabControl1.Left = 5
    $TabControl1.Top = 15
    $TabControl1.Width = 380
    $nul = $GroupBox3.Controls.Add($TabControl1)
   
    $Tab1 = $System.TabPage()
    $Tab1.Font("Microsoft Sans Serif",8.25,5)
    $Tab1.ForeColor = $System.Color.FromName("MenuText")
    $Tab1.Text = $konto
    $nul = $TabControl1.Controls.Add($Tab1)

    $RichTextBox1 = $System.RichTextBox()
    $RichTextBox1.Height = 153
    $RichTextBox1.Left = 2
    $RichTextBox1.ReadOnly = -1  ;True
    $RichTextBox1.LoadFile($usrfile)
    $RichTextBox1.Update
    $RichTextBox1.Top = 3
    $RichTextBox1.Width = 280
    $nul = $Tab1.Controls.Add($RichTextBox1)

    $New_Pwd_Button = $System.Button()
    $New_Pwd_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
    $New_Pwd_Button.Left = 290
    $New_Pwd_Button.Text = "Nytt pwd"
    $New_Pwd_Button.Top = 85
    $nul = $Tab1.Controls.Add($New_Pwd_Button)

  ;**************************************************************************
  Endif
  Check_Acc_info($konto)
   
Endfunction
; *************************************

; *************************************
Function Check_Acc_info($who)
  ;debug on
  $Uobj = Getobject("WinNT://@LDOMAIN/" + $who + ",user")
  If $Uobj
    If $Uobj.IsAccountLocked
      $Acc_Locked_Label = $System.Label()
      $Acc_Locked_Label.Font = $System.Font("Microsoft Sans Serif",9.75,5) ;Bold & Underline
      $Acc_Locked_Label.ForeColor = $System.Color.FromName("Red")
      $Acc_Locked_Label.Left = 5
      $Acc_Locked_Label.Text = "Kontot är låst."
      $Acc_Locked_Label.TextAlign = 16  ;MiddleLeft
      $Acc_Locked_Label.Top = 220
      $Acc_Locked_Label.Width = 165
      $nul = $GroupBox4.Controls.Add($Acc_Locked_Label)
     
      $ACC_Lock_Button = $System.Button()
      $ACC_Lock_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $ACC_Lock_Button.Left = 290
      $ACC_Lock_Button.Text = "Lås upp"
      $ACC_Lock_Button.Top = 15
      $ACC_Lock_Button.Click = "Acc_Unlock($konto)"
      $nul = $Tab1.Controls.Add($ACC_Lock_Button)
    Endif
   
    If $Uobj.AccountDisabled
      $Acc_Disabled_Label = $System.Label()
      $Acc_Disabled_Label.Font = $System.Font("Microsoft Sans Serif",9.75,5) ;Bold & Underline
      $Acc_Disabled_Label.ForeColor = $System.Color.FromName("Red")
      $Acc_Disabled_Label.Left = 5
      $Acc_Disabled_Label.Text = "Kontot är inaktiverat."
      $Acc_Disabled_Label.TextAlign = 16  ;MiddleLeft
      $Acc_Disabled_Label.Top = 245
      $Acc_Disabled_Label.Width = 170
      $nul = $GroupBox4.Controls.Add($Acc_Disabled_Label)
     
      $Acc_Dis_Button = $System.Button()
      $Acc_Dis_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $Acc_Dis_Button.Left = 290
      $Acc_Dis_Button.Text = "Aktivera"
      $Acc_Dis_Button.Top = 50
      $Acc_Dis_Button.Click = "Acc_activate()"
      $nul = $Tab1.Controls.Add($Acc_Dis_Button)
    Else
      $Acc_Dis_Button = $System.Button()
      $Acc_Dis_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $Acc_Dis_Button.Left = 290
      $Acc_Dis_Button.Text = "Inaktivera"
      $Acc_Dis_Button.Top = 50
      $Acc_Dis_Button.Click = "Acc_inactivate()"
      $nul = $Tab1.Controls.Add($Acc_Dis_Button)
    Endif 
Endfunction
; *************************************


As you can se I use Loadfile, and the rtf-file I create updates with the new info, but it dosen't get loaded.

/Viggen
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Nov 03, 2006 12:39 pm    Post subject: Reply with quote

Hi Viggen,
Could you post the entire script so that we could better help you trouble shoot the problem?

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Fri Nov 03, 2006 1:51 pm    Post subject: Reply with quote

Sure Benny, you might recognise a few lines in there Wink
(its the Nexis form)

and as I said before... this is not cleaned up yet, so it has alot of optimizing possibilities Smile
(removing long lines, macros etc.)

Here goes:

Code:

Global $MovingDelta,$MovingFormDelta,$FormLeft,$FormTop,$FormWidth,$FormHeight

Break On

$usr = @UserID
$pwd = Readprofilestring(@scriptdir+"\settings.ini","Pwd","DefPwd")
$adm = Readprofilestring(@scriptdir+"\settings.ini","Admin","Admin")
$AdPath = "," + Readprofilestring(@scriptdir+"\settings.ini","AD","Path")
$rtfline1 = "{\rtf1\ansi\ansicpg1252\deff0\deflang1053{\fonttbl{\f0\fswiss\fcharset0 Arial;}}" + @Crlf + "{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\tx1352\b\f0\fs20 Namn:\b0\tab "
$rtfline2 = "\par" + @Crlf + "\b Beskrivning:\b0\tab "
$rtfline3 = "\par" + @Crlf + "\b Telefon:\b0\tab "
$rtfline4 = "\par" + @Crlf + "\par" + @Crlf + "\pard ********************* \ul\b E-post\ulnone\b0  ********************\par" + @Crlf + "\pard\tx1562\ul\b Prim\'e4r adress:\ulnone\b0\par" + @Crlf
$rtfline5 = "\par" + @Crlf
$rtfendline = "\par" + @Crlf + "\pard **************************************************\par" + @Crlf + "}" + @Crlf
$usrfile = @scriptdir+"\user.rtf"
$HDSrvr = GetObject("LDAP://rootDSE").Get("dnsHostName")

$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

;if you want to modify the text displayed on the form modify '$Form.Text'
;if you want to modify the default form size modify ‘$Form.ClientSize’
$Form = $System.Form()
$Form.Icon = ""
$Form.FormBorderStyle = $System.FormBorderStyle_None
$Form.StartPosition = $System.FormStartPosition_CenterScreen
$Form.ClientSize = $System.Size(600,400) ;(Width,Height)
$Form.Text = "Kontohantering i AD" + @crlf + "( " + $HDSrvr + " )"
$Form.BackColor = $System.Color.Gainsboro
$Form.TransparencyKey = $Form.BackColor
$Form.Tag = "Norm"

$MainPanel = $System.Panel()
$MainPanel.BackColor = $System.Color.FromName("Control") ; $System.Color.FromName("Control")
$MainPanel.Dock = 5  ;Fill
$MainPanel.ForeColor = $System.Color.FromName("ControlDark") ; $System.Color.FromName("ControlDark")
$nul = $Form.Controls.Add($MainPanel)

;if you want to add controls to the form add them to the $MainPanel not the $Form and add them right here
;******************************************************************************************************************************

$GroupBox1 = $System.GroupBox()
$GroupBox1.Height = 155
$GroupBox1.Left = 5
$GroupBox1.Text = ""
$GroupBox1.Top = 0
$GroupBox1.Width = 195
$nul = $MainPanel.Controls.Add($GroupBox1)

$Anv_Namn_Text = $System.TextBox()
$Anv_Namn_Text.Font = $System.Font("Times New Roman",9.75,0) ;Regular
$Anv_Namn_Text.Height = 22
$Anv_Namn_Text.Left = 20
$Anv_Namn_Text.MaxLength = 10
$Anv_Namn_Text.Text = ""
$Anv_Namn_Text.Top = 40
$Anv_Namn_Text.Width = 96
$nul = $GroupBox1.Controls.Add($Anv_Namn_Text)

$Anv_Namn_Label = $System.Label()
$Anv_Namn_Label.Font = $System.Font("Times New Roman",9.75,1) ;Bold
$Anv_Namn_Label.ForeColor = $System.Color.FromName("MenuText")
$Anv_Namn_Label.Left = 20
$Anv_Namn_Label.Text = "Användarnamn"
$Anv_Namn_Label.TextAlign = 32  ;MiddleCenter
$Anv_Namn_Label.Top = 20
$Anv_Namn_Label.Width = 96
$nul = $GroupBox1.Controls.Add($Anv_Namn_Label)

$Anv_Namn_Sok = $System.Button()
$Anv_Namn_Sok.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
$Anv_Namn_Sok.ForeColor = $System.Color.FromName("MenuText")
$Anv_Namn_Sok.Left = 135
$Anv_Namn_Sok.Text = "Sök"
$Anv_Namn_Sok.Top = 40
$Anv_Namn_Sok.Width = 40
$Anv_Namn_Sok.Click = "Anv_Sok()"
$nul = $GroupBox1.Controls.Add($Anv_Namn_Sok)

$GroupBox2 = $System.GroupBox()
$GroupBox2.Height = 155
$GroupBox2.Left = 200
$GroupBox2.Text = ""
$GroupBox2.Top = 0
$GroupBox2.Width = 195
$nul = $MainPanel.Controls.Add($GroupBox2)

$F_Namn_Text = $System.TextBox()
$F_Namn_Text.Font = $System.Font("Times New Roman",9.75,0) ;Regular
$F_Namn_Text.Height = 22
$F_Namn_Text.Left = 20
$F_Namn_Text.MaxLength = 10
$F_Namn_Text.Text = ""
$F_Namn_Text.Top = 40
$F_Namn_Text.Width = 96
$nul = $GroupBox2.Controls.Add($F_Namn_Text)

$F_Namn_Label = $System.Label()
$F_Namn_Label.Font = $System.Font("Times New Roman",9.75,1) ;Bold
$F_Namn_Label.ForeColor = $System.Color.FromName("MenuText")
$F_Namn_Label.Left = 20
$F_Namn_Label.Text = "Förnamn"
$F_Namn_Label.TextAlign = 32  ;MiddleCenter
$F_Namn_Label.Top = 20
$F_Namn_Label.Width = 96
$nul = $GroupBox2.Controls.Add($F_Namn_Label)

$E_Namn_Text = $System.TextBox()
$E_Namn_Text.Font = $System.Font("Times New Roman",9.75,0) ;Regular
$E_Namn_Text.Height = 22
$E_Namn_Text.Left = 20
$E_Namn_Text.MaxLength = 10
$E_Namn_Text.Text = ""
$E_Namn_Text.Top = 95
$E_Namn_Text.Width = 96
$nul = $GroupBox2.Controls.Add($E_Namn_Text)

$E_Namn_Label = $System.Label()
$E_Namn_Label.Font = $System.Font("Times New Roman",9.75,1) ;Bold
$E_Namn_Label.ForeColor = $System.Color.FromName("MenuText")
$E_Namn_Label.Left = 20
$E_Namn_Label.Text = "Efternamn"
$E_Namn_Label.TextAlign = 32  ;MiddleCenter
$E_Namn_Label.Top = 75
$E_Namn_Label.Width = 96
$nul = $GroupBox2.Controls.Add($E_Namn_Label)

$FoE_Namn_Sok = $System.Button()
$FoE_Namn_Sok.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
$FoE_Namn_Sok.ForeColor = $System.Color.FromName("MenuText")
$FoE_Namn_Sok.Left = 135
$FoE_Namn_Sok.Text = "Sök"
$FoE_Namn_Sok.Top = 40
$FoE_Namn_Sok.Width = 40
$FoE_Namn_Sok.Click = "Namn_Sok()"
$nul = $GroupBox2.Controls.Add($FoE_Namn_Sok)

$GroupBox3 = $System.GroupBox()
$GroupBox3.Height = 205
$GroupBox3.Left = 5
$GroupBox3.Text = ""
$GroupBox3.Top = 149
$GroupBox3.Width = 390
$nul = $MainPanel.Controls.Add($GroupBox3)

$GroupBox4 = $System.GroupBox()
$GroupBox4.Height = 354
$GroupBox4.Left = 395
$GroupBox4.Text = ""
$GroupBox4.Top = 0
$GroupBox4.Width = 185
$nul = $MainPanel.Controls.Add($GroupBox4)

$New_Pwd_Label = $System.Label()
$New_Pwd_Label.Font = $System.Font("Microsoft Sans Serif",6.75,0) ;Regular
$New_Pwd_Label.ForeColor = $System.Color.FromName("ControlDarkDark")
$New_Pwd_Label.Height = 12
$New_Pwd_Label.Left = 45
$New_Pwd_Label.Text = "Nytt pwd = " + $pwd
$New_Pwd_Label.Top = 338
$nul = $GroupBox4.Controls.Add($New_Pwd_Label)

;******************************************************************************************************************************

$TopPanel = $System.Panel()
$TopPanel.BackColor = $System.Color.FromName("Control")
$TopPanel.Dock = 1  ;Top
$TopPanel.Height = 30
$nul = $Form.Controls.Add($TopPanel)

$FormLabel = $System.Label()
$FormLabel.BackColor = $System.Color.FromName("Control")
$FormLabel.Dock = 5  ;Fill
$FormLabel.Font = $System.Font("Tahoma",9.75,0) ;Regular
$FormLabel.TextAlign = 32
$FormLabel.Text = $Form.Text
$FormLabel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
$FormLabel.Name = "FormLabel"
$nul = $TopPanel.Controls.Add($FormLabel)

;region Command Panels
$ControlPanel = $System.Panel()
$ControlPanel.BackColor = $System.Color.FromName("Control")
$ControlPanel.Dock = 4  ;Right
$ControlPanel.Width = 85
$ControlPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
$ControlPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
$ControlPanel.MouseHover = "Update_ButtonPanel($$System.Sender)"
$ControlPanel.Name = "ControlPanel"
$nul = $TopPanel.Controls.Add($ControlPanel)

$ControlsPanel = $System.Panel()
$ControlsPanel.BackColor = $System.Color.FromName("Control")
$ControlsPanel.Dock = 1  ;Top
$ControlsPanel.Height = 3
$nul = $ControlPanel.Controls.Add($ControlsPanel)

$CommandsPanel = $System.Panel()
$CommandsPanel.BackColor = $System.Color.FromName("Control")
$CommandsPanel.Dock = 4  ;Right
$CommandsPanel.Width = 85
$nul = $ControlsPanel.Controls.Add($CommandsPanel)

$ButtonPanel = $System.Panel()
$ButtonPanel.Cursor = $System.Cursors.SizeAll
$ButtonPanel.Dock = 2  ;Bottom
$ButtonPanel.Height = 30
$ButtonPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
$ButtonPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
$ButtonPanel.MouseMove = "Update_ButtonPanel($$System.Sender)"
$ButtonPanel.Name = "ButtonPanel"
$nul = $CommandsPanel.Controls.Add($ButtonPanel)

$ButtonPanel.BackGroundImage = ButtonPanelBackGroundImage()

$CloseFormButton = $System.Button()
$CloseFormButton.Click = "CloseForm()"
$CloseFormButton.MouseEnter = "Update_ButtonPanel($$System.Sender)"
$CloseFormButton.MouseLeave = "Update_ButtonPanel($$System.Sender)"
$CloseFormButton.Cursor = $System.Cursors.Default
$CloseFormButton.Height = 25
$CloseFormButton.Left = 56
$CloseFormButton.Top = 1
$CloseFormButton.Width = 25
$CloseFormButton.Name = "CloseFormButton"
$nul = $ButtonPanel.Controls.Add($CloseFormButton)

$CloseFormButton.Image = CloseFormButtonImage()

$MaxResFormButton = $System.Button()
$MaxResFormButton.BackColor = $System.Color.FromName("White")
$MaxResFormButton.Click = "MaxResForm()"
$MaxResFormButton.Cursor = $System.Cursors.Default
$MaxResFormButton.Height = 25
$MaxResFormButton.Left = 33
$MaxResFormButton.Text = ""
$MaxResFormButton.Top = 1
$MaxResFormButton.Width = 25
$nul = $ButtonPanel.Controls.Add($MaxResFormButton)

$MaxResFormButton.Image = MaxFormButtonImage()

$MinResFormButton = $System.Button()
$MinResFormButton.BackColor = $System.Color.FromName("White")
$MinResFormButton.Click = "MinResForm()"
$MinResFormButton.Cursor = $System.Cursors.Default
$MinResFormButton.Height = 25
$MinResFormButton.Left = 10
$MinResFormButton.Text = ""
$MinResFormButton.Top = 1
$MinResFormButton.Width = 25
$nul = $ButtonPanel.Controls.Add($MinResFormButton)

$MinResFormButton.Image = MinFormButtonImage()
;endregion

;region Border
$LeftBorder = $System.Panel()
$LeftBorder.Cursor = $System.Cursors.SizeWE
$LeftBorder.Dock = 3  ;Left
$LeftBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
$LeftBorder.MouseDown = "Mouse_Down()"
$LeftBorder.Name = "LeftBorder"
$LeftBorder.Width = 8
$nul = $Form.Controls.Add($LeftBorder)

$LeftBorder.BackGroundImage = LeftBorderBackGroundImage()

$RightBorder = $System.Panel()
$RightBorder.Cursor = $System.Cursors.SizeWE
$RightBorder.Dock = 4  ;Right
$RightBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
$RightBorder.MouseDown = "Mouse_Down()"
$RightBorder.Name = "RightBorder"
$RightBorder.Width = 8
$nul = $Form.Controls.Add($RightBorder)

$RightBorder.BackGroundImage = RightBorderBackGroundImage()

$TopBorder = $System.Panel()
$TopBorder.Cursor = $System.Cursors.SizeNS
$TopBorder.Dock = 1  ;Top
$TopBorder.Height = 4
$TopBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
$TopBorder.MouseDown = "Mouse_Down()"
$TopBorder.Name = "TopBorder"
$nul = $Form.Controls.Add($TopBorder)

$TopBorder.BackGroundImage = TopBorderBackGroundImage()

$TopLeftCorner = $System.Panel()
$TopLeftCorner.Cursor = $System.Cursors.SizeNWSE
$TopLeftCorner.Dock = 3  ;Left
$TopLeftCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
$TopLeftCorner.MouseDown = "Mouse_Down()"
$TopLeftCorner.Name = "TopLeftCorner"
$TopLeftCorner.Width = 8
$nul = $TopBorder.Controls.Add($TopLeftCorner)

$TopLeftCorner.BackGroundImage = TopLeftCornerBackGroundImage()

$TopRightCorner = $System.Panel()
$TopRightCorner.Cursor = $System.Cursors.SizeNESW
$TopRightCorner.Dock = 4  ;Right
$TopRightCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
$TopRightCorner.MouseDown = "Mouse_Down()"
$TopRightCorner.Name = "TopRightCorner"
$TopRightCorner.Width = 8
$nul = $TopBorder.Controls.Add($TopRightCorner)

$TopRightCorner.BackGroundImage = TopRightCornerBackGroundImage()

$BottomBorder = $System.Panel()
$BottomBorder.Cursor = $System.Cursors.SizeNS
$BottomBorder.Dock = 2  ;Bottom
$BottomBorder.Height = 8
$BottomBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
$BottomBorder.MouseDown = "Mouse_Down()"
$BottomBorder.Name = "BottomBorder"
$nul = $Form.Controls.Add($BottomBorder)

$BottomBorder.BackGroundImage = BottomBorderBackGroundImage()

$BottomLeftCorner = $System.Panel()
$BottomLeftCorner.Cursor = $System.Cursors.SizeNESW
$BottomLeftCorner.Dock = 3  ;Left
$BottomLeftCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
$BottomLeftCorner.MouseDown = "Mouse_Down()"
$BottomLeftCorner.Name = "BottomLeftCorner"
$BottomLeftCorner.Width = 8
$nul = $BottomBorder.Controls.Add($BottomLeftCorner)

$BottomLeftCorner.BackGroundImage = BottomLeftCornerBackGroundImage()

$BottomRightCorner = $System.Panel()
$BottomRightCorner.Cursor = $System.Cursors.SizeNWSE
$BottomRightCorner.Dock = 4  ;Right
$BottomRightCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
$BottomRightCorner.MouseDown = "Mouse_Down()"
$BottomRightCorner.Name = "BottomRightCorner"
$BottomRightCorner.Width = 8
$nul = $BottomBorder.Controls.Add($BottomRightCorner)

$BottomRightCorner.BackGroundImage = BottomRightCornerBackGroundImage()
;endregion

Set_Env()
$Form.Show  ;Displays the Form

While $Form.Visible
   $Nul = Execute($Form.DoEvents())
Loop
Exit 0

; *********************************************** User Fuctions ***************************************************************

; *************************************
Function Set_Env()
  $Anv_Namn_Sok.Focus
  If $usr == $adm
    $Change_DefPwd_Button = $System.Button()
    $Change_DefPwd_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
    $Change_DefPwd_Button.ForeColor = $System.Color.FromName("MenuText")
    $Change_DefPwd_Button.Left = 10
    $Change_DefPwd_Button.Text = "Ändra def. pwd"
    $Change_DefPwd_Button.Top = 15
    $Change_DefPwd_Button.Width = 100
    $Change_DefPwd_Button.Click = "Change_DefPwd_Form()"
    $nul = $GroupBox4.Controls.Add($Change_DefPwd_Button)

    $Sync_Domain_Button = $System.Button()
    $Sync_Domain_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
    $Sync_Domain_Button.ForeColor = $System.Color.FromName("MenuText")
    $Sync_Domain_Button.Left = 10
    $Sync_Domain_Button.Text = "Sync. AD"
    $Sync_Domain_Button.Top = 50
    $Sync_Domain_Button.Width = 100
    $Sync_Domain_Button.Click = "SyncAD()"
    $nul = $GroupBox4.Controls.Add($Sync_Domain_Button)
  Else
    $Sync_Domain_Button = $System.Button()
    $Sync_Domain_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
    $Sync_Domain_Button.ForeColor = $System.Color.FromName("MenuText")
    $Sync_Domain_Button.Left = 10
    $Sync_Domain_Button.Text = "Sync. AD"
    $Sync_Domain_Button.Top = 15
    $Sync_Domain_Button.Width = 100
    $Sync_Domain_Button.Click = "SyncAD()"
    $nul = $GroupBox4.Controls.Add($Sync_Domain_Button)
  Endif
Endfunction
; *************************************

; *************************************
Function Change_DefPwd_Form()
  $New_Pwd_Form = $System.Form()
  $New_Pwd_Form.FormBorderStyle = 5  ;FormBorderStyle_FixedToolWindow
  $New_Pwd_Form.SysMenu = 1
  $New_Pwd_Form.MaximizeBox = 0  ;False
  $New_Pwd_Form.MinimizeBox = 0  ;False
  $New_Pwd_Form.StartPosition = 1  ;FormStartPosition_CenterScreen
  $New_Pwd_Form.Size = $System.Size(252,105) ;(Width,Height)
  $New_Pwd_Form.Text = ""

  $OldPwd_Label = $System.Label()
  $OldPwd_Label.Dock = 1  ;Top
  $OldPwd_Label.ForeColor = $System.Color.FromName("ControlDarkDark")
  $OldPwd_Label.Height = 12
  $OldPwd_Label.Text = "Nuvarande pwd = " + $pwd
  $OldPwd_Label.TextAlign = 2  ;TopCenter
  $nul = $New_Pwd_Form.Controls.Add($OldPwd_Label)

  $New_Pwd_Text = $System.TextBox()
  $New_Pwd_Text.Font = $System.Font("Times New Roman",9.75,0) ;Regular
  $New_Pwd_Text.ForeColor = $System.Color.FromName("MenuText")
  $New_Pwd_Text.Height = 22
  $New_Pwd_Text.Left = 5
  $New_Pwd_Text.MaxLength = 20
  $New_Pwd_Text.PasswordChar = "*"
  $New_Pwd_Text.Text = ""
  $New_Pwd_Text.Top = 20
  $New_Pwd_Text.Width = 140
  $New_Pwd_Text.WordWrap = 0  ;False
  $nul = $New_Pwd_Form.Controls.Add($New_Pwd_Text)

  $New_Pwd_Confirm_Text = $System.TextBox()
  $New_Pwd_Confirm_Text.Font = $System.Font("Times New Roman",9.75,0) ;Regular
  $New_Pwd_Confirm_Text.ForeColor = $System.Color.FromName("MenuText")
  $New_Pwd_Confirm_Text.Height = 22
  $New_Pwd_Confirm_Text.Left = 5
  $New_Pwd_Confirm_Text.MaxLength = 20
  $New_Pwd_Confirm_Text.PasswordChar = "*"
  $New_Pwd_Confirm_Text.Text = ""
  $New_Pwd_Confirm_Text.Top = 50
  $New_Pwd_Confirm_Text.Width = 140
  $New_Pwd_Confirm_Text.WordWrap = 0  ;False
  $nul = $New_Pwd_Form.Controls.Add($New_Pwd_Confirm_Text)

  $New_Pwd_Save_Button = $System.Button()
  $New_Pwd_Save_Button.ForeColor = $System.Color.FromName("MenuText")
  $New_Pwd_Save_Button.Left = 165
  $New_Pwd_Save_Button.Text = "Spara"
  $New_Pwd_Save_Button.Top = 18
  $New_Pwd_Save_Button.Click = "Change_DefPwd()"
  $nul = $New_Pwd_Form.Controls.Add($New_Pwd_Save_Button)

  $New_Pwd_Cancel_Button = $System.Button()
  $New_Pwd_Cancel_Button.ForeColor = $System.Color.FromName("MenuText")
  $New_Pwd_Cancel_Button.Left = 165
  $New_Pwd_Cancel_Button.Text = "Avbryt"
  $New_Pwd_Cancel_Button.Top = 48
  $New_Pwd_Cancel_Button.Click = "Change_DefPwd_Close()"
  $nul = $New_Pwd_Form.Controls.Add($New_Pwd_Cancel_Button)

  $New_Pwd_Form.Show
Endfunction
; *************************************

; *************************************
Function Change_DefPwd_Close()
  $New_Pwd_Text.Text = ""
  $New_Pwd_Confirm_Text.Text = ""
  $New_Pwd_Form.Hide
Endfunction
; *************************************

; *************************************
Function Change_DefPwd()
  Select
    Case $New_Pwd_Text.Text = "" OR $New_Pwd_Confirm_Text.Text = ""
      $nul = Messagebox("Blanka lösenord är inte tillåtna","Fel!",4144,10)
      $New_Pwd_Text.Text = ""
      $New_Pwd_Confirm_Text.Text = ""
      $New_Pwd_Text.Focus
    Case $New_Pwd_Text.Text == $New_Pwd_Confirm_Text.Text
      $nul = Writeprofilestring(@scriptdir + "\settings.ini","Pwd","DefPwd",$New_Pwd_Text.Text)
      $New_Pwd_Text.Text = ""
      $New_Pwd_Confirm_Text.Text = ""
      $New_Pwd_Form.Hide
      $pwd = Readprofilestring(@scriptdir+"\settings.ini","Pwd","DefPwd")
      $OldPwd_Label.Text = "Nuvarande pwd = " + $pwd
      $New_Pwd_Label.Text = "Nytt pwd = " + $pwd
    Case 1
      $nul = Messagebox("Du måste matcha lösenorden i båda rutorna","Fel!",4144,10)
      $New_Pwd_Text.Text = ""
      $New_Pwd_Confirm_Text.Text = ""
      $New_Pwd_Text.Focus
  Endselect
Endfunction
; *************************************

; *************************************
Function Anv_Sok()
  $anv = $Anv_Namn_Text.Text
  $aWhat = "sAMAccountname", "Name", "telephoneNumber", "cn"
  $bWhat = "description"
  $cWhat = "proxyAddresses"
  $aFilter = "(sAMAccountname=" + $anv + ")"
  $aResult = fnLDAPQuery($aWhat,,$aFilter)
  $chkres = Ubound($aResult)
 
  If $chkres <> 0
   $nul = Messagebox("Inget resultat, kontrollera stavningen.","Fel!",4144,10)
  Else
    $konto = $aResult[0,0]
    $namn = $aResult[0,1]
    $tel = $aResult[0,2]
    $CN = $aResult[0,3]

    $bResult = fnLDAPQuery($bWhat,,$aFilter)
    For Each $bResu in $bResult
      For Each $bRes in $bResu
        $bes = $bRes
      Next
    Next

    $usr = $CN + $AdPath
    $User = GetObject("LDAP://CN=" + $usr)
    $Alias = ""
    $SEmail = ""
    For Each $email in $User.proxyAddresses
      Select
        Case Left($email,5) == "SMTP:"
          $PEmail = Substr($email,6)
        Case Left($email,5) == "smtp:"
          $Alias = $Alias + "," + Substr($email,6)
      Endselect
    Next
   
    ; *********** Skapa rtf-fil med info ******************
    Del $usrfile
    $nul = Open(1,$usrfile,5)
    $nul = Writeline(1,$rtfline1 + $namn + $rtfline2 + $bes + $rtfline3 + $tel + $rtfline4 + $PEmail + $rtfline5)
    ; *****************************************************
   
    If $Alias  <> ""
      $aliases = Split(Substr($Alias,2),",")
      $i = 1
      For Each $adr in $aliases
        $nul = Writeline(1,"\ul\b Alias adress " + $i + ":\ulnone\b0\par" + @Crlf + $adr + "\par" + @Crlf)
        $i = $i + 1
      Next
    Endif
    $nul = Writeline(1,$rtfendline)
    $nul = Close(1)
   
    $Anv_Namn_Text.Text = ""
    $Anv_Namn_Text.Focus
           
    ;************** Visa fliken med informationen *****************************

    $TabControl1 = $System.TabControl()
    $TabControl1.Height = 185
    $TabControl1.Left = 5
    $TabControl1.Top = 15
    $TabControl1.Width = 380
    $nul = $GroupBox3.Controls.Add($TabControl1)
   
    $Tab1 = $System.TabPage()
    $Tab1.Font("Microsoft Sans Serif",8.25,5)
    $Tab1.ForeColor = $System.Color.FromName("MenuText")
    $Tab1.Text = $konto
    $nul = $TabControl1.Controls.Add($Tab1)

    $RichTextBox1 = $System.RichTextBox()
    $RichTextBox1.Height = 153
    $RichTextBox1.Left = 2
    $RichTextBox1.ReadOnly = -1  ;True
    $RichTextBox1.LoadFile($usrfile)
    $RichTextBox1.Update
    $RichTextBox1.Top = 3
    $RichTextBox1.Width = 280
    $nul = $Tab1.Controls.Add($RichTextBox1)

    $New_Pwd_Button = $System.Button()
    $New_Pwd_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
    $New_Pwd_Button.Left = 290
    $New_Pwd_Button.Text = "Nytt pwd"
    $New_Pwd_Button.Top = 85
    $nul = $Tab1.Controls.Add($New_Pwd_Button)

  ;**************************************************************************
  Endif
  Check_Acc_info($konto)
   
Endfunction
; *************************************

; *************************************
Function Check_Acc_info($who)
  ;debug on
  $Uobj = Getobject("WinNT://@LDOMAIN/" + $who + ",user")
  If $Uobj
    If $Uobj.IsAccountLocked
      $Acc_Locked_Label = $System.Label()
      $Acc_Locked_Label.Font = $System.Font("Microsoft Sans Serif",9.75,5) ;Bold & Underline
      $Acc_Locked_Label.ForeColor = $System.Color.FromName("Red")
      $Acc_Locked_Label.Left = 5
      $Acc_Locked_Label.Text = "Kontot är låst."
      $Acc_Locked_Label.TextAlign = 16  ;MiddleLeft
      $Acc_Locked_Label.Top = 220
      $Acc_Locked_Label.Width = 165
      $nul = $GroupBox4.Controls.Add($Acc_Locked_Label)
     
      $ACC_Lock_Button = $System.Button()
      $ACC_Lock_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $ACC_Lock_Button.Left = 290
      $ACC_Lock_Button.Text = "Lås upp"
      $ACC_Lock_Button.Top = 15
      $ACC_Lock_Button.Click = "Acc_Unlock($konto)"
      $nul = $Tab1.Controls.Add($ACC_Lock_Button)
    Endif
   
    If $Uobj.AccountDisabled
      $Acc_Disabled_Label = $System.Label()
      $Acc_Disabled_Label.Font = $System.Font("Microsoft Sans Serif",9.75,5) ;Bold & Underline
      $Acc_Disabled_Label.ForeColor = $System.Color.FromName("Red")
      $Acc_Disabled_Label.Left = 5
      $Acc_Disabled_Label.Text = "Kontot är inaktiverat."
      $Acc_Disabled_Label.TextAlign = 16  ;MiddleLeft
      $Acc_Disabled_Label.Top = 245
      $Acc_Disabled_Label.Width = 170
      $nul = $GroupBox4.Controls.Add($Acc_Disabled_Label)
     
      $Acc_Dis_Button = $System.Button()
      $Acc_Dis_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $Acc_Dis_Button.Left = 290
      $Acc_Dis_Button.Text = "Aktivera"
      $Acc_Dis_Button.Top = 50
      $Acc_Dis_Button.Click = "Acc_activate()"
      $nul = $Tab1.Controls.Add($Acc_Dis_Button)
    Else
      $Acc_Dis_Button = $System.Button()
      $Acc_Dis_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
      $Acc_Dis_Button.Left = 290
      $Acc_Dis_Button.Text = "Inaktivera"
      $Acc_Dis_Button.Top = 50
      $Acc_Dis_Button.Click = "Acc_inactivate()"
      $nul = $Tab1.Controls.Add($Acc_Dis_Button)
    Endif 
Endfunction
; *************************************

/*

; *************************************
Function
Endfunction
; *************************************

*/

; *****************************************************************************************************************************


; *********************************** UDF's ***********************************************************************************

Function fnLDAPQuery($What,Optional $From,Optional $Filter,Optional $OrderBy,Optional $Scope,Optional $User,Optional $Pswd)
   
    Dim $oCon,$oCMD,$oRS,$sQ,$aR,$C,$R
   
    $sQ="<"+Iif($From="","LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext"),
        $From)+">;"+$Filter+";"+Iif(VarType($What)>8192,Join($What,','),$What)+";"+
        Iif($Scope<>"base" AND $Scope<>"onelevel","subtree",$Scope)
   
    $oCon=CreateObject("ADODB.Connection")
    $oCon.Provider="ADsDSOObject"
    $oCon.Properties("Encrypt Password").Value=1
    $oCon.Properties("ADSI Flag").Value=1
    If $User AND $Pswd
        $oCon.Properties("User ID").Value=$User
        $oCon.Properties("Password").Value=$Pswd
    EndIf
    $oCon.Open("Active Directory Provider")
     
    $oCMD=CreateObject("ADODB.Command")
    $oCMD.ActiveConnection=$oCon
    $oCMD.CommandText=$sQ
    $oCMD.Properties("Page Size").Value=1000
    $oCMD.Properties("Timeout").Value=30
    $oCMD.Properties("Cache Results").Value=0
   
    If InStr($OrderBy,"distinguishedName")
        $oRS=CreateObject("ADODB.Recordset")
        $oRS.CursorLocation=3
        $oRS.Sort=$OrderBy
        $oRS.Open($sQ,$oCon,0,1,1)
    Else
        If $OrderBy
            $oCMD.Properties("Sort On").Value=$OrderBy
        EndIf
        $oRS=$oCMD.Execute
    EndIf
    If @ERROR Exit @ERROR EndIf
    If $oRS.BOF AND $oRS.EOF Exit @ERROR EndIf
   
    $aR = $oRS.GetRows()
    Dim $aFR[Ubound($aR,2),Ubound($aR,1)]
    For $R=0 to Ubound($aR,2)
        For $C=0 to Ubound($aR,1)
            $aFR[$R,$C]=$aR[$C,$R]
        Next
    Next
   
    $fnLDAPQuery=$aFR
EndFunction

; *****************************************************************************************************************************


; ******************************************** Nexis Form Functions ***********************************************************

;region Form Functions
Function ShowControls()
   $FormLabel.MouseEnter = ""
   $ButtonPanel.MouseEnter = ""
   $ButtonPanel.MouseLeave = ""
   $ButtonPanel.MouseMove = ""
   $ControlPanel.MouseEnter = ""
   $ControlPanel.MouseHover = ""
   $ControlPanel.MouseLeave = ""
   $CloseFormButton.MouseEnter = ""
   $CloseFormButton.MouseLeave = ""
   For $y = 4 to 30
      $ControlsPanel.Height = $y
      If $y > 5
         $CloseFormButton.Visible = -1
      EndIf
      Sleep 0.01
   Next
   $FormLabel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseMove = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseHover = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
   $CloseFormButton.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $CloseFormButton.MouseLeave = "Update_ButtonPanel($$System.Sender)"
EndFunction

Function HideControls()
   $FormLabel.MouseEnter = ""
   $ButtonPanel.MouseEnter = ""
   $ButtonPanel.MouseLeave = ""
   $ButtonPanel.MouseMove = ""
   $ControlPanel.MouseEnter = ""
   $ControlPanel.MouseHover = ""
   $ControlPanel.MouseLeave = ""
   $CloseFormButton.MouseEnter = ""
   $CloseFormButton.MouseLeave = ""
   For $y = 30 to 3 step-1
      $ControlsPanel.Height = $y
      If $y > 5
         $CloseFormButton.Visible = -1
      EndIf
      Sleep 0.01
   Next
   $FormLabel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
   $ButtonPanel.MouseMove = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseHover = "Update_ButtonPanel($$System.Sender)"
   $ControlPanel.MouseLeave = "Update_ButtonPanel($$System.Sender)"
   $CloseFormButton.MouseEnter = "Update_ButtonPanel($$System.Sender)"
   $CloseFormButton.MouseLeave = "Update_ButtonPanel($$System.Sender)"
EndFunction

Function Update_ButtonPanel($Sender)
   
   $Control = Form_FindControl($Form,$Sender)
   If $Control.Name = "ControlPanel"
      ShowControls()
   Else
      If Not($Control.Name = "ButtonPanel")
         If $ControlsPanel.Height = 30
            HideControls()
         EndIf
      EndIf
      If $Sender.Name = "FormLabel"
         If $ControlsPanel.Height = 30
            HideControls()
         EndIf
      EndIf
      Select
         Case $Control.Name = "ButtonPanel"
            If ($ButtonPanel.MouseButtons & $System.MouseButtons_Left)
               $MovingFormDelta = $Form.PointToClient($Form.FindForm().MousePosition)
               $ButtonPanel.MouseMove = "FormMove('ButtonPanel')"
            Else
               $ButtonPanel.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "LeftBorder"
            If ($LeftBorder.MouseButtons & $System.MouseButtons_Left)
               $LeftBorder.MouseMove = "FormReSize('LeftBorder')"
            Else
               $LeftBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "TopBorder"
            If ($TopBorder.MouseButtons & $System.MouseButtons_Left)
               $TopBorder.MouseMove = "FormReSize('TopBorder')"
            Else
               $TopBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "RightBorder"
            If ($RightBorder.MouseButtons & $System.MouseButtons_Left)
               $RightBorder.MouseMove = "FormReSize('RightBorder')"
            Else
               $RightBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "BottomBorder"
            If ($BottomBorder.MouseButtons & $System.MouseButtons_Left)
               $BottomBorder.MouseMove = "FormReSize('BottomBorder')"
            Else
               $BottomBorder.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "TopLeftCorner"
            If ($TopLeftCorner.MouseButtons & $System.MouseButtons_Left)
               $TopLeftCorner.MouseMove = "FormReSize('TopLeftCorner')"
            Else
               $TopLeftCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "TopRightCorner"
            If ($TopRightCorner.MouseButtons & $System.MouseButtons_Left)
               $TopRightCorner.MouseMove = "FormReSize('TopRightCorner')"
            Else
               $TopRightCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "BottomLeftCorner"
            If ($BottomLeftCorner.MouseButtons & $System.MouseButtons_Left)
               $BottomLeftCorner.MouseMove = "FormReSize('BottomLeftCorner')"
            Else
               $BottomLeftCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
         Case $Control.Name = "BottomRightCorner"
            If ($BottomRightCorner.MouseButtons & $System.MouseButtons_Left)
               $BottomRightCorner.MouseMove = "FormReSize('BottomRightCorner')"
            Else
               $BottomRightCorner.MouseMove = "Update_ButtonPanel($$System.Sender)"
            EndIf
      EndSelect
   EndIf
   
EndFunction

Function Form_FindControl($s,$Control)

   Dim $c,$MousePosition
   
   $MousePosition = $s.PointToClient($s.FindForm().MousePosition)
   $c = $s.GetChildAtPoint($MousePosition)
   
   If $c
      If $c.Type.Name = "Panel"
         $Form_FindControl = Form_FindControl($c,$Control)
      EndIf
   Else
      $Form_FindControl = $s
   EndIf
   
EndFunction

Function FormMove($Name)
   If $Name = "ButtonPanel" And $Form.Tag = "Norm"
      If $ControlsPanel.Height = 30
         If ($ButtonPanel.MouseButtons & $System.MouseButtons_Left)
            $MousePosition = $Form.PointToClient($Form.MousePosition)
            $Left = $MovingFormDelta.x - $MousePosition.x
            $Top = $MovingFormDelta.y - $MousePosition.y
            $Form.Left = $Form.Left - $Left
            $Form.Top = $Form.Top - $Top
         EndIf
      EndIf
   EndIf
EndFunction

Function FormReSize($Name)
   If $Form.Tag = "Norm"
      Select
         Case $Name = "LeftBorder"
            If ($LeftBorder.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Left = $MovingDelta.x - $MousePosition.x
               $Form.Width = $Form.Width + $Left
               $Form.Left = $Form.Left - $Left
            EndIf
         Case $Name = "TopBorder"
            If ($TopBorder.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Top = $MovingDelta.y - $MousePosition.y
               $Form.Height = $Form.Height + $Top
               $Form.Top = $Form.Top - $Top
            EndIf
         Case $Name = "RightBorder"
            If ($RightBorder.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Form.Width = $MousePosition.x
            EndIf
         Case $Name = "BottomBorder"
            If ($BottomBorder.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Form.Height = $MousePosition.y
            EndIf
         Case $Name = "TopLeftCorner"
            If ($TopLeftCorner.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Left = $MovingDelta.x - $MousePosition.x
               $Top = $MovingDelta.y - $MousePosition.y
               $Form.Height = $Form.Height + $Top
               $Form.Width = $Form.Width + $Left
               $Form.Left = $Form.Left - $Left
               $Form.Top = $Form.Top - $Top
            EndIf
         Case $Name = "TopRightCorner"
            If ($TopRightCorner.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Top = $MovingDelta.y - $MousePosition.y
               $Form.Height = $Form.Height + $Top
               $Form.Width = $MousePosition.x
               $Form.Top = $Form.Top - $Top
            EndIf
         Case $Name = "BottomLeftCorner"
            If ($BottomLeftCorner.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Left = $MovingDelta.x - $MousePosition.x
               $Form.Height = $MousePosition.y
               $Form.Width = $Form.Width + $Left
               $Form.Left = $Form.Left - $Left
            EndIf
         Case $Name = "BottomRightCorner"
            If ($BottomRightCorner.MouseButtons & $System.MouseButtons_Left)
               $MousePosition = $Form.PointToClient($Form.FindForm().MousePosition)
               $Form.Height = $MousePosition.y
               $Form.Width = $MousePosition.x
            EndIf
      EndSelect
   EndIf
EndFunction

Function MinResForm()
   If $Form.WindowState = $System.FormWindowState_Normal
      $Form.WindowState = $System.FormWindowState_Minimized
   Else
      If $Form.Tag = "Max"
         $Form.WindowState = $System.FormWindowState_Minimized
         $Form.Tag = "Min"
      Else
         $Form.WindowState = $System.FormWindowState_Normal
         $Form.Tag = "Norm"
      EndIf
   EndIf
   HideControls()
EndFunction

Function MaxResForm()
   If $Form.Tag = "Norm"
      $FormLeft = $Form.Left
      $FormTop = $Form.Top
      $FormWidth = $Form.Width
      $FormHeight = $Form.Height
      $Form.Bounds = $System.Screen.WorkingArea
      $ButtonPanel.Cursor = $System.Cursors.Default
      $MaxResFormButton.Image = ResFormButtonImage()
      $Form.Tag = "Max"
   Else
      $Form.WindowState = $System.FormWindowState_Minimized
      $Form.Bounds = $System.Rectangle($FormLeft,$FormTop,$FormWidth,$FormHeight)
      $Form.WindowState = $System.FormWindowState_Normal
      $ButtonPanel.Cursor = $System.Cursors.SizeAll
      $MaxResFormButton.Image = MaxFormButtonImage()
      $Form.Tag = "Norm"
   EndIf
   HideControls()
EndFunction

Function Mouse_Down()
   $MovingDelta = 0
   $MovingDelta = $Form.PointToClient($Form.FindForm().MousePosition)
   $=SetFocus("Program Manager")
   $=SendKeys("{F5}")
EndFunction

Function CloseForm()
   Quit()
EndFunction
;endregion

;region Images
Function CloseFormButtonImage()
$CloseFormButtonImage = "
iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
BBZJREFUOE+V02tM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vOYZL8JkVVEsh
sKtAuwrYi6G9ENrz6TYlaslgmiSsWYQXj5Mz1YeBiu/JjpxNjeD8en70T1XC51rpC+OJDUu2
tynHa1F4rQqfNYu0yIBJAvQiqI2HtQJYFQVK3/EWRC6d4N1LDv17PPjytx/rpPMFgvnShIVq
8YJGsqBJXVCnLGqSl9Ti5ZrE1ZqE1cpYT7lgVRXtKTy4mvv2kjziiYx3v0QU8s6vdjY9i4+r
pXfTo6bkR+8rYiaVxyblMVNKwbRSMKM4MiePeph16FHmu3OyA3PStx6lRcyk8KZKRP6nC84b
2zy+fdd58/W+0/KfrzD4K8b8xp//BIXOP+c4B7r8AAAAAElFTkSuQmCC"
$CloseFormButtonImage = $System.Bitmap.FromBase64String($CloseFormButtonImage)
EndFunction

Function MaxFormButtonImage()
$MaxFormButtonImage = "
iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
A+pJREFUOE+V019MW1UcB/CCVt0WcNBJIFRqx4odFgTWjYxSCaylZUAdjNXBaIEySlvaQktp
SyktsDGdGxtx02W4+Cc+mJgYE2NUsoEY4rNGX4yasBVaNBMHt+f8zkVC9FzSxsQHiTcnuck5
+dzvPd9zL4/fFjW/9TC6tvXX/7zMNx/y9cs8843ffoluD86wnVfJmYvQGAJtANd4scqPXxrk
hsLFjSN2REeJDUnPI5Hhkbz3/vc/M9TyaKr3Djv9yebNTzcnP2SH7rDOW6zlDWKeJqZrpOMq
MV4hra+BfhJOTUBdEFcN4bI+Jr99uaT9m+jvW5zvmSa3Ptuc+eLPyx9tBt5j3TOs4036CLbn
OveIrilieJ20vgrNF6AhBCd8uNzJSDuWn6mdpZbzZy8BlVMfb4Y/YF23WdsN9vw1YqTmEmmZ
gKYxqA/ik0FuRzS8wo3kdqawazlbezfhmydg+F02+D6Hdy2xtA+VWDdkppVnG+4lPO2M7nlg
J3lXX2TFxVZG1h39x9cOY7pbinuu7+4LLVhmZQpNK8KGuUQ+9fTwTFNs5xVCp1omiC4IGj9U
e3CFC8udqKgPS634UC+mq5JefNjCHO5eya1P+ko3ovXSkg2XOX96HHQh0ARwtR9XeLDcjWX9
+Hk7zrcBXT1owRIrIzHFcurnE/nlTtQ0Dq9McoXTqeZx7ivSjED1MCh8WO7BMjcU9MNBB+dF
NhDb4mJTLKsu6cv6UP0obrkA+os7fgIax0A7CjVBqAyA3A9FXigYJGIXtyp0gNCGhF2xTO1X
ifwXzIierS4MVNKpJurHiTYMJ8KgDMHRIBQFSIGPiD2cz3aSbBvK6lh9WrOQ8BJTXDmItCNY
N8Z53TjUj4EmDDVhqAzDsTApCpKCYfY5H+ez+onAivYbft2rSubnGeLHnIj+M3UjXMMnQ0Qb
AnUYqsdAEYaj1I8SSYDN83Gnm+EgaWa0r3X1iepkfnZrvNiCKlyoxsf5/77S7eyebsTXr6ZW
JfMP6OMSE6If5nEXUnqw0gOKIXzci8t9uMwPMj+R+IjIS3LcJMPJ7rMQfidKPR1LUSb7Tz+1
Jjz3SNq9/qJl/Ujfhty+UWpnSh1McT9TOMBIBuKi/niOAwlsiL75k53x1LZ1XmOEV7Hz/0X/
2JYalwQvL+WeWRK3RSTtDwoM9w+1P8g3RsTGSJ4xktsRzTJGBYZY+rnonrOxx1tiKboIT/2D
SPcl53vfge9+2pDqF9OqPs9QzWWq7x5Qz2aqZgXqe4Lauf3q+TT1wl7110+pFmlhj1UtpFQt
8hTzIt3stz+umd/GPL55i952a+3f69G1bfPtOL+L/A0RxnE4qAfXFwAAAABJRU5ErkJggg==
"
$MaxFormButtonImage = $System.Bitmap.FromBase64String($MaxFormButtonImage)
EndFunction

Function MinFormButtonImage()
$MinFormButtonImage = "
iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQ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06HDL+hPFkfzEllCODklsqMS1v8/20kwPPe6ixxw01kQPdqPo5vUD
RZH8o80hvjr8YZ6zIakTS51Q2IfP9eMCF853g9BN+C6S1k+S7CTOQg/rSHQnOtAQiJJG+h9b
u5HS9lDQvXlGt3nWuCU2beWZgnnmYI41mN0b5PeG0qyhJDPiGhA7+ZOdoQOtm5waH0fy6P75
/9wVqFa4L60kN63wWn389gdZyvuZ7Q8yVD6eypeq8iV3+BNUfq4yENvmP3gp8HhjIErh48h+
SFN8Gfbad+C7n7YEzcsxRZ/HlS3Ey+4elc3Hl81zZfe45QtHZIsxsqVDsq+fKltmDXusaCmq
aJlTuJimmP/2xw1mOdGaHc3b+7ftP36I/o1dppj9B/XwP5bR+1+tAAAAAElFTkSuQmCC"
$MinFormButtonImage = $System.Bitmap.FromBase64String($MinFormButtonImage)
EndFunction

Function ResFormButtonImage()
$ResFormButtonImage = "
iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
A/1JREFUOE+VlG9MW1UYxgs650Bw0A0hdHRsK+tYYcCIOKCSAYUyoAIyNgYtUAb0Hy2lQKG0
lD9jE4WNWcwiWaLGDyYmxrgRlWwghvhZo1+MmrAVKH6Z0Ntz3nNYsui5TRs/iCaenNzcnNzf
eZ73Oee9ghjzU88CF4Bnf/7PMbfgj+5Cgrn7279tPrPN09ZpcvEaVI+A0oGLB3DpIH7dxs8C
Kz/PmhCbWQYkvYrE6u3crkc//sp57v8hYKoDd+ns57tz93YnP6H9d6n5DtW9SzpnifYmaZkm
mndI41vQMAk141DhxEX9OMfIHW9ez2r+jrnm+Y5Zcmdhd/6rp1Of7jo+pL3ztPs9tgXtuMVv
0TZD1G+TxhtQNwFVI1Bix3lmTtqyfrhskbE8f/k6MHLms133x9T6PjV46NWbRMOY66R+HGpH
odKJLzj5iph4fi/KNXHpbeuJygchvm4chj6gzo94uOs2bWWGJ8meaeaYULYRZen9Mu3GkaqH
IZ5lxmruCSprp2kTkx3dm5fpcYYeZ+o5Wfvm33zZEGbVMrjjFtVMkUsTpGYELgxBST+WW/Gr
ZnTGiE/rMVM72YnTdVim59K1G6KqpZA+49nhaWd453vazjBiaZA/1oklXfiUjjvVvpFcGeYL
exGLl4WsnvoX2xZ80sTzR/VwTIclek6i9SVVLof088yodgwuTfKBs6W6Mf4WlQ/D+SEosPOY
rBfSLMBeUowgNkCqIZCq9SVUhPkcI6p04foJaLgW5MehehSULih2QqGDxzIG+CcbIguIukFk
QKI2X7zym5D+6U7EzlblBkaypVrGjxGlG0rcIB8J8g6SZiepfSTZShLNJNGAElq2Xi5fCfES
bUBuQ8phrBrlv1aNQeUolLuh2A2F7iDvJGlD9KidJNlIgoUI9eig+veo0rB+ijrADon1TMUw
X+0/R4aLSBw0xU5fsdG4bhLTiaIbt144H9ZPbAxk6lC+FRXbcZkDKxxQwsJzgtwFr7kgx0XS
nfSEgx6x08M2GmuiB9rRvoatyKKw/qGGgETLX8xzViTvw/I+KOjH5wZwnh3nDIJskEjsRDxA
knpJnJlG68i+VhT5pi9CHs4/tuaJqGlb2r5zRrdz1ujPNfmzTVx2N5dp4dJ7OElPQGwJJHUj
oQEx5/tbA5FXdgTVXkF+sP9YD0s1a8I31pIvrqVe8UqaH6epH51ofnxc403VeFM03uSWzQTN
plDti23aPHDZ93y9L0LlFSh+Equ+5nn28/rhF7+0YTWm6Mu40qV4xYNDisX40kWh4qGwbOmg
YjlGsRKl+PbF0lUW2HNFKxFFq4KCZbFq8fufn3jucYKXdMSz4N8z9v9YZK49X/ijNPgvNyRo
J/+h87kAAAAASUVORK5CYII="
$ResFormButtonImage = $System.Bitmap.FromBase64String($ResFormButtonImage)
EndFunction

Function ButtonPanelBackGroundImage()
$ButtonPanelBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAFUAAAAeCAYAAABdalL1AA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/Brkhv7KZej2B2Dx+INyf0x1tht2Bv
SF/sDe6Dt8Z64PUAHXYRaNtXB/iWgstfASoSfi5Q5cI1QPWq/hEy2F/axHPEjthTFhzUdbX9
XCe8KviyTxIuwXqV8q3EM+r+wi9phlN8NUOgXnO5mydTX4Mqhb8kqmEvsPgXoFJKpX9xxamv
hIXi1t+uFnBP2J3koUmZKIAd8VupciiPzOOKFAYXxSpIKiFNkmtECV+qkkpJcpAmgas5p0CV
P5n6CtQeklOfqnbcsFp0Cn1EFSfhUdEGzxK+aKQU+I4Z4lKXO5eSbh6ACp7ANdByLKAFLCsp
hedFqBJ76IkeVfxy0fKfbyj1aYAyXt3qC5Bj6Z3lUfsDPKvOow/ra3EQeTWkbMbLXq70fDWv
vfRUzsv5ml6TbIPKsVx33nDStkflQQhYbrBchCoHkqTkCfZdwhqS5ZFo/ONc598gGrsD0KSN
WTv33wpokmt+2y+X3O9+/fb7ge7y3ghourn+AkTKP21wRarOe4enaicCViRgY5/GDae4Z4Hu
kt8RvVP9Lc69HPemiEcBd9IejoDtu5xvaiW+MllpDC+DepG0xNdetv9+k/cu2/+V/7Jxsy/s
2LRWduPkOJ2x1bH3oB7LNcd15X+zuHkvUna7eF8R78u7KQJ1hqkd/xe5mjeeksMMSwAAAABJ
RU5ErkJggg=="
$ButtonPanelBackGroundImage = $System.Bitmap.FromBase64String($ButtonPanelBackGroundImage)
EndFunction

Function LeftBorderBackGroundImage()
$LeftBorderBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
ADBJREFUGFdjZJA8zyHBxWcp+un1+ydTfjMgAFDC8KZY1juO0LtvXt6AIwaQjkEnAQCDG3IJ
EwFRsQAAAABJRU5ErkJggg=="
$LeftBorderBackGroundImage = $System.Bitmap.FromBase64String($LeftBorderBackGroundImage)
EndFunction

Function RightBorderBackGroundImage()
$RightBorderBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
ADRJREFUGFdjfPPyBgMMiMRLMnx9zfDgCMO3NwxACThi8PjIYHuHQXYBg3APdSTkcBlFpgQA
2dxtU4JD5EEAAAAASUVORK5CYII="
$RightBorderBackGroundImage = $System.Bitmap.FromBase64String($RightBorderBackGroundImage)
EndFunction

Function TopBorderBackGroundImage()
$TopBorderBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AC9JREFUGFdjZJA8z4AVsBvdBCIOQ2R0g8PwBoNY1jusiIEj9C5WxPDm5Q2siIoSAEC1dFhy
pqG7AAAAAElFTkSuQmCC"
$TopBorderBackGroundImage = $System.Bitmap.FromBase64String($TopBorderBackGroundImage)
EndFunction

Function TopLeftCornerBackGroundImage()
$TopLeftCornerBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AAlwSFlzAAAOwgAADsIBFShKgAAAAEhJREFUKFNj/M/wnwEZMEpeQBUAKQBBDsOb/7FhuKRY
1rv/2DCKAo7Qu//RMQOD5Hmw0SDdyJJvXt74D8JYFcAksSpAliRKAQA5DZFgCOns5QAAAABJ
RU5ErkJggg=="
$TopLeftCornerBackGroundImage = $System.Bitmap.FromBase64String($TopLeftCornerBackGroundImage)
EndFunction

Function TopRightCornerBackGroundImage()
$TopRightCornerBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AAlwSFlzAAAOwgAADsIBFShKgAAAAF5JREFUKFNjZJA8/58BCfx/bsCIzGfgMLz5nx0L/s8A
gQxiWe/+o2MG2zv/GeQW/Acr4Ai9+x8ZM3h8/I+i4M3LG/9BGCwBwyATZBf8ZxDu+c8AU4Ci
CJcCuCJSFAAAPBGMTFOX8I0AAAAASUVORK5CYII="
$TopRightCornerBackGroundImage = $System.Bitmap.FromBase64String($TopRightCornerBackGroundImage)
EndFunction

Function BottomBorderBackGroundImage()
$BottomBorderBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
ADJJREFUGFdjfPPyBgNWAJTAihhIl2Dw+IgdMdjdQUJ3GexgiEF2AQLJLWSAIwbhHqwIABo1
YGupDdERAAAAAElFTkSuQmCC"
$BottomBorderBackGroundImage = $System.Bitmap.FromBase64String($BottomBorderBackGroundImage)
EndFunction

Function BottomLeftCornerBackGroundImage()
$BottomLeftCornerBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AAlwSFlzAAAOwgAADsIBFShKgAAAAGdJREFUKFNjZJA8/59DgouBz1KU4dPr9wxPpvxmQAVA
BeyGN/+LZb37zxF69/+blzdQMAPIBGQFDB4fCStAVsTwHwhhJoAkMDBMAYPtnf9YMUgBCDLI
LfgPxrJoGKYArlC45z8DEgYArMaIQLIo5aYAAAAASUVORK5CYII="
$BottomLeftCornerBackGroundImage = $System.Bitmap.FromBase64String($BottomLeftCornerBackGroundImage)
EndFunction

Function BottomRightCornerBackGroundImage()
$BottomRightCornerBackGroundImage = "
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AAlwSFlzAAAOwgAADsIBFShKgAAAAGZJREFUKFNjfPPyxn8GJCASL8nA8O01A8ODowwMX4E0
SAEyZvD4+J/B7s5/BrmF/xmEe/6jKABL4lIAl0RXgCKBZsJ/BpDzQPah4LtAPhAD3QBRILvg
PwoGOQ4qCVEAcikSBgkiQwAp1YZ064eI7wAAAABJRU5ErkJggg=="
$BottomRightCornerBackGroundImage = $System.Bitmap.FromBase64String($BottomRightCornerBackGroundImage)
EndFunction
;endregion
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Nov 03, 2006 2:14 pm    Post subject: Reply with quote

First things first, Very Nice!

Ok, Replace these lines:
Code:

$TabControl1 = $System.TabControl()
$TabControl1.Height = 185
$TabControl1.Left = 5
$TabControl1.Top = 15
$TabControl1.Width = 380
$nul = $GroupBox3.Controls.Add($TabControl1)

$Tab1 = $System.TabPage()
$Tab1.Font("Microsoft Sans Serif",8.25,5)
$Tab1.ForeColor = $System.Color.FromName("MenuText")
$Tab1.Text = $konto
$nul = $TabControl1.Controls.Add($Tab1)

with these lines and let me know if it gives you what you are looking for.
Code:

If Not(VarType($TabControl1) = 9)
  $TabControl1 = $System.TabControl()
  $TabControl1.Height = 185
  $TabControl1.Left = 5
  $TabControl1.Top = 15
  $TabControl1.Width = 380
  $nul = $GroupBox3.Controls.Add($TabControl1)
EndIf

$Tab1 = $System.TabPage()
$Tab1.Font("Microsoft Sans Serif",8.25,5)
$Tab1.ForeColor = $System.Color.FromName("MenuText")
$Tab1.Text = $konto
$nul = $TabControl1.Controls.Add($Tab1)

$TabControl1.SelectedTab = $Tab1

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Fri Nov 03, 2006 2:47 pm    Post subject: Reply with quote

Thank you for the compliment!
(even if it is you who should have most of the credit, creating the "Nexis")

That code gave me a new tab, and that is acctually something I'll have some very good use of in a later part. Very Happy

I could probably come up with a button that closes the tab, but for this function, I would like it to clear the first tab and update it with the new info.
(if possible that is...)

/Viggen
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Nov 03, 2006 2:57 pm    Post subject: Reply with quote

If you want to replace what is on the TabPage then replace that section with this:
Code:

;************** Visa fliken med informationen *****************************
If Not(VarType($TabControl1) = 9)
  $TabControl1 = $System.TabControl()
  $TabControl1.Height = 185
  $TabControl1.Left = 5
  $TabControl1.Top = 15
  $TabControl1.Width = 380
  $nul = $GroupBox3.Controls.Add($TabControl1)

  $Tab1 = $System.TabPage()
  $Tab1.Font("Microsoft Sans Serif",8.25,5)
  $Tab1.ForeColor = $System.Color.FromName("MenuText")
  $Tab1.Text = $konto
  $nul = $TabControl1.Controls.Add($Tab1)

  $RichTextBox1 = $System.RichTextBox()
  $RichTextBox1.Height = 153
  $RichTextBox1.Left = 2
  $RichTextBox1.ReadOnly = -1  ;True
  $RichTextBox1.LoadFile($usrfile)
  $RichTextBox1.Update
  $RichTextBox1.Top = 3
  $RichTextBox1.Width = 280
  $nul = $Tab1.Controls.Add($RichTextBox1)

  $New_Pwd_Button = $System.Button()
  $New_Pwd_Button.Font = $System.Font("Microsoft Sans Serif",8.25,1) ;Bold
  $New_Pwd_Button.Left = 290
  $New_Pwd_Button.Text = "Nytt pwd"
  $New_Pwd_Button.Top = 85
  $nul = $Tab1.Controls.Add($New_Pwd_Button)
Else
  $Tab1.Text = $konto
  $RichTextBox1.LoadFile($usrfile)
EndIf
;**************************************************************************

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Fri Nov 03, 2006 3:13 pm    Post subject: Reply with quote

Thanks!!

Works perfect.
(now for the fun part... figuring out what the heck you just did.) Very Happy

/Viggen
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Nov 03, 2006 3:21 pm    Post subject: Reply with quote

Basicly this:
Code:

If Not(VarType($TabControl1) = 9)

checks to see if $TabControl1 already exists
if it does not, it creates the tabcontrol and its child controls.
if it does exist, it alters $Tab1.Text and loads $RichTextBox1.LoadFile($usrfile).

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Viggen
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2005
Posts: 40

PostPosted: Fri Nov 03, 2006 3:37 pm    Post subject: Reply with quote

Hmm...

So what I did was "overdoing it", by trying to recreate the whole tabcontrol.
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Nov 03, 2006 3:41 pm    Post subject: Reply with quote

yes, but you are doing a good job and its looking real nice.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group