guile-user
[Top][All Lists]
Advanced

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

guile + gtk, part II


From: Paul Emsley
Subject: guile + gtk, part II
Date: 10 Jan 2003 12:35:17 +0000

        Hi,

        I read the reference manual, and decided that my program was
        sufficiently like the example (dia) that I would follow the
        described method.  I also looked at gtk-guile and guile-gui.

        I used swig to generate the new function names and used a
        gtk-entry (with callback) so that I could type commands.

        I must tell you how totally thrilling it was to type the
        command and for the display DO IT as if I'd gui-ed it.
        Marvellous - I've wanted to be able to do that for a long
        time.

        Now, it seems that I am living in the C world, but gtk-guile
        and guile-gui are in the guile world.  I want to add to my
        program something similar to what guile-gui has - a gtk-entry
        and a gtk-text to capture display the result.  However, I
        can't see how to do this from the C world.

        Incidently, I had problems with void c_inner_main(int argc,
        char** argv) in my c++ program. There was problems relating to
        types and void, I think. I don't have the error code to hand,
        sorry.  I fixed it by having the c++ main calling a c
        c_inner_main routine - it was ugly and i'd rather not do it.
        Is this a known problem?

        It is not clear to me how to add "protection" to the commands
        that I type in the gtk-entry.  Here is how I wrap them (I
        copied this from somewhere):

          SCM handler = scm_c_eval_string ("(lambda (key . args) "
             "(display (list \"Error in proc:\" key \" args: \" args))
(newline))");
          std::string my_typed_function("(lambda() "); 
          my_typed_function += gtk_entry_get_text(GTK_ENTRY(entry));
          my_typed_function += " )";
          SCM scm_code = scm_c_eval_string(my_typed_function.c_str()); 
          scm_catch(SCM_BOOL_T, scm_code, handler);

        Is that right?

        I want to capture the result and display it in the gtk-text.
        How do I do that?

        So that I could try a different approach (from the
        guile-world), I did make an attempt to recompile my program
        and all its libraries and dependences as PIC libs, but not
        finished (since there was a problem loading the so libraries
        in my previous version of guile).  This is still non-trivial
        for me to do - is it The Right Way To Go?

        Also, I want to read in a myprogramrc file.

        If I use:

           scm_c_primitive_load(file); 

        then that falls over (as you know) if there is a syntax error.
        What should I use instead?

        Thanks for your time, I am at the stage where this is still
        twisting my head into little knots.

        Paul.


        





reply via email to

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