Hot Door CORE Forum
Custom widget - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: Custom widget (/showthread.php?tid=57)



Custom widget - Manikandan - 09-09-2015

Hi,
I am developing AI CS6 plugin. I am using Hot door core library for my development.
I am trying to draw the Rect frame in Panel. In mean while, I am trying to change the color also.
I have tried the below code, but I could not draw the rect. I don't know How to proceed the next step?

docCustomColorView.drawRect(rectFrame, true);
docCustomColorView.setDrawColor(Color::yellow());
docPanel.addWidget(docCustomColorView);

So please , guide me How to draw rect frame in panel using CustomWidget?


RE: Custom widget - garrett - 09-09-2015

Drawing can only be performed in a drawing callback. Register one with CustomWidget:ConfusedetDrawCallback()

Then you can use the logic you wanted before (but you have to set the color first before drawing a shape)

this->docCustomColorView.setDrawColor(hdi::core::Color::yellow());
this->docCustomColorView.drawRect(rectFrame, true);


RE: Custom widget - Manikandan - 09-10-2015

(09-09-2015, 10:39 PM)garrett Wrote: Drawing can only be performed in a drawing callback. Register one with CustomWidget:ConfusedetDrawCallback()

Then you can use the logic you wanted before (but you have to set the color first before drawing a shape)

this->docCustomColorView.setDrawColor(hdi::core::Color::yellow());
this->docCustomColorView.drawRect(rectFrame, true);

Thanks for your suggestion. Its working now.


RE: Custom widget - jun - 09-17-2015

(09-10-2015, 03:45 AM)Manikandan Wrote:
(09-09-2015, 10:39 PM)garrett Wrote: Drawing can only be performed in a drawing callback. Register one with CustomWidget:ConfusedetDrawCallback()

Then you can use the logic you wanted before (but you have to set the color first before drawing a shape)

this->docCustomColorView.setDrawColor(hdi::core::Color::yellow());
this->docCustomColorView.drawRect(rectFrame, true);

Thanks for your suggestion. Its working now.


Quick check. For this similar function I would like to create my own RGB color. Sample: hdi::core::Color(1,1,0.9,1). But it indicates that the RGB color should be in between range of "[0.0, 1.0] ". How does it work?? RGB value for light yellow would be (R:255, G:255, B:153) and I'm unable to figure how to place them in between the mentioned range given in the document.

Please guide me on this. Thank you.