+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
Coding Thread, C# - Button delay timer in Coding and Web Development; @AngryTechnician : Yeah if its manually set - reader 9 takles over - its finding out hw to change that ...
  1. #16

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    @AngryTechnician : Yeah if its manually set - reader 9 takles over - its finding out hw to change that in all my PCs now

  2. #17

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,677
    Thank Post
    3,209
    Thanked 1,030 Times in 955 Posts
    Rep Power
    361
    Quote Originally Posted by Gatt View Post
    @AngryTechnician : Yeah if its manually set - reader 9 takles over - its finding out hw to change that in all my PCs now
    You could integrate it into this app your doing with the button

    System File Association - CodeProject

  3. #18

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    Yay! It works
    Downloaded the Adobe Installation customizer thingy and MST's Reader 9 so that it defaults over Acrobat

    my little app now works

    Will do some fine tuning, and then maybe get it up here!

  4. #19

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Quote Originally Posted by powdarrmonkey View Post
    You need to check e.CloseReason for a user value first, in case there's a good reason that it's actually closing
    Hmm, shame you totally ignored this advice in your actual release...

  5. #20

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    Quote Originally Posted by powdarrmonkey View Post
    Hmm, shame you totally ignored this advice in your actual release...

    Err... Ignored no - forgot would be a better word
    ... Will get it sorted though :P

  6. #21

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    Hmm
    Code:
    
    if (!btnClose.Enabled || e.CloseReason == CloseReason.UserClosing)
    {
    e.Cancel = true;
    }
    
    or

    Code:
    
    if (!btnClose.Enabled && e.CloseReason == CloseReason.UserClosing)
    {
    e.Cancel = true;
    }
    

  7. #22

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Sorry, that should be || (logical or). I'd keep the brackets in though, if only to make it easier to read.

  8. #23

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,432
    Thank Post
    1,432
    Thanked 1,160 Times in 794 Posts
    Rep Power
    705
    Quote Originally Posted by Gatt View Post
    Hmm
    Code:
    
    if (!btnClose.Enabled || e.CloseReason == CloseReason.UserClosing)
    {
    e.Cancel = true;
    }
    
    or

    Code:
    
    if (!btnClose.Enabled && e.CloseReason == CloseReason.UserClosing)
    {
    e.Cancel = true;
    }
    
    The second option, otherwise the form will go ahead and close either way

  9. #24

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Quote Originally Posted by JoshJohnson View Post
    otherwise the form will go ahead and close either way
    This is the desired behaviour.

  10. #25

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    err. confused - && or || ?

  11. #26

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    ||. You want the form to close on either condition.

  12. #27

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,432
    Thank Post
    1,432
    Thanked 1,160 Times in 794 Posts
    Rep Power
    705
    Quote Originally Posted by powdarrmonkey View Post
    This is the desired behaviour.
    I thought the desired behaviour was to only close the form if the cancel button was enabled (if it was a user requested close)

    Quote Originally Posted by Gatt View Post
    err. confused - && or || ?
    If I'm right, use &&

    Using || as powdarrmonkey suggests will indeed close the form either way, meaning an alt + F4 will also close it (regardless of whether the cancel button is enabled)

  13. #28

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    @Josh - the idea is that when the form loads the button is disabled - foricng the user to read whats on screen

    They can only close the app once the button has been enabled - until then the application cannot be allowed to close...

  14. #29

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Quote Originally Posted by JoshJohnson View Post
    I thought the desired behaviour was to only close the form if the cancel button was enabled (if it was a user requested close)
    No, read the braced section of the if statement. The test is whether to cancel the close action or not, and you want to do this if either
    - the button was enabled and has been pressed
    - the form is being closed because the OS needs it to, not because the user asked for it to

  15. #30

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,432
    Thank Post
    1,432
    Thanked 1,160 Times in 794 Posts
    Rep Power
    705
    Quote Originally Posted by powdarrmonkey View Post
    No, read the braced section of the if statement. The test is whether to cancel the close action or not, and you want to do this if either
    - the button was enabled and has been pressed
    - the form is being closed because the OS needs it to, not because the user asked for it to
    OK maybe I'm misunderstanding, but e.CloseReason == CloseReason.UserClose is true if the user has tried to close the form, not the OS, isn't it?

SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Anybody got free countdown timer?
    By Hightower in forum Educational Software
    Replies: 17
    Last Post: 19th December 2009, 01:56 PM
  2. LANSchool - inactivity timer kicking in
    By googlemad in forum Network and Classroom Management
    Replies: 3
    Last Post: 19th February 2009, 09:31 PM
  3. First timer
    By Simcfc73 in forum BETT 2014
    Replies: 7
    Last Post: 1st December 2008, 08:23 AM
  4. HELP:::Internet Timer
    By bats in forum Downloads
    Replies: 5
    Last Post: 13th June 2008, 11:23 PM
  5. Countdown Timer to School Holidays
    By mattpant in forum Coding
    Replies: 4
    Last Post: 17th January 2007, 11:42 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •