Thanks, that is indeed somewhat differentReplace the function CAT(STRING FileName$): with....
Regards,
s
It seems you are referring to the GTK-server program? This is not a GTK demo, but a demo with the GTK-server.As noted, the gtk demo from website also gave the error:
~ $ sudo bacon ./gtk-server-new.bac
Starting conversion... done.
Starting compilation... done.
Program './gtk-server-new' ready.
~ $ ./gtk-server-new
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
ah...initially saw it in the gtk-demos dir of bacon.tar.gz, so thought it was independent.PjotAwake wrote:
It seems you are referring to the GTK-server program? This is not a GTK demo, but a demo with the GTK-server.
..just tried a few, everything working fine.Note that you will find actual GTK demo programs a little bit down below on the BaCon website.
As Barry says, it's like religion. I don't run in root. Thanks for the great work!BTW why are you using 'sudo'?
Code: Select all
' *************************************************************
' PROGRAM: screensize.bac
' PURPOSE: get X screen size in pixels from default display
' AUTHOR: vovchik (Puppy Linux forum)
' COMMENTS: GPL
' DEPENDS: bacon 1.0 build 0.19, gtk, gdk libs
' PLATFORM: Linux (actually, any *nix)
' DATE: 03-10-2010
' VERSION: 0.1a
' *************************************************************
' *********************
' DEF ERROR HANDER
' *********************
TRAP LOCAL
CATCH GOTO PRINT_ERROR
' *********************
' END DEF ERROR HANDER
' *********************
' *********************
' CONSTANTS
' *********************
CONST Gtk$ = "libgtk-x11-2.0.so.0"
CONST Gdk$ = "libgdk-x11-2.0.so.0"
' *********************
' END CONSTANTS
' ********************
' *********************
' DECLARATIONS
' *********************
DECLARE MyScreen$ TYPE STRING
' *********************
' END DECLARATIONS
' *********************
' *********************
' IMPORTS
' *********************
IMPORT "gtk_init(int*,void*)" FROM Gtk$ TYPE void
IMPORT "gtk_exit(int)" FROM Gtk$ TYPE void
IMPORT "gtk_window_get_size(long,int*,int*)" FROM Gtk$ TYPE void
IMPORT "gdk_screen_get_default" FROM Gdk$ TYPE long
IMPORT "gdk_screen_get_width(long)" FROM Gdk$ TYPE int
IMPORT "gdk_screen_height(long)" FROM Gdk$ TYPE int
' *********************
' END IMPORTS
' *********************
' *********************
' FUNCTIONS
' *********************
' ------------------
FUNCTION SCREENSIZE(NUMBER mode)
' ------------------
' mode = 0 returns x (width)
' mode = 1 returns y (height)
' mode = 2 returns space-delimited x (width) and y (height)
' otherwise function returns error message
LOCAL x, y TYPE int
LOCAL myresult$ TYPE STRING
y = gdk_screen_height(gdk_screen_get_default())
x = gdk_screen_get_width(gdk_screen_get_default())
SELECT mode
CASE 0
myresult$ = STR$(x)
CASE 1
myresult$ = STR$(y)
CASE 2
myresult$ = CONCAT$(STR$(x), " ", STR$(y))
DEFAULT
myresult$ = CONCAT$("Error: SCREENSIZE(", STR$(mode), ") mode is bad: 0 = w, 1 = h and 2 = h and w.")
END SELECT
RETURN CHOP$(myresult$)
END FUNCTION
' *********************
' END FUNCTIONS
' *********************
' *********************
' MAIN
' *********************
gtk_init(0, 0)
MyScreen$ = SCREENSIZE(0)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(1)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(2)
PRINT MyScreen$
MyScreen$ = SCREENSIZE(3)
PRINT MyScreen$
gtk_exit(0)
END
' *********************
' END MAIN
' *********************
' *********************
' ERROR HANDLER
' *********************
LABEL PRINT_ERROR
PRINT "GTK library ", Gtk$, " is not available on this platform!"
END
' *********************
' END ERROR HANDLER
' *********************
Code: Select all
use_proxy = on
Vovchik has kindly looked through my code and made some refinements, including improving that problem with big fonts.seaside wrote:Barry,
Always nice to try something new....
I get the following problem of cut off characters, not only in your program, but in some of the gui demos as well. See below.
Regards,
s
Code: Select all
BASHV=$(bash --version)
VN=$(echo $BASHV | cut -f1 -d. | sed 's/^.*\(.\)$/\1/')
[ $VN -lt 4 ] && gxmessage -title "Bash Version Problem" -center -bg orange "$BASHV installed
---------------> Bash must be version 4 <-------------------" & exit
Code: Select all
INCLUDE "hug.bac"
win_width = 200
win_height = 100
mainwin = WINDOW("Radio test", win_width, win_height)
my_radio1 = RADIO("On", 50, 30, my_radio2)
my_radio2 = RADIO("Off", 50, 30, my_radio1)
ATTACH(mainwin, my_radio1, 20, 20)
ATTACH(mainwin, my_radio2, 20, 50)
DISPLAY
Thanks vovchik,vovchik wrote:Dear jpeps,
In my tests, radio buttons in HUG work exactly as advertised. Try this code:
With kind regards,Code: Select all
INCLUDE "hug.bac" win_width = 200 win_height = 100 mainwin = WINDOW("Radio test", win_width, win_height) my_radio1 = RADIO("On", 50, 30, my_radio2) my_radio2 = RADIO("Off", 50, 30, my_radio1) ATTACH(mainwin, my_radio1, 20, 20) ATTACH(mainwin, my_radio2, 20, 50) DISPLAY
vovchik
Code: Select all
BASHV=$(bash --version | head -1)
VN=$(echo $BASHV | cut -f1 -d. | sed 's/^.*\(.\)$/\1/')
[ $VN -lt 4 ] && Xdialog --title "bash version test " \
--infobox "\nBash Version Problem $BASHV installed
---------------> Bash must be version 4 or above for BaCon <-------------------" "\n" 0 0
This seems to work:jpeps wrote:Thanks vovchik,vovchik wrote:Dear jpeps,
In my tests, radio buttons in HUG work exactly as advertised. Try this code:
With kind regards,Code: Select all
INCLUDE "hug.bac" win_width = 200 win_height = 100 mainwin = WINDOW("Radio test", win_width, win_height) my_radio1 = RADIO("On", 50, 30, my_radio2) my_radio2 = RADIO("Off", 50, 30, my_radio1) ATTACH(mainwin, my_radio1, 20, 20) ATTACH(mainwin, my_radio2, 20, 50) DISPLAY
vovchik
And for a group? Specifically, I was looking at:
FUNCTION RADIO (STRING text$, int xsize, int ysize, NUMBER group)
(I did something similar using checkbuttons with a reset function)
Code: Select all
INCLUDE "hug.bac"
win_width = 200
win_height = 100
mainwin = WINDOW("Radio test", win_width, win_height)
my_radio1 = RADIO("One", 50, 30, my_radio3)
my_radio2 = RADIO("Two", 50, 30, my_radio1)
my_radio3 = RADIO("Three", 50, 30, my_radio1)
ATTACH(mainwin, my_radio1, 20, 20)
ATTACH(mainwin, my_radio2, 20, 50)
ATTACH(mainwin, my_radio3, 20, 80)
DISPLAY
vovchik wrote:Dear jpeps,
I was hoping you would do just that. After posting and seeing your reply, I wrote the EXACT same code.
With kind regards,
vovchik
Code: Select all
PUPMODE=12
PDEV1='sr0'
DEV1FS='iso9660'
PUPSFS='sda7,ext3,/w0981011.143/wary_098.sfs'
PUPSAVE='sda7,ext3,/warysave-098.2fs'
PMEDIA='usbcd'
#kernel with libata pata has both sata and pata drives in ATADRIVES...
ATADRIVES='sda '
#these directories are unionfs/aufs layers in /initrd...
SAVE_LAYER='/pup_rw'
PUP_LAYER='/pup_ro2'
#The partition that has the warysave file is mounted here...
PUP_HOME='/mnt/dev_save'
#(in /initrd) ...note, /mnt/home is a link to it.
#this file has extra kernel drivers and firmware...
ZDRV='sda7,ext3,/w0981011.143/zw098114.sfs'
#complete set of modules in the initrd (moved to main f.s.)...
ZDRVINIT='no'
#Partition no. override on boot drive to which session is (or will be) saved...
PSAVEMARK=''