hi,
adding the following InputEvent
to our GeUserArea in the geDialog gadget example seems to work as expected. If i understood correctly the question.
If the userArea is clicked, I load the preset inside my custom library (mylib.lib4d and preset mycolors). I retrieve the color information to an array, and call the HandleMouseDrag
This Manual was helpful :
ColorSwatchGroup
Bool InputEvent(const BaseContainer& msg) override
{
const maxon::String urlPreset = "preset://mylib.lib4d/mycolors"_s;
const SDKBrowserURL presetUrl = SDKBrowserURL(urlPreset);
AutoAlloc<ColorSwatchData> colorPreset;
if (colorPreset == nullptr)
return false;
ColorAlphaArray colorArray;
if (ColorSwatchData::ValidPreset(presetUrl))
{
if (colorPreset->LoadPreset(presetUrl))
{
ColorSwatchGroup* myGroup = colorPreset->GetGroupAtIndex(0);
myGroup->GetColors(colorArray, false);
// instead of returning the result of the function, one should want to handle the result correctly.
return HandleMouseDrag(msg, DRAGTYPE_RGBA_ARRAY, &colorArray, 0);
}
}
return true;
}
Cheers,
Manuel