News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
feedback please
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: feedback please

Thanks for testing. I was planning eventually to test the first one on a more traditional desktop,but I've been pitifully lazy about it. Which tiling window manager did you test? I'm using dwm 5.4.1...downloaded 5.5 but haven't installed it yet. I've seen other weird things with 5.4, but as I said I'm lazy =o)

I spent a couple of hours poking at the second one and never came up with a solution. All I can say is it seems like a bug somewhere.

Did make a few more changes to the second one, to make it a little more useful..

Code:
w=fltk:Fl_Double_Window(500,420,"colors.lua")

function col_cb(self)
col_outpoot:value(self:tooltip())
colormap:color(self:color())
w:redraw()
end

-- make a 16x16 array of 20px boxes, 30px from the left edge
colors = {}
row=20;switch=15;bw=20;left=10
for i = 0,255 do
  colors[i]=fltk:Fl_Button(left+bw,row,bw,bw)
  colors[i]:type(fltk.FL_RADIO_BUTTON)
  colors[i]:selection_color(i)
  colors[i]:color(i)
  colors[i]:box(fltk.FL_THIN_UP_BOX)
  local r,g,b=Fl:get_color(i,r,g,b) -- get RGB values of current color
  -- show color index, rgb, and html values in tooltip
  colors[i]:tooltip("Color index: "..i.."\nRGB: "..r.." "..g.." "..b.."\nHTML: "..string.format("#%.2X%.2X%.2X",r,g,b))
  colors[i]:callback(col_cb)
  left=left+bw -- next box will be placed 20px to the right
  if i == switch then -- if we have reached 16 boxes
    switch = switch+16  -- next switch position will be in 16 loops
    row = row+bw        -- move to next row
    left = 10           -- move back to first column
  end
end

col_outpoot=fltk:Fl_Multiline_Output(30,17*bw,16*bw,60)

colormap=fltk:Fl_Button(380,20,100,80,"fl_show_colormap")
colormap:align(fltk.FL_ALIGN_BOTTOM)
colormap:callback(
function(colormap_cb)
-- pick an indexed color and apply it to the button
  local newcolor=fltk.fl_show_colormap(colormap:color())
  colormap:color(newcolor)
-- colormap:label("FLTK Color "..newcolor)
  colors[newcolor]:setonly()
  colors[newcolor]:do_callback()
end
)

colorchooser=fltk:Fl_Button(380,125,100,80,"fl_color_chooser")
colorchooser:align(fltk.FL_ALIGN_BOTTOM)
colorchooser:callback(
function(colorchooser_cb)
  local color_ok,r,g,b,cube_color -- initialize local variables
  r,g,b=Fl:get_color(colorchooser:color(),r,g,b)
  color_ok,r,g,b=fltk.fl_color_chooser("starting color: "..r.." "..g.." "..b,r,g,b)
  if color_ok == 1 then -- color_ok represents the first value (exit status) returned by fl_color_chooser
    hexcolor=string.format("#%.2X%.2X%.2X",r,g,b) -- convert the rgb values to hex
    colorchooser:color(fltk.fl_rgb_color(r,g,b)) -- apply 24-bit rgb color to button
    --colorchooser:color(fltk.fl_rgb_color(127,192,33)) -- debug
    -- set the color_cube box color
    cube_color=fltk.fl_color_cube(r * (fltk.FL_NUM_RED - 1) / 255,g * (fltk.FL_NUM_GREEN - 1) / 255,b * (fltk.FL_NUM_BLUE - 1) / 255)
    color_cube:color(cube_color)
    color_cube:label("fl_color_cube: "..cube_color)
    colors[cube_color]:setonly()
    colors[cube_color]:do_callback()
    colorchooser:label("Color "..colorchooser:color().."\nRGB "..r.." "..g.." "..b.."\nHTML "..hexcolor)
    w:redraw()
  end
end
)

color_cube=fltk:Fl_Box(380,260,100,80,"fl_color_cube")
color_cube:align(fltk.FL_ALIGN_BOTTOM)
color_cube:box(fltk.FL_UP_BOX)

w:show()
Fl:run()

06-30-2009 12:28 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
feedback please - mikshaw - 06-29-2009, 11:51 AM
RE: feedback please - mikshaw - 06-30-2009, 01:13 AM
RE: feedback please - jpjacobs - 06-30-2009, 06:01 AM
RE: feedback please - mikshaw - 06-30-2009 12:28 PM
RE: feedback please - jpjacobs - 07-01-2009, 04:21 AM
RE: feedback please - MrBill - 07-02-2009, 03:34 AM
RE: feedback please - mikshaw - 07-02-2009, 12:33 PM
RE: feedback please - jpjacobs - 11-29-2010, 10:08 PM
RE: feedback please - mikshaw - 11-30-2010, 01:55 PM
RE: feedback please - JohnMurga - 12-06-2010, 07:05 AM
RE: feedback please - mikshaw - 12-06-2010, 08:08 AM
RE: feedback please - jpjacobs - 12-06-2010, 10:05 AM
RE: feedback please - mikshaw - 12-07-2010, 01:37 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: