LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2007, 11:04 PM   #1
cheeseplz
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Rep: Reputation: 0
Gtkmm / UIManager / passing info to event handler


Greetings all,

I've a newbie question relating to Gtkmm and the UIManager.

How can I pass arbitrary data to the event handler when a menuitem created with the UIManager is clicked?

At the moment I have three event handlers handling three different items, but the code only differs by an integer value, which I would simply like to pass to a single event handler. How can I do this?

Hope that made sense.

Much appreciate some assistance with this :-)

Thanks,
Lee
 
Old 10-18-2007, 11:06 PM   #2
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
My recommendation is to write the function that does the real work and takes an integer. Then write the 3 callbacks that gtkmm will see - but all these will do is call the function that does the real work and pass in the appropriate integer.
 
Old 10-18-2007, 11:10 PM   #3
cheeseplz
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Patrick,

Thanks for your response :-)

That's what I have done. It just seems repetitive to do it that way, even if on a small scale, and I assumed there must be a simple way to pass data to the event handlers.

Thanks again :-)

Lee
 
Old 10-18-2007, 11:22 PM   #4
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
Well, there may be a way, but it involves a greater knowlege of libsigc++ than I have. Take a look at this link (btw libsigc++ is the callback framework that gtkmm uses) http://libsigc.sourceforge.net/libsi...html#id2450855 . I think rebinding is what you are looking for.
 
Old 10-18-2007, 11:33 PM   #5
cheeseplz
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Patrick,

Perfect! Thank you very much! :-)

bind was precisely what I was looking for.

Thanks again!

Lee
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios Event Handler not running - NRPE: Unable to read output notque Linux - Software 7 04-05-2013 06:27 AM
SIGSEGV handler (segmentation fauld handler) myp Programming 8 03-08-2011 02:17 PM
Looking for Joystick to Mouse Event Handler that supports Acceleration / Keyboard... fragged Linux - Software 0 08-06-2007 08:17 AM
<0>Kernel panic: Aiee, killing interrupt handler! In interrupt handler - not syncing mrb Linux - Newbie 2 01-09-2005 09:47 AM
TCP-IP event-handler in a Linux server Zingaro2002 Linux - Networking 4 06-06-2002 10:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration