34 lines
617 B
Elixir
34 lines
617 B
Elixir
|
|
--# Grid demo
|
|
|
|
include GtkEngine.e
|
|
|
|
constant win = create(GtkWindow,{
|
|
{"title","Grid Demo"},
|
|
{"border width",10},
|
|
{"position",GTK_WIN_POS_CENTER}})
|
|
connect(win,"destroy","Quit")
|
|
|
|
constant grid = create(GtkGrid,{
|
|
{"row homogeneous",TRUE},
|
|
{"column homogeneous",TRUE},
|
|
{"row spacing",5},
|
|
{"column spacing",5}})
|
|
add(win,grid)
|
|
|
|
integer i = 1
|
|
atom id
|
|
|
|
for y = 1 to 10 do
|
|
for x = 1 to 10 do
|
|
id = create(GtkLabel,{
|
|
{"text",sprintf("%3d",i)},
|
|
{"color",rand(#FFFFFF)}})
|
|
set(grid,"attach",id,x,y,1,1)
|
|
i += 1
|
|
end for
|
|
end for
|
|
|
|
show_all(win)
|
|
main()
|