Results 1 to 3 of 3

Thread: Button ID

  1. #1
    Lesser Knight
    Join Date
    May 2007
    Posts
    46

    Default Button ID

    Is there any way that I can tell from a on_clicked signal which button sent it?

    I would like to have several buttons point to the same signal handler but do slightly different things based on which button was selected. To be more direct, I have a number of xml files describing similar screens, the only difference from the buttons that load these xml files is the xml file name. The names of these XML files are not known at compile time and the buttons are dynamically generated based on a list of files.


    I would like to have a std::map of <buttonID, filename> and let the single handler deal with all the button clicks.

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    You can have user passed arguments to signals and slots.

    Read http://clanlib.org/docs/clanlib-0.8....w/signals.html section UserData - it does exactly what you need.

  3. #3
    Lesser Knight
    Join Date
    May 2007
    Posts
    46

    Default

    If I could read, I might be dangerous.

    Thanks for the gentle pointer.

Bookmarks

Bookmarks

Posting Permissions

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