Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Disable buttons when not needed

    What I want to do sounds simple enough but I can't seem to get it to work. What I have is three options. Install, Run, and Quit.

    Quit runs fine, but it's the other two I'm having problems with.

    I want Install to only be active if the program isn't installed, and I want run to only be activated when the program is installed. So of course I want this to take effect as soon as the screen appears.

    Problem is although it may sound really simple I can't seem to get it to work. I've tried using installed = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\company name\\program name")
    to store the detect if the program is installed since it'll leave it's reg key in there if it's installed. But no matter what I do from there I have no luck. Any ideas? or an easier way? Thanx

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Its hard to guess what you are doing from one line of code. The line you posted certainly would look to see if it was installed, but what are you doing with the variable's value after you check? Can you share a bit more of your code?

  3. #3
    Join Date
    Mar 2004
    Posts
    4
    Well, I tried to follow it with this (run is disabled by default by the way) but nothing happens.

    if installed then
    Button.SetEnabled("INSTALL", false);
    Button.SetEnabled("RUN", true);
    end

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    here's a sample I threw together...
    Attached Files

  5. #5
    Join Date
    Mar 2004
    Posts
    4
    Thank you for taking the time to create that sample.
    From what I can tell my code works, I just can't get it to start up when the project starts up (even though my code is set in On Startup).

    I know it works because if I add the code to the button in the On Enter and rest my cursor on that button, my code work out properly. So it looks like my problem is getting my code to run automatically when the program starts up. Any ideas?

  6. #6
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    There is nothing to do to get it to run at Startup except for put the code in the On Startup as you've stated.

    The only other thing I can think of would be security. Do you have rights to read and write to the HKLM portion of the registry?

  7. #7
    Join Date
    Mar 2004
    Posts
    4
    Fix the problem, I discovered the On Show section which is just what I needed for the code. Thanks for the help though

Posting Permissions

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