@@ -8,7 +8,8 @@ function properties:initialize(sel, atoms)
88
99 self .checkbox1 = 1
1010 self .checkbox2 = 0
11- self .color = {155 ,155 ,155 }
11+ self .bgcolor = {155 ,155 ,155 }
12+ self .fgcolor = {100 ,100 ,100 }
1213
1314 self .textinput1 = " Hello"
1415 self .textinput2 = " World"
@@ -27,28 +28,41 @@ function properties:properties(p)
2728 p :add_check (" Check Box 2" , " updatecheckbox2" , self .checkbox2 )
2829
2930 -- Text inputs
30- p :new_frame (" First textinput" , 2 )
31+ p :new_frame (" First textinput" , 3 )
3132 p :add_text (" Check text 1" , " updatetext1" , self .textinput1 )
3233 p :add_text (" Check text 2" , " updatetext2" , self .textinput2 )
34+ p :add_text (" Check" , " updatetext2" , self .textinput2 )
3335
3436 -- Color picker
35- p :new_frame (" My Color Picker" , 1 )
36- p :add_color (" Background" , " updatecolorbg" , self .color )
37+ p :new_frame (" My Color Picker" , 3 )
38+ p :add_color (" Background" , " updatecolorbg" , self .bgcolor )
39+ p :add_color (" Foreground" , " updatecolorfg" , self .fgcolor )
40+ p :add_color (" Text" , " updatecolorfg" , {50 , 50 , 50 })
3741
3842 -- Number boxes
39- p :new_frame (" Numbers" , 2 )
43+ p :new_frame (" Numbers" , 3 )
4044 p :add_float (" Float" , " updatefloat" , self .float , 0 , 1 )
4145 p :add_int (" Int" , " updateint" , self .int , 1 , 16 )
46+ p :add_int (" Int" , " updateint" , self .int , 1 , 16 )
4247
4348 -- Combobox
44- p :new_frame (" Combo" , 1 )
49+ p :new_frame (" Combo" , 3 )
4550 p :add_combo (" Waveform" , " updatecombo" , self .combo , { " Sine" , " Square" , " Saw" , " Triangle" })
51+ p :add_combo (" Letter" , " updateletter" , 1 , { " A" , " B" , " C" , " D" })
52+ p :add_color (" Foreground" , " updatecolorfg" , self .fgcolor )
4653end
4754
4855function properties :updatecolorbg (args )
49- self .color [1 ] = args [1 ]
50- self .color [2 ] = args [2 ]
51- self .color [3 ] = args [3 ]
56+ self .bgcolor [1 ] = args [1 ]
57+ self .bgcolor [2 ] = args [2 ]
58+ self .bgcolor [3 ] = args [3 ]
59+ self :repaint (1 )
60+ end
61+
62+ function properties :updatecolorfg (args )
63+ self .fgcolor [1 ] = args [1 ]
64+ self .fgcolor [2 ] = args [2 ]
65+ self .fgcolor [3 ] = args [3 ]
5266 self :repaint (1 )
5367end
5468
@@ -87,7 +101,14 @@ function properties:updatecombo(combosel)
87101 pd .post (" combo is now " .. self .combo );
88102end
89103
104+ function properties :updateletter (letter )
105+ pd .post (" letter is now " .. letter );
106+ end
107+
90108function properties :paint (g )
91- g :set_color (table.unpack (self .color ))
109+ g :set_color (table.unpack (self .bgcolor ))
92110 g :fill_all ()
111+
112+ g :set_color (table.unpack (self .fgcolor ))
113+ g :fill_rect (20 , 20 , 100 , 100 )
93114end
0 commit comments