Giter Club home page Giter Club logo

Comments (8)

bohonghuang avatar bohonghuang commented on July 19, 2024 1

This variant also gives the error


(let ((builder (gtk4:make-builder)))
  (builder-add-from-file builder
                         "/home/jacek/Programming/Lisp/lispy-experiments/exmal/builder.ui")
  )

Understood, I will delve deeper into this issue later.

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

You usually don't need to worry about pointer issues in Lisp because gobject-introspection automatically handles object ownership and memory. Your code can be simply translated as:

(let ((builder (gtk:make-builder)))
  (gtk:builder-add-from-file builder "/path/to/ui/file")
  (let ((window (gtk:builder-get-object builder "window")))
    (setf (gtk:window-application window) gtk:*application*)))

from cl-gtk4.

bigos avatar bigos commented on July 19, 2024

Thank you for the explanation. I will try it and let you know if I have any problems.

from cl-gtk4.

bigos avatar bigos commented on July 19, 2024

2 differennt versions of SBCL give me the error:

Unhandled memory fault at #x0.
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]

(builder (gtk4:make-builder :filename "/home/jacek/Programming/Lisp/lispy-experiments/exmal/builder.ui"))

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

2 differennt versions of SBCL give me the error:

Unhandled memory fault at #x0.
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]

(builder (gtk4:make-builder :filename "/home/jacek/Programming/Lisp/lispy-experiments/exmal/builder.ui"))

It seems like a NPE. Did you run the code after the initialization of GTK4?

from cl-gtk4.

bigos avatar bigos commented on July 19, 2024

This variant also gives the error


(let ((builder (gtk4:make-builder)))
  (builder-add-from-file builder
                         "/home/jacek/Programming/Lisp/lispy-experiments/exmal/builder.ui")
  )

from cl-gtk4.

bohonghuang avatar bohonghuang commented on July 19, 2024

I still cannot reproduce your issue. However, I suspect that you are not loading the .ui file while running the GTK application. I have written an example for your reference:

cl-gtk4/examples/gtk4.lisp

Lines 235 to 249 in e391563

(defun ui-file ()
(let ((app (make-application :application-id "org.bohonghuang.gtk4-example.ui-file"
:flags gio:+application-flags-flags-none+)))
(connect app "activate"
(lambda (app)
(let ((builder (gtk:make-builder)))
(gtk:builder-add-from-file builder (namestring (system-absolute-pathname "example-ui-file.ui")))
(let ((window (gobj:coerce (builder-get-object builder "window") 'application-window))
(button (gobj:coerce (builder-get-object builder "button-exit") 'button)))
(setf (window-application window) app)
(connect button "clicked" (lambda (button)
(declare (ignore button))
(window-destroy window)))
(window-present window)))))
(application-run app nil)))

from cl-gtk4.

bigos avatar bigos commented on July 19, 2024

Thank you for the example

from cl-gtk4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.