Custom GUI example?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/07/2005 at 17:54, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.102
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
"Are there any complete custom gui examples available that use user areas?Thank you,
Damon Gilbert" -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/07/2005 at 11:21, xxxxxxxx wrote:
No, I don't think so. However, at some point in the existing examples you will have a dialog, and then you can insert a user area just like you do in a real dialog. Could you tell us a bit more of what you have already and what you want to do?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2005 at 11:46, xxxxxxxx wrote:
Greetings:
Right now I have a user area working inside a asyncronous dialog. What I am trying to do is insert this user area into the attribute manager. This is only to manipulate date and not to store it.
Hope you can help.
Thanks
Damon
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2005 at 06:54, xxxxxxxx wrote:
Here is an example I found of a custom GUI for the string type.
#include "c4d.h" const LONG MY_STRING_GUI_ID = 1016814; static LONG restypetable[] = { DA_STRING }; class MyStringGUIDialog : public iCustomGui { INSTANCEOF(MyStringGUIDialog, iCustomGui) private: BaseContainer m_settings; String m_str; Bool m_tristate; public: MyStringGUIDialog(const BaseContainer &settings, CUSTOMGUIPLUGIN *plugin) : iCustomGui(settings, plugin), m_str("[default"), m_tristate(false), m_settings(settings) { } virtual Bool CreateLayout (void) { GroupBegin(1002, BFH_SCALEFIT, 2, 1, "", 0); { AddStaticText(1001, BFH_FIT, 0, 0, "Test:", 0); AddEditText(1000, BFH_SCALEFIT, 20, SizeChr(1)); } GroupEnd(); return TRUE; } virtual Bool InitValues() { SetString(1000, m_str, m_tristate); // We cannot look at the return value from SetString() since it's broken in 8.503 return TRUE; } virtual LONG Message(const BaseContainer& msg, BaseContainer& result) { switch(msg.GetId()) { case BFM_DRAGRECEIVE: { if (msg.GetLong(BFM_DRAG_FINISHED) && CheckDropArea(1000, msg, TRUE, TRUE)) { LONG type = 0; void *object = NULL; GetDragObject(msg, &type, &object); if (object && type == DRAGTYPE_ATOMARRAY) // DRAGTYPE_OBJECT { AtomArray* array = static_cast<AtomArray*>(object); Atom* atom = array->GetPreferred(); if (atom && atom->IsInstanceOf(Obase)) { BaseObject* obj = static_cast<BaseObject*>(atom); SetString(1000, obj->GetName()); BaseContainer actionmsg(BFM_ACTION), actionresult; actionmsg.SetLong(BFM_ACTION_ID, 1000); SUPER::Message(actionmsg, actionresult); } } } else SetDragDestination(CheckDropArea(1000, msg, TRUE, TRUE) ? MOUSE_POINT_HAND : MOUSE_FORBIDDEN); } return TRUE; } return SUPER::Message(msg, result); } virtual Bool Command(LONG id, const BaseContainer& msg) { switch (id) { case 1000: { BaseContainer m(msg); m.SetLong(BFM_ACTION_ID, GetId()); m.RemoveData(BFM_ACTION_VALUE); m.SetData(BFM_ACTION_VALUE, GetData().GetValue()); SendParentMessage(m); break; } } return TRUE; } virtual Bool SetData(const TriState<GeData> &tristate) { m_str = tristate.GetValue().GetString(); m_tristate = tristate.GetTri(); return InitValues(); } virtual TriState<GeData> GetData() { GetString(1000, m_str); return m_str; } }; class MyStringGUI : public CustomGuiData { public: virtual LONG GetId() { return MY_STRING_GUI_ID; } virtual CDialog* Alloc(const BaseContainer &settings) { MyStringGUIDialog* dlg = gNew MyStringGUIDialog(settings, GetPlugin()); if (!dlg) return NULL; CDialog *cdlg = dlg->Get(); if (!cdlg) return NULL; return cdlg; } virtual void Free(CDialog *dlg, void *userdata) { if (!dlg || !userdata) return; MyStringGUIDialog *sub = static_cast<MyStringGUIDialog*>(userdata); gDelete(sub); } virtual CHAR *GetResourceSym() { return "MY_STRING_GUI"; } virtual LONG GetResourceDataType(LONG *&table) { table = restypetable; return sizeof(restypetable)/sizeof(LONG); } }; Bool RegisterStringGUI() { static BaseCustomGuiLib mylib; ClearMem(&mylib,sizeof(mylib)); FillBaseCustomGui(mylib); return InstallLibrary(MY_STRING_GUI_ID, &mylib, 1000, sizeof(mylib)) && RegisterCustomGuiPlugin("My String GUI", 0*PLUGINFLAG_HIDE, gNew MyStringGUI); }