Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2004
    Posts
    12

    Automatically Determined Button Clicked is Self

    Is there a way to automatically determine when a button is clicked, the program know it was that button that was clicked, meaning the button click is self, not another?

    I have a jeopardy board with 25 questions. When I click on button "100" in category 1, is there a way to determine it was that button that was clicked??? If this is possible, then I don't have to edit all 25 buttons one by one to tell them this is the button that was clicked.

    Right now, I'm having to edit each button's actions to tell it this is the button that was clicked. If the program can detect the button that was clicked, then I can just write a fuction that runs the actions I was performed.

  2. #2
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77
    How about assigning a global variable to each button to use in your function?

    iButton = 100

  3. #3
    Join Date
    May 2006
    Posts
    5,380
    or you could make one function and filter the buttons (by name) within it

    eg: in global functions
    Code:
    function DetectButtonClick(BUTTON)
    
    	if BUTTON == "Button1" then
    		result = Dialog.Message("Notice", "You Clicked Button 1", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    	if BUTTON == "Button2" then
    		result = Dialog.Message("Notice", "You Clicked Button 2", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    	if BUTTON == "Button3" then
    		result = Dialog.Message("Notice", "You Clicked Button 3", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    	if BUTTON == "Button4" then
    		result = Dialog.Message("Notice", "You Clicked Button 4", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    	if BUTTON == "Button5" then
    		result = Dialog.Message("Notice", "You Clicked Button 5", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    	if BUTTON == "Button6" then
    		result = Dialog.Message("Notice", "You Clicked Button 6", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	end
    
    
    end
    and in each button put this:
    Code:
    DetectButtonClick(this)
    then you can just edit the global function and leave the buttons


    heres a quick example:
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    I don't know if this is what you are looking for but with AMS and LUA you can use the keyword this which is then populated by the name of the object that was clicked. this way you can use this keyword in a function and only write one function and have it be specific to the object clicked.

    HTH
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Feb 2004
    Posts
    12
    @TJ Tigger

    This sound more like what I'm looking for, but I fail to grasp this completely. Can you show me an example, please?

    Thanks.

    (Otherwise the first two posts are my only options.)

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    what tigg is referring to is exactly what my function example dose, pass the "this" to the function as a argument and it will return the button name, and then filter your code whitin the function based on the button name.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    Feb 2004
    Posts
    12
    RizlaUK, I don't think you said the same thing TJ Tigger is talking about... although I know what you meant, it required a lot of coding.

    However, I understand TJ Tigger's suggestion now. What I did is change:

    result = Paragraph.GetText("CatXQuestY");

    to:

    result = Paragraph.GetText(this);

    Now, I don't have to edit each of the 25 and define the X and Y for each one.

    Thanks a lot for you help.

Similar Threads

  1. How to click on a button on startup automatically
    By slafta in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 11-24-2005, 02:35 AM
  2. Button to play audio cd
    By Friendly User in forum AutoPlay Media Studio 6.0
    Replies: 1
    Last Post: 10-03-2005, 12:25 AM
  3. Example: Creating an on/off button to toggle background audio
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 07-10-2004, 02:54 PM
  4. Button Hiding Blues
    By Tezcatlipoca in forum AutoPlay Media Studio 4.0
    Replies: 5
    Last Post: 04-11-2003, 04:57 PM
  5. INFO: The Explore Button on the Distribution Folder Dialog
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-11-2002, 12:06 PM

Posting Permissions

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