chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] easyFFI and GTK


From: Kon Lovett
Subject: Re: [Chicken-users] easyFFI and GTK
Date: Wed, 11 Apr 2007 07:58:55 -0700


On Apr 7, 2007, at 7:11 AM, William Ramsay wrote:

Hi,

I'm trying to create a menu with Gtk. Everything seems to be working fine, but I can't seem to figure out how to use "menu-append".

My code looks like this:

(define create-menu-item
 (lambda (menu text cmd image)
   (let
     ((item #f))
     (if image
       (let
         ((source (sprintf "icons/~A.png" image)))
(set! item (gtk_image_menu_item_new_with_label (sutils-get- text text)))
         (gtk_image_menu_item_set_image item source))
(set! item (gtk_image_menu_item_new_with_label(sutils-get- text text)))) (if (not (= cmd NO_ACTION)) (g_signal_connect window "button_press_event" #$cmd #f))

     (foreign-code "gtk_menu_append(menu, item);")

The problem is the "foreign-code" bit. There isn't any automatic connection between user defined Scheme variables & C variables. Not sure what menu & item are but guessing they would be passed as pointers so:

        ((foreign-lambda void gtk_menu_append pointer pointer) menu item)


     #t)))

-- I'm fairly new to Scheme, so forgive my code if it doesn't meet expectations --

Anyway, when I compile this it tells me "menu" and "item" are not declared. What is the secret for getting this to work?

Thanks in advance. I think Chicken is the greatest and easyFFI is beyond praise. You guys have done a fantastic job in creating the perfect computing system!

Bill Ramsay





_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]