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

Change default behavior of closing a form
Goto page Previous  1, 2
 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Fri Jan 20, 2006 12:49 am    Post subject: Reply with quote

I had this working in KFv2.

Any ideas how to get it in v3? I understand that v3 just hides it, but am curious.

Call Snipet
Code:

$frmMain.OnClosing = "SetTaskbar()"
$frmMain.OnResize = "FormResized()"

While $frmMain.Visible Or $notifyicon
   $Nul = Execute($frmMain.DoEvents())
Loop
Exit 0


UDF Snipet
Code:

Function SetTaskbar()
   $frmMain.TaskMenu.Checked=1
   $notifyicon = $System.NotifyIcon()
   $notifyicon.visible = 1
   $notifyicon.text = "Welcome to the @LDOMAIN Domain"
   $notifyicon.icon = $System.BuiltInIcons(5)
   $notifyicon.OnClick = "UnSetTaskbar()"
   $form.hide
EndFunction

Function UnSetTaskbar()
   $frmMain.Show
   $frmMain.Activate
   If $frmMain.WindowState = $System.FormWindowState.Minimized
      $frmMain.WindowState = $System.FormWindowState.Normal
   EndIf
   $notifyicon.visible = 0
   $notifyicon.text = ""
   $notifyicon = 0
   $frmMain.TaskMenu.Checked=0
EndFunction

Function FormResized()
   If $frmMain.WindowState = $System.FormWindowState.Minimized
      SetTaskbar()
   EndIf
EndFunction
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 20, 2006 1:04 am    Post subject: Reply with quote

no.
V3 does not hide, it destroys the form.
V2 just hides it.

with V3 you need to get the event args -> cancel event args -> set the cancel property to true.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Fri Jan 20, 2006 4:41 pm    Post subject: Reply with quote

Lonkero wrote:
no.
V3 does not hide, it destroys the form.
V2 just hides it.

with V3 you need to get the event args -> cancel event args -> set the cancel property to true.


Have any examples of what you mean? I'm relatively new to v3 and .NET

Thanks,
Chris
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 20, 2006 5:55 pm    Post subject: Reply with quote

well, in my V3 example application (not quite done yet) I use:
Code:

$ServerMonitor.Closing = "$ServerMonitor.ClosingEventArgs.Cancel = 1 $ServerMonitor.Visible = 0"


note, I use novarsinstrings.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Fri Jan 20, 2006 6:18 pm    Post subject: Reply with quote

Lonkero wrote:
well, in my V3 example application (not quite done yet) I use:
Code:

$ServerMonitor.Closing = "$ServerMonitor.ClosingEventArgs.Cancel = 1 $ServerMonitor.Visible = 0"


note, I use novarsinstrings.


I actually found a thread that Sean made...

Code:

Function FormClosing()

   $e = $frmMain.ClosingEventArgs
   $e.Cancel = 1
   $frmMain.Visible = 0
   $NotifyIcon.Visible = 1

EndFunction
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 20, 2006 6:28 pm    Post subject: Reply with quote

You know what, I was actually in the process of depracating those <SomeEvent>EventArgs properties (like your ClosingEventArgs) - looking at your code though, with a new persepective ... think I'm going to keep them.
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 20, 2006 6:32 pm    Post subject: Reply with quote

well, shawn.
they are pretty complex and the documentation isn't that clear and indexed about the events there are, so...
looks messy and is really hard to find anything if not really sure what you are looking for.

if you would deprecate them, what is the new option for the same task?
new properties?

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 20, 2006 6:35 pm    Post subject: Reply with quote

I was thinking about depracating ALL the <Event>EventArgs properties, and having all EventArgs available from the System.EventArgs property, so for example the post above it would (can now) look like this:

Code:

Function FormClosing()

   $e = $System.EventArgs

   $e.Cancel = 1

   $frmMain.Visible = 0
   $NotifyIcon.Visible = 1

EndFunction
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 20, 2006 6:37 pm    Post subject: Reply with quote

Which of course can be distilled down to:

Code:

Function FormClosing()

   $System.EventArgs.Cancel = 1

   $frmMain.Visible = 0
   $NotifyIcon.Visible = 1

EndFunction
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 20, 2006 7:03 pm    Post subject: Reply with quote

yes, system.eventargs looks cleaner than control.eventargs
_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Fri Jan 20, 2006 8:16 pm    Post subject: Reply with quote

The one nive thing about having Event Properties (that return the exact "type" of event), is that "Language Sensitive Editors" like ASE can read the property "type" and display for you, the properties of the event obj (like Cancel etc).

Having a "blob" property like System.EventArgs kinda hides this information.
Back to top
View user's profile Send private message
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Fri Jan 20, 2006 9:11 pm    Post subject: Reply with quote

eh.
event is always event.
how does it differ where it comes from?
and what you showed, the syntax don't change, nor changes any of kixforms internal code.
just that the event stuff is no longer owned by the control but handled by the system object.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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