[gtk-server] Re: Calendar Widget

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Sun, 08 Apr 2007 10:34:34 +0200

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: