[gtk-server] Re: Calendar Widget

  • From: "Bill Christiansen" <bill.christiansen@xxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Fri, 13 Apr 2007 07:03:27 +1200

Thanks! :-)

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

Hi Bill,

In newLisp you can append additional quotes, as follows:


(gtk_window_set_title win (append {"} tmp {"}))

or

(gtk_window_set_title win (append {'} tmp {'}))

or

(gtk_window_set_title win (append "'" tmp "'"))


Regards
Peter

Quoting Bill Christiansen <bill.christiansen@xxxxxxxxx>:

> Hi Peter,
> I decided to try your tip about newLISP as the other languages I tried
> didn't get me any further than with BASH. (I may have been doing it
wrong)
> Just wondered though if you know of a simple fix for the following
> situation:
>
> (set 'tmp (gtk_entry_get_text entry))
>        (println "This is the contents: " tmp)
>        (gtk_window_set_title win " " tmp)
>
> I read the text from a text entry widget and print it to the console as
well
> as changing the window title  with the same variable which works except
if
> the string in tmp contains any spaces only the first word goes to the
title.
>
> In BASH I could fix that with double and single quotes: "'$tmp'", but
that
> doesn't work in newLISP.
>
> Bill
>
> On 4/8/07, Peter van Eerten <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
>>
>>

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


Other related posts: