[gtk-server] Re: Calendar Widget

  • From: "John Spikowski" <johnspikowski@xxxxxxxxx>
  • To: <gtk-server@xxxxxxxxxxxxx>
  • Date: Sun, 8 Apr 2007 14:46:27 -0700

Bill,
 
Peter created a nice extension for ScriptBasic if your looking for a
scripting language that's easy to use and runs on Linux and Windows. Here is
ans example of using Glade with ScriptBasic.
 
http://www.scriptbasic.org/forum/viewtopic.php?t=6
 
John



  _____  

From: gtk-server-bounce@xxxxxxxxxxxxx
[mailto:gtk-server-bounce@xxxxxxxxxxxxx] On Behalf Of Bill Christiansen
Sent: Sunday, April 08, 2007 1:26 PM
To: gtk-server@xxxxxxxxxxxxx
Subject: [gtk-server] Re: Calendar Widget


Thanks Peter,
I'm really just starting to learn linux programming so I have a lot to
learn. I did have a play around with the prototype in the gtk-server.cfg
before reading your post. I was a bit confused whether  parameters reqired
by the function were the ones it used or the ones it returned (or both). I
noticed in some configurations the function would return an "ok" instead of
the "-1" and if I got it too wrong it would crash (not surprisingly). 

I did try the same project with another program called Gins that's being
worked on by one of the Puppy Linux developers:
http://www.puppyos.net/forum/?1172392169;3
<http://www.puppyos.net/forum/?1172392169;3> 
With Gins I could recieve data from the calendar widget but ran into a
similar problem with pointers when it came to using the textview widget. I
notice Gins uses the gdk_button_release signal instead of the calendars
day_selected event but not sure if that would make a difference. It also
only works using stdin and returns line data which can be read by BASH's
read function. 

I will experiment a bit more and possibly look at a different scripting
language.

Bill


On 4/8/07, Peter van Eerten <  <mailto:administrator@xxxxxxxxxxxxxx>
administrator@xxxxxxxxxxxxxx> wrote: 

Hi there,

The reason for the '-1' returnvalue is, that you need to add the
prototype of the call 'gtk_calender_get_date' to the configfile of the
GTK-server.

I would define it as follows: 

FUNCTION_NAME = gtk_calender_get_date, NONE, NONE, 4, WIDGET, LONG, LONG,
LONG


However, the last three arguments are in fact pointers to memory, as
you also mention yourself. With BASH I do not see how the memory 
pointed to can be read. There are some interpreted languages though,
which can 'read' memory assigned by C-pointers, like Perl, or newLisp.

In most situations, when a signal occurs on the widget, it is possible 
to read the data which was sent with the signal. But with the calender
widget also no additional data is sent.

For BASH, as workaround you could write a small C program and compile
it as a binary. When this binary is invoked within a BASH script, it 
reads the argument which in fact is the pointer to the address, and it
returns the value kept in this address. But this is probably not what
you want.

Regards
Peter


Quoting Bill Christiansen < bill.christiansen@xxxxxxxxx>:

> Hi,
> I'm not a very experienced programmer but just giving the Gtk-server,
BASH, 
> Glade combination a try.
>
> The GUI I made in Glade has a calendar widget and I can retrieve it's
widget
> ID and access it's day_clicked event:
>
> # Get calendar widget ID and connect signal
> gtk "gtk_server_glade_widget calendar1" 
> calendar1_ID=$RESULT
> gtk "gtk_server_connect $calendar1_ID day-selected calendar_clicked"
>
> But when I try to use get_date I am getting "-1" returned:
>
> # Initialize EVENT variable 
> EVENT=0
>
> # Mainloop
> while [[ $EVENT != "main_window" && $EVENT != "button_exit" ]]
> do
>    gtk "gtk_server_callback WAIT"
>    EVENT=$RESULT 
>
>    if [[ $EVENT = "calendar_clicked" ]]
>    then
>        gtk "gtk_calendar_get_date $calendar1_ID"
>
>        text="'$RESULT'"
>        echo $text  # this is printing "-1" on console 
>
>    fi
> done
>
> It may be that I need to process the $RESULT more as the GTK docs say it
> returns a tuplet of three integers for year month day, but may BASH
knowlege
> is also limited at this stage, or is it because the calendar widget needs
to 
> be setup in the gtk-server.cfg to be usable. Anyone else have experience
> with this widget?
>
> Regards
> Bill

--
http://www.gtk-server.org 




Other related posts: