LinuxQuestions.org
Review your favorite Linux distribution.
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 02-17-2014, 02:39 PM   #1
hdavis
LQ Newbie
 
Registered: Nov 2013
Location: Albany, NY
Posts: 13

Rep: Reputation: Disabled
Change the label (name ) of a pushbutton in Motif at run time.


Hi,

I have a question. How do I change a button's name in Motif linux at run time.

For example:

I want a pushbutton to say "Run" when the apllication not running, and when I click on the "Run" button, the application runs and the button now says "Stop" and when I click on the "Stop" button, the application stops.

This is sort of like a toggle button.

Your input would be greatly appreciated.

Thank you
H Davis.
 
Old 02-17-2014, 03:38 PM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Assuming you have a callback associated with the button, something like this could be employed:
Code:
void startAndStopCB(Widget w, XtPointer clientData, XtPointer callData)
{
    static int i = 0;
    char* label = ((i ^= 1) ? "Stop" : "Run");

    XtVaSetValues(w, XmNlabelString, XmStringCreateLtoR(label, XmFONTLIST_DEFAULT_TAG), NULL);

    //...
}
Btw, you may find this resource helpful:
Motif Programming Manual (Volume 6A)

Last edited by dwhitney67; 02-17-2014 at 03:50 PM.
 
1 members found this post helpful.
Old 02-17-2014, 04:29 PM   #3
hdavis
LQ Newbie
 
Registered: Nov 2013
Location: Albany, NY
Posts: 13

Original Poster
Rep: Reputation: Disabled
The solution you provided worked. I would like to close out this Linux Question.
 
  


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
What does a drive label do/change? Garda Debian 4 10-21-2012 12:00 PM
[SOLVED] Change HD 'Label' nnjond Linux - Newbie 5 07-30-2011 12:49 AM
change cron.daily run time jimmyjiang Red Hat 4 03-02-2007 01:35 PM
How to change the label of a disk dtournas Red Hat 0 08-17-2004 08:02 AM
opening new by clicking pushbutton dialog box in qt for linux nbb Programming 3 08-09-2004 03:58 AM

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

All times are GMT -5. The time now is 04:47 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