On 28/05/2015 at 23:04, xxxxxxxx wrote:
Ok thanks Sebastian.
Maybe we can fill this topic with some of the information I was missing :-)
a) I want to create a Separator but I have to specify a DescID. In a description resource file, you don't
need to specify an ID for a separator or even for a group if you don't want to. What IDs will be used
then? And can I do this in GetDDescription()?
I create the Separator with
inline DescID MakeSeparator(Int32 id, const DescID& parentId, Bool line)
{
DescID did{DescLevel{id, DTYPE_SEPARATOR, m_creator}};
if (!this->CheckSingleID(id)) return did;
BaseContainer bc;
bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_SEPARATOR);
bc.SetBool(DESC_SEPARATORLINE, line);
DebugAssert(m_desc->SetParameter(did, bc, parentId));
return did;
}
b) I want to create a group with 2 columns, but it just won't have two columns. The string and the
button widgets are not on the same line.
inline DescID MakeGroup(
Int32 id, const DescID& parentId, const String& name,
const String& shortName, Bool scaleH = true, Int32 columns = 1)
{
DescID did{DescLevel{id, DTYPE_GROUP, m_creator}};
if (!this->CheckSingleID(id)) return did;
BaseContainer bc;
bc.SetInt32(DESC_CUSTOMGUI, 0);
bc.SetString(DESC_NAME, name);
bc.SetString(DESC_SHORT_NAME, (shortName.Content() ? shortName : name));
bc.SetInt32(DESC_COLUMNS, columns);
DebugAssert(m_desc->SetParameter(did, bc, parentId));
return did;
}
The group and its children are created like this:
const DescID topGroupId = dh.MakeGroup(this->TopGroupID(), parentId, "", "", true, 2);
// Add the channel name parameter.
const DescID channelNameId = dh.MakeID(this->ChannelNameID(), DTYPE_STRING);
if (dh.CheckSingleID(channelNameId)) {
bc = GetCustomDataTypeDefault(DTYPE_STRING);
bc.SetString(DESC_NAME, "Channel Name");
bc.SetString(DESC_SHORT_NAME, "Channel Name");
bc.SetInt32(DESC_ANIMATE, DESC_ANIMATE_OFF);
desc->SetParameter(channelNameId, bc, topGroupId);
}
dh.MakeButton(this->RemoveButtonID(), topGroupId, "Remove", "-");
c) The MakeButton() function looks like this: But when I press the button, I get a breakpoint in
ge_container.h triggered (just as when you didn't initialize an entry in the container or didn't specify
the dtype in a DescLevel ).
inline DescID MakeButton(
Int32 id, const DescID& parentId, const String& name,
const String& shortName)
{
DescID did{DescLevel{id, DTYPE_BUTTON, m_creator}};
if (!this->CheckSingleID(id)) return did;
BaseContainer bc;
bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON);
bc.SetString(DESC_NAME, name);
bc.SetString(DESC_SHORT_NAME, (shortName.Content() ? shortName : name));
DebugAssert(m_desc->SetParameter(did, bc, parentId));
return did;
}
Can you give me any hints? Thanks!
-Niklas