2017년 4월 6일 목요일

color picker


Hi! I'm pretty new to this kind of programming. 
I'm making the paint pot app and instead of selecting colors by pressing different buttons I Wanted to put all the thing together by using one single button(color selector) that allows you to pick the color you want.The picture I attached clarifies my idea. is there any way to do so?
--
Oh my.  Use a Canvas.   Place 16 sprites (that are boxes of the colors you will use).    Use the touchdown events of each sprite to select the color AI2 knows (the color associated with the touchdown event.  What you do here is use the sprites like buttons.

or, Using a Table Layout,; 2 rows by 8 columns;   Place a button in each.  Set the background color of each button to the colors you want.   Set the text of the button to nothing and/or set the button text to none.  Also size each button H and W   to perhaps 20 x 20 ... then in the event handler of each button, place the code to change the color...

or .... your imagination is as good as mine I suspect.  Try your own ideas.    Make a simple test project called colors, and make this work like you want it to work?

Oh, and you would hide the Canvas initially (or the Table arrangement) and call it with a button that would change the visibility of the component/layout to true.

--

댓글 없음:

댓글 쓰기