Lock Icon
-
On 27/09/2013 at 05:13, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R15
Platform: Windows ;
Language(s) : C++ ;---------
Hi,Most C4D Attribute Managers have at the top-right some icons, like search, new, etc.
I need a lock-icon for my plug, but I can't find out how to do this in code.
I'm not using a resource file for the layout.Connie.
-
On 27/09/2013 at 05:41, xxxxxxxx wrote:
You can add elements into the menu bar by enclosing it in a InMenuLine-block like this:
GroupBeginInMenuLine(); BaseContainer bc = GetCustomDataTypeDefault(CUSTOMGUI_BITMAPBUTTON); bc.SetBool(BITMAPBUTTON_BUTTON, TRUE); bc.SetBool(BITMAPBUTTON_TOGGLE, TRUE); bc.SetLong(BITMAPBUTTON_ICONID1, LOCKICONID); AddCustomGui(IDC_LOCK, CUSTOMGUI_BITMAPBUTTON, "", 0, 0, 0, bc) GroupEnd();
-
On 27/09/2013 at 09:38, xxxxxxxx wrote:
Ah, thanks for that.
Are the 'LOCKICONID' and 'IDC_LOCK' not c4d constants ?, because the compiler cannot find them.
I also searched the whole resource directory with no result.
I thought these icons were standard C4D UI elements, but I should provide my own bitmaps ?Connie
-
On 27/09/2013 at 14:49, xxxxxxxx wrote:
Here's a bit more code for you to chew on.
It also shows how to toggle the lock image in a GeDialog plugin.BTW: All of this code is in the plugin's .cpp file
enum { LOCKBUTTON = 1003, //The ID for the inline lock button _dummy }; class myDialog : public GeDialog { private: Bool lockState; //Used to control things in any of the plugin's methods BitmapButtonCustomGui *lockButton; public: myDialog(void); virtual Bool CreateLayout(void); //Other virtual methods here... }; Bool myDialog::CreateLayout(void) { //This code loads things from a .res file if desired Bool res = TRUE; res = LoadDialogResource(IDS_RESDIALOG,NULL,0); //This code block creates an inline button with the locked/unlocked icon on it GroupBeginInMenuLine(); BaseContainer bc = GetCustomDataTypeDefault(CUSTOMGUI_BITMAPBUTTON); bc = GetCustomDataTypeDefault(CUSTOMGUI_BITMAPBUTTON); bc.SetBool(BITMAPBUTTON_BUTTON, TRUE); bc.SetBool(BITMAPBUTTON_TOGGLE, TRUE); if(lockState) bc.SetLong(BITMAPBUTTON_ICONID1, -12679); //Lock icon if(!lockState) bc.SetLong(BITMAPBUTTON_ICONID1, 12679); //Unlock icon lockButton = (BitmapButtonCustomGui* )AddCustomGui(LOCKBUTTON, CUSTOMGUI_BITMAPBUTTON,"", 0,0,0,bc); GroupEnd(); return res; } Bool myDialog::Command(LONG id, const BaseContainer &msg) { switch (id) { case LOCKBUTTON: { //Toggle this class level variable true/false so we can control things with it lockState = !lockState; //Toggle the icon image if(lockState) lockButton->SetImage(-12679, FALSE); else lockButton->SetImage(12679, FALSE); GePrint("LockState: " + LongToString(lockState)); } break; } EventAdd(); return TRUE; }
Hope that helps.
-ScottA
-
On 28/09/2013 at 02:24, xxxxxxxx wrote:
I think RESOURCEIMAGE_LOCKED is what you search for. See a list of icons here:
<[URL-REMOVED]>
Best,
-Niklas
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 28/09/2013 at 02:26, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Ah, thanks for that.
Are the 'LOCKICONID' and 'IDC_LOCK' not c4d constants ?, because the compiler cannot find them.
I also searched the whole resource directory with no result.
I thought these icons were standard C4D UI elements, but I should provide my own bitmaps ?Connie
I think Satara used LOCKICONID as a proxy and you were supposed to replace it with the
propery Icon ID. IDC_LOCK is equal to LOCKICON in Scott's example: The ID of the GUI Widget.
It is undefined because you need to define it yourself.Best,
-Niklas -
On 30/09/2013 at 01:20, xxxxxxxx wrote:
Thanks to you Scott, Niklas & Satara; I'v got it working!
Connie