Page 1 of 1 1
Topic Options
#135244 - 2005-03-10 05:38 PM Disable Close Button, but allow Minimize
dataspike Offline
Getting the hang of it

Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
Just as the subject says... can this be done?

Chris

Top
#135245 - 2005-03-10 06:46 PM Re: Disable Close Button, but allow Minimize
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Hi data..are you using Kixforms ?
_________________________
Life is fine.

Top
#135246 - 2005-03-10 07:28 PM Re: Disable Close Button, but allow Minimize
dataspike Offline
Getting the hang of it

Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
Yup... Here's the form in question.

Chris

Code:

;*******************************************************************************
;** Main Form
;*******************************************************************************
$frmMain = $System.Form($Root)
$frmMain.ShowInTaskBar = "False"
$frmMain.BorderStyle = 1
$frmMain.SysMenu = 0
$frmMain.ControlBox = 0
$frmMain.Size = 320,310
$frmMain.Text = "Welcome to the @DOMAIN Domain"
$frmMain.Center
$frmMain.TopMost = 1

;*******************************************************************************
;** Logo Picture Frame
;*******************************************************************************

$SPLogoBanner = $frmMain.PictureBox
$SPLogoBanner.BackColor = $frmMain.RGB(255,255,255)
$SPLogoBanner.Left = 5
$SPLogoBanner.Top = 5
$SPLogoBanner.Height = 60
$SPLogoBanner.Width = 300

$SPLogo = $SPLogoBanner.Image
$SPLogo.Picture = $LocalDC + "\netlogon\tucson\logo.bmp"
$SPLogo.Center
$SPLogo.Border = 0
$SPLogo.Height = 52
$SPLogo.Width = 216


;*******************************************************************************
;** User Information GroupBox
;*******************************************************************************
$fraUser = $frmMain.GroupBox
$fraUser.Size = 300,130
$fraUser.Center
$fraUser.Top = 70
$FraUser.Text = "User Information:"

$FullName = @FULLNAME
If InStr($FullName,",") ;If true, then comma found
$NAME_ARRAY = Split($FullName,", ")
$GetFullName = $NAME_ARRAY[1] + " " + $NAME_ARRAY[0]
Else
$GetFullName = $FullName
EndIf

$lblFName = $fraUser.Label("Full Name:",5,22,75,20)
$lblFName.Alignment = 1
$txtFName = $fraUser.TextBox($GetFullName,85,20,205,20)
$txtFName.ReadOnly = 1

$lblUserID = $fraUser.Label("Username:",5,42,75,20)
$lblUserID.Alignment = 1
$txtUserID = $fraUser.TextBox(@USERID,85,40,205,20)
$txtUserID.ReadOnly = 1

$lblLServer = $fraUser.Label("Logon Server:",5,62,75,20)
$lblLServer.Alignment = 1
$txtLServer = $fraUser.TextBox(@LSERVER,85,60,205,20)
$txtLServer.ReadOnly = 1

$lblLDom = $fraUser.Label("Logon Domain:",5,82,75,20)
$lblLDom.Alignment = 1
$txtLDom = $fraUser.TextBox(@DOMAIN,85,80,205,20)
$txtLDom.ReadOnly = 1

$ComputerName = @HOSTNAME
If InStr($ComputerName,".site.com") ;If true, then .site.com found
$Computer_ARRAY = Split($ComputerName,".site.com")
$GetFullCompName = $Computer_ARRAY[0]
Else
$GetFullCompName = $ComputerName
EndIf

$lblComp = $fraUser.Label("Computer:",5,102,75,20)
$lblComp.Alignment = 1
$txtComp = $fraUser.TextBox($GetFullCompName,85,100,205,20)
$txtComp.ReadOnly = 1

; $lblIP = $fraUser.Label("IP Address:",5,122,75,20)
; $lblIP.Alignment = 1
; $txtIP = $fraUser.TextBox($CurrentIP,85,120,205,20)
; $txtIP.ReadOnly = 1
;
; $lblMAC = $fraUser.Label("MAC Address:",5,142,75,20)
; $lblMAC.Alignment = 1
; $txtMAC = $fraUser.TextBox(@ADDRESS,85,140,205,20)
; $txtMAC.ReadOnly = 1

;*******************************************************************************
;** Logon Process GroupBox and ProgressBar
;*******************************************************************************

$fraStatus = $frmMain.GroupBox
$fraStatus.Size = 300,70
$fraStatus.Center
$fraStatus.Top = $fraUser.Bottom + 5
$fraStatus.Text = "Logon Process:"

$lblStatus = $fraStatus.Label("Processing logon script...",10,20,260,20)

$prgStatus = $fraStatus.ProgressBar
$prgStatus.Size = 280,20
$prgStatus.Center
$prgStatus.Top = $lblStatus.Bottom


Top
#135247 - 2005-03-10 07:47 PM Re: Disable Close Button, but allow Minimize
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The answer without silver platter, is that you don't disable it but rather you handle it in the code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135248 - 2005-03-10 07:51 PM Re: Disable Close Button, but allow Minimize
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Try this three.
Code:
  
Break On

$Form = CreateObject("Kixtart.Form")

;----------------------
$Form.MaximizeBox = 0
$Form.MinimizeBox = 0
$Form.ControlBox = 0
;----------------------

$Form.Show

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

Exit 1

_________________________
Life is fine.

Top
#135249 - 2005-03-10 07:57 PM Re: Disable Close Button, but allow Minimize
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
mnn......
I think you should ask Shawn.
I guess those controls ment to do that but they dont as you want it to.
_________________________
Life is fine.

Top
#135250 - 2005-03-10 08:04 PM Re: Disable Close Button, but allow Minimize
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Did you try searching the mothership www.kixforms.org for the answer?

Believe it or not, but there is a topic there called, of all things, Disable Close button.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135251 - 2005-03-10 08:50 PM Re: Disable Close Button, but allow Minimize
dataspike Offline
Getting the hang of it

Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
Quote:

Did you try searching the mothership www.kixforms.org for the answer?

Believe it or not, but there is a topic there called, of all things, Disable Close button.



Les, if no one has said it before, I will say it now.. you are goood!

Thanks!

Top
#135252 - 2005-03-10 09:17 PM Re: Disable Close Button, but allow Minimize
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Could you please post the code that worked out?
Thanks.
_________________________
Life is fine.

Top
#135253 - 2005-03-10 09:53 PM Re: Disable Close Button, but allow Minimize
dataspike Offline
Getting the hang of it

Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
Haven't updated my code entirely, but this is the one I think I am going to use.

Chris

Code:

Break On
$System = CreateObject("Kixtart.System")
If VarType($System)<>9 or @ERROR
$null=MessageBox("Unable to initialize the KiXforms system namespace!","Error",0)
exit 0
Endif

;************* Form **************
$Form = $System.Form()
$Form.StartPosition = $System.FormStartPosition.Manual
$Form.FormBorderStyle = 1
$Form.Text = "Phone # Finder"
$Form.Width = 500
$Form.Height = 165
$Form.ForeColor = 231,223,231
$Form.OnClosing = "SetTaskbar()"
$Form.OnResize = "FormResized()"
;**************************************

;************* Label1 **************
$Label1 = $Form.Controls.Label("Enter First or Last Name", 15, 5, 120, 15)
;**************************************

;************* ComboBox1 **************
$ComboBox1 = $Form.Controls.ComboBox("", 135, 3, 120, 20)
$ComboBox1.Sorted=1
$ComboBox1.SetFocus
;**************************************

;************* Button1 **************
$Button1 = $Form.Controls.Button("Find", 260, 3, 35, 20)
$Button1.Default = 1
$Button1.OnClick = "GetInfo()"
;**************************************

;************* ListViewEx1 **************
$ListViewEx1 = $Form.Controls.ListView("ListViewEx1", 10, 28, 470, 70)
$ListViewEx1.AutoArrange = "True"
$ListViewEx1.FullRowSelect = "True"
$ListViewEx1.HideSelection = "False"
$NameColumn = $ListViewEx1.Columns.Add("Name",120,0)
$ExtColumn = $ListViewEx1.Columns.Add("Ext",46,0)
$PhoneColumn = $ListViewEx1.Columns.Add("Phone",85,0)
$LocColumn = $ListViewEx1.Columns.Add("Location",109,0)
$DeptColumn = $ListViewEx1.Columns.Add("Dept",89,0)
;**************************************

;************* Menus **************
$Form.Menu = $System.MainMenu()
$Form.Menu.Style = 1
$Form.SettingsMenu = $Form.Menu.menuitems.add("File")
$Form.TaskMenu = $Form.SettingsMenu.menuitems.add("Run In Taskbar")
$Form.TaskMenu.onclick="SetTaskbar()"
$Form.ExitMenu = $Form.SettingsMenu.menuitems.add("Exit")
$Form.ExitMenu.onclick="$$Form.Hide"
;**************************************

$Form.Show
While $Form.Visible or $notifyicon
$=Execute($Form.DoEvents())
Loop
Exit 1

;*********************************
;************* UDFs **************
;*********************************
FUNCTION SetTaskbar()
$Form.TaskMenu.Checked=1
$notifyicon = $System.NotifyIcon()
$notifyicon.visible = 1
$notifyicon.text = "Phone # Finder"
$notifyicon.icon = $System.BuiltInIcons(5)
$notifyicon.OnClick = "UnSetTaskbar()"
$form.hide
ENDFUNCTION

FUNCTION UnSetTaskbar()
$form.Show
$form.Activate
If $Form.WindowState = $System.FormWindowState.Minimized
$Form.WindowState = $System.FormWindowState.Normal
Endif
$notifyicon.visible = 0
$notifyicon.text = ""
$notifyicon = 0
$Form.TaskMenu.Checked=0
ENDFUNCTION

FUNCTION FormResized()
If $Form.WindowState = $System.FormWindowState.Minimized
SetTaskbar()
Endif
ENDFUNCTION


Top
#135254 - 2005-03-10 10:03 PM Re: Disable Close Button, but allow Minimize
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
I see Chris.
SetTaskbar()UnSetTaskbar() are doing the job. Cool
As I saw on the link it was not possible to disable close button, this is a good solution I might implement too.
Thanks.
_________________________
Life is fine.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.126 seconds in which 0.088 seconds were spent on a total of 12 queries. Zlib compression enabled.

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