GeDialog group problem
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/01/2006 at 13:31, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.5
Platform: Windows ;
Language(s) : C++ ;---------
I have a GeDialog class in ObjectData plugin, which consists of a group with several text fields, values of which should be rewritten in a variable every time they change. This is what i have:LONG AtomDialog::Message(const BaseContainer& msg, BaseContainer& result) { LONG t=msg.GetId(); if (t==BFM_ACTION) { BaseContainer bc(msg); Real i=bc.GetReal(AVERAGE_); ... ... return (GeDialog::Message(msg,result)); }
but it seems that i is always 0... Any ideas why? (i've been trying to find it out by myself for 2 days, and i'm becoming a bit edgy about this :>)
Thanks in advance,
regards -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/01/2006 at 16:06, xxxxxxxx wrote:
Use AtomDialog::Command() instead for BFM_ACTIONS, for example:
// GeDialog.Command //*---------------------------------------------------------------------------* Bool IPPDialog::Command(LONG id, const BaseContainer& msg) //*---------------------------------------------------------------------------* { // Help if (id == IP_ABOUT) OpenAboutDlg(); else if (id == IP_HELPDOC) return OpenDocumentation(); ... else if (id == IP_SET_IMPORTSCALE) settings.SetObjScaling(msg.GetReal(BFM_ACTION_VALUE)); return TRUE; }
Now you know why it doesn't work - it doesn't work that way...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/01/2006 at 16:13, xxxxxxxx wrote:
Now, if this is an EditNumber type of gadget, you can do more using GeDialog::Message(), but you'll need to do it something like this:
// GeDialog.Message //*---------------------------------------------------------------------------* LONG DIDialog::Message(const BaseContainer& msg, BaseContainer& result) //*---------------------------------------------------------------------------* { //GePrint(BaseContainerToString(msg)); if ((msg.GetId() == BFM_ACTION) && msg.GetLong(BFM_ACTION_VALCHG) && !msg.GetLong(BFM_ACTION_STRCHG)) { String expression; Real value; LONG error; // Primary ------------------------------------------------------------ // Value if (msg.GetLong(BFM_ACTION_ID) == DI_PVALUE) { GetString(DI_PVALUE, expression); if (expression == "") value = 0.0; else if (!parser->Eval(expression, &error;, &value;, UNIT_NONE, ANGLE_DEG, 10)) value = settings.GetValue(0); settings.SetValue(0, value); SetMeter(DI_PVALUE, settings.GetValue(0)); } ... return GeDialog::Message(msg,result); }
Note that here, I support C4D math expressions in the entry box and reset the value if empty or the expression invalid.
Also, if you have arrows on the entry box, you'll need to do the previous stuff (GeDialog::Command()) as well.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 01:23, xxxxxxxx wrote:
thanks kuroyume0161... i'll just call a command rutine from message and work there i guess...
But there is still a problem... msg.GetReal(id) still returns 0 every time...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 04:21, xxxxxxxx wrote:
nevermind. should be mgs.GetReal(BFM_ACTION_VALUE) instead...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 04:24, xxxxxxxx wrote:
hmm, BaseContainer bs(msg); bs.SetReal(id,1000); still doesn't work though...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 09:52, xxxxxxxx wrote:
You shouldn't do it that way. Use 'msg' to get the gadget id:
id = msg.GetLong(BFM_ACTION_ID);
and then use the GeDialog plain getter to get the gadget's setting:
Real value;
GetReal(id, &value;);GeDialog::Command() is called for most (if not all) dialog gadgets that you add. You don't need to call it from Message(). For the EditNumber and EditNumberArrow gadgets, when you enter a number, expression, or use the arrows to change the value, both Message() and Command() are called for the gadget. But you must handle expressions in Message() and the arrows in Command(). If you are not handling expressions, you can just use Command() to retrieve the number, for instance:
if (id == MYREALGADGET)
realNum = msg.GetReal(BFM_ACTION_VALUE);where 'realNum' is some local or class member variable into which you need to store this value.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 10:05, xxxxxxxx wrote:
hmm... yes, i can read data with GetReal(BFM_ACTION_VALUE) from Command rutine, but i don't have a slightest idea how to set for example AVERAGE EditNumberArrow gadget to 1000. I thought msg.SetReal(id,1000), where id is AVERAGE should do the trick, but it doesn't work in command rutine nor in message. And all examples i've looked had done that with msg.setreal method... In that case, i don't understand, if that is the wrong way to do it, why it seems to be working for other...
All .Get* rutines work from Command perfectly though, thanks again for that, but when i need to write anything into the gadget...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 10:23, xxxxxxxx wrote:
Just use the plain setter:
SetReal(id, 1000.0);
The GeDialog setters and getters are the way to set and get the value in a non-user-interaction context. You only need to worry about msg.XXX when there is a user-interaction culminating in a message that needs to be addressed, such as when the value is changed by the user (and not you).
HTH,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/01/2006 at 11:00, xxxxxxxx wrote:
yep, that works... i find every day something new thanks again, and sorry for stealing so much of your time...
regards