Jump to content

Trouble Using One Function for Several Buttons


momar33
 Share

Recommended Posts

I have a poker timer program that has a feature to add a re-buy.  Currently the re-buy is just used to calculate the number of chips at the table and pot size.

 

I am trying to add functionality to keep track of who did the re-buy.

I have added functionality to add players names, which get saved to an array.

 

What I would like the "Add Re-buy" button to do is bring up a second gui with a button for each player currently in the game.

 

Since the number of players changes, I am using a for loop to create the buttons.

 

The problem comes when I try to determine which button was pressed.

 

I am using GUIOnEventMode.

 

Since I don't know how many buttons there will be, I can't create functions for each of the buttons.

 

Instead what I am trying to do is have one Function that all buttons call.

 

This seems to work fine, if i want all the buttons to do the same thing.

 

Is there a way I can use my single function (RebuyAdded) to determine which of the buttons was pressed?

 

Here is the code for my secondary Gui:

<snip>

Edited by Melba23
Code removed
Link to comment
Share on other sites

  • Moderators

momar33,

I am surprised that as a member of such long standing you appear not to have read the Forum rules. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

M23

Edit: A PM exchange has cleared the OP from any wrongdoing - the script is an aid to a real-life card game with flesh-and-blood players and cardboard cards - but I am leaving the lock in place. :)

The answer to the OP's problem is, of course, @GUI_CtrlId - and the answer to not getting your thread locked unnecessarily is to avoid using the "G-word" when you post. ;)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...