1) I would like to be able to pass parameters into my gtkbasic program, can anyone explain the syntax of how I read them in gtkbasic.
2) The window slides slowly up the screen 1 pixel at a time but as it slides onto the screen only the first 40 or so rows of pixels in the label are displayed. If I pop the window fully onscreen and then move it the display is fine. Once the window has reached its final position I can use gtk_widget_hide followed by gtk_widget_show to force a refresh, but executing this for every 1 pixel move causes flicker (unsurprisingly).
I have fixed this by doing hide then show once every 20 pixels but I wonder if there is a better way.
Code: Select all
#!/usr/bin/gtkbasic003
// uncomment these 2 lines, if you use localization and have those files!
//include "/tmp/en-Notify.mo"
//include "/tmp/Notify.mo"
HERE = xwin_getdir(command(2))
HERE &= "/resource"
xwin_cd(HERE)
foo=xwin_system("xdpyinfo | grep dimensions |awk '{print $2}' | cut -f 1 -d 'x'")
width=foo[0]-5
foo=xwin_system("xdpyinfo | grep dimensions|awk '{print $2}' | cut -f 2 -d 'x'")
height=foo[0]-5
//-- load file and show the window
gins_glade("project.glade")
gins_main()
gtk("gtk_widget_hide" , "window1" , 0 , 0 , 0 , 0 , 0)
gtk("gtk_label_set_label" , "label1" , "hello <b>world</b>. \n\nThis is a long string to force the widget to have a height greater than 34. This is a long string to force the widget to have a height greater than 34." , 0 , 0 , 0 , 0)
gdk_flush()
gtk("gtk_window_get_size" , "window1" , "&x" , "&y" , 0 , 0 , 0)
a = gtk_returnpointervalue("1")
b = gtk_returnpointervalue("2")
gtk("gtk_widget_show_now" , "window1" , 0 , 0 , 0 , 0 , 0)
counter = 0
'note that b is a string but you can do maths on it to get numeric output
final=b+1
//-- mainloop window slide with no eventhandling
while counter < final
gtk("gtk_window_get_size" , "window1" , "&x" , "&y" , 0 , 0 , 0)
a = gtk_returnpointervalue("1")
b = gtk_returnpointervalue("2")
gtk("gtk_window_move" , "window1" , (width-a), (height-counter) , 0 , 0 , 0)
counter = counter + 1
checkclose()
gdk_flush()
'force the text to display, I don't understand why this is needed
if counter/20 = int (counter/20) then
gtk("gtk_widget_hide" , "window1" , 0 , 0 , 0 , 0 , 0)
gtk("gtk_widget_show" , "window1" , 0 , 0 , 0 , 0 , 0)
end if
xwin_usleep(40000)
wend
'force the text to display, I don't understand why this is needed
gtk("gtk_widget_hide" , "window1" , 0 , 0 , 0 , 0 , 0)
gtk("gtk_widget_show" , "window1" , 0 , 0 , 0 , 0 , 0)
//-- mainloop display entire window with eventhandling
for i = 1 to 10000
widget , event , pdata = gins_event()
if widget != Nothing then
print widget, event, pdata
if event = "GDK_DELETE" then
gins_exit()
end
end if
if event = "GDK_BUTTON_RELEASE" then
gins_exit()
end
print widget, event, pdata
end if
end if
xwin_usleep(2000)
next i
//------------------------------------------------------------
// this function exits Basic, if the grafical interface closed
sub checkclose()
a=gins_get("window1" , "name" , "<str>")
if a = Nothing then
print "window was closed, exiting..."
gins_exit()
end
end if
end sub