help on tip "Making Netscape-style Toolbars"

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

6 posts / 0 new
Last post
help on tip "Making Netscape-style Toolbars"

Submitted by Anonymous on Tue, 04/08/2003 - 06:42.

Hi, i have this problem
I want to have a single togglebutton with the style specified in the following Motifzone tip

>The resource file fragment to include looks like
>! Translations for new style toolbar buttons (and toggles).
>*toolbar*XmPushButton.baseTranslations #override

> CustomShadows(on) Arm()

> CustomShadows(on) Enter()

> CustomShadows(off) Leave()

> MapCheck()
>*toolbar*XmToggleButton.baseTranslations #override

> CustomShadows(on) Arm()

> Select() Disarm() CustomShadows(check)

> CustomShadows(on) Enter()

> CustomShadows(off) Leave()

> MapCheck()
>In addition, make a call to XtAppAddActions with a table >containing this data, to map the strings mentioned in the >translations table to the functions used above
> static XtActionsRec actions[] = {
> {"CustomShadows", shadowAC},
> {"MapCheck", mapAC}
> };

I want do it without resource specification (i cannot do it)
In my app i write the following

char toggleBaseTranslations[] =
"#override

CustomShadows(on) Arm()

Select() Disarm() CustomShadows(check)

CustomShadows(on) Enter()

CustomShadows(off) Leave()

MapCheck()";
XtActionsRec actions[] = {
{"CustomShadows", shadowAC},
{"MapCheck", mapAC}
};
toggleBtn_xlations = XtParseTranslationTable(toggleBaseTranslations);
XtAddActions (actions, XtNumber (actions));
.....
w=XtVaCreateManagedWidget(name,
xmToggleButtonWidgetClass, parent_w,
NULL);

XtOverrideTranslations (w, toggleBtn_xlations);
....

When i execute my program i have the following
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(on) Arm()`
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(on) Enter()`
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(off) Leave()`
Warning translation table syntax error Unknown modifier name MapCheck
Warning ... found while parsing ` MapCheck()`
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(on) Arm()`
Warning translation table syntax error Unknown modifier name Select
Warning ... found while parsing ` Select() Disarm() CustomShadows(check)`
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(on) Enter()`
Warning translation table syntax error Unknown modifier name CustomShadows
Warning ... found while parsing ` CustomShadows(off) Leave()`
Warning translation table syntax error Unknown modifier name MapCheck
Warning ... found while parsing ` MapCheck()`

How i can override without resource file the base translation of
a widget? I make some errors in the translation syntax? (I copy it from motifzone)...
Thank you for help!

Wed, 04/09/2003 - 20:02#1

Wed, 04/09/2003 - 20:02#1

ICS_support

help on tip "Making Netscape-style Toolbars"

I`m going to take a stab at this you cut-and-pasted the above, so I`m betting that you cut-and-pasted the original posting right into your program. I think you have extra spaces after the lines within the translation table toggleBaseTranslations. Make sure each line ends with a new-line directly after the backslash-n-backslash.

Thu, 04/10/2003 - 06:29#2

Thu, 04/10/2003 - 06:29#2

Anonymous

help on tip "Making Netscape-style Toolbars"

Thank you, I`ll verify it...
Can you explain me the meanings of

char toggleBaseTranslations[] =
"#override

CustomShadows(on) Arm()

Select() Disarm() CustomShadows(check)

CustomShadows(on) Enter()

CustomShadows(off) Leave()

MapCheck()";

I don`t understand the meaning of no words before ``. What is the translation that has to be overrided? how can i override the
base translations without specify in a resource file the
`*toolbar*XmToggleButton.baseTranslations...`?

I have used in my program the following

char toggleBaseTranslations[] =
"#override

CustomShadows(on) Arm()

Select() Disarm() CustomShadows(check)

CustomShadows(on) Enter()

CustomShadows(off) Leave()

MapCheck()";

but i have the following bad behavior if i set sensitivity of
button to false after clicking on it, the button shadow is frozen
to top shadow. Is there a bug?

Fri, 04/11/2003 - 07:48#3

Fri, 04/11/2003 - 07:48#3

ICS_support

help on tip "Making Netscape-style Toolbars"

I assumed those were trimmed out by your mailer or browser! Things between brackets seem to disappear these days.

There is information on this in the comp.windows.x.motif FAQ, if I recall correctly. It is at http//www.faqs.org .

 

Fri, 04/11/2003 - 09:13#4

Fri, 04/11/2003 - 09:13#4

Anonymous

help on tip "Making Netscape-style Toolbars"

OK I open the page with a text editor and I found

*toolbar*XmPushButton.baseTranslations #override

CustomShadows(on) Arm()

CustomShadows(on) Enter()

CustomShadows(off) Leave()

MapCheck()

*toolbar*XmToggleButton.baseTranslations #override

CustomShadows(on) Arm()

Select() Disarm() CustomShadows(check)

CustomShadows(on) Enter()

CustomShadows(off) Leave()

MapCheck()

Thank you...

What happens if i click on the button and in my callback there is the setting of its sensitive status to false?
I have a strange behavior the button appears raised and grayed...I think that the button must appear flat and grayed...and you?

Mon, 04/14/2003 - 17:33#5

Mon, 04/14/2003 - 17:33#5

ICS_support

help on tip "Making Netscape-style Toolbars"

Ah. That is a separate problem. Usually, you handle this problem -- and other problems in callbacks in which you affect greatly the state of a widget -- by using timers.

In this case, you have this function

static void myCallback(blah,blah)
{
/* register a 0ms or 1ms time-out myTimer() with this widget */
}

static void myTimer(blah,blah)
{
/* recover the widget ID, now set it insensitive */
}

By using the timer, Xt returns to its event loop, having fully dispatched all widget events and bringing them up to date -- and then immediately processes the timer event, setting the object insensitive.