Comments (2)
For example, some dialog classes and methods seem missing or being mapped to different names compared to official document, like Adw.AlertDialog (the adw:message-dialog seems the identical one), the constructor function of AlertDialog (there isn't a
make-alert-dialog
in my environment...), and present functions likeadw_dialog_present
(But it works well by just usingwindow-present
).
Both AlertDialog
and Dialog
are only available in libadwaita
versions higher than 1.5, but most distributions currently offer versions lower than that.
I can't make it works, the user_data argument cannot automatically convert to correct pointer type, and the application will get stuck while running the callback.
The last 2 parameters should be given as CFFI callback and pointer, like:
(adw:message-dialog-choose dialog nil (cffi:callback foo) (cffi:null-pointer))
It seems this pattern is quite common in libadwaita
, so I will develop a pattern for passing Lisp closures to such functions later on. Actually, similar functionality already exists in my glib
bindings, but I haven't exposed it yet.
Most callbacks in GTK4 are implemented through signals, and AdwMessageDialog
also provides a response
signal. Perhaps at this stage, you could try going forward using signals:
(in-package #:gtk4.example)
(define-application (:name message-dialog-test
:id "org.bohonghuang.gtk4-example.message-dialog-test")
(define-main-window (window (make-application-window :application *application*))
(adw:init)
(setf (window-title window) "Message Dialog Test")
(let ((box (make-box :orientation +orientation-vertical+ :spacing 4)))
(let ((button (make-button :label "Show Message Dialog")))
(connect button "clicked" (lambda (button)
(let ((dialog (adw:make-message-dialog :parent window :heading "Test Message" :body "Test Message Body")))
(adw:message-dialog-add-response dialog "cancel" "Cancel")
(adw:message-dialog-add-response dialog "ok" "OK")
(connect dialog "response" (lambda (dialog respose)
(declare (ignore dialog))
(alexandria:eswitch (respose :test #'string=)
("ok" (setf (widget-sensitive-p button) nil))
("cancel"))))
(window-present dialog))))
(box-append box button))
(setf (window-child window) box))
(unless (widget-visible-p window)
(window-present window))))
My environment is CCL (due to unsolvable floating points error under SBCL), Windows11 with msys.
Just quickload float-features
and:
(float-features:with-float-traps-masked t (run-your-application))
from cl-gtk4.
Thank you, your explanations really save my life :D! Thanks for your effort!
from cl-gtk4.
Related Issues (20)
- Typelib file for namespace 'Gtk', version '4.0' not found HOT 4
- How to make a GListStore of fixnums / How to subclass GObject HOT 2
- Library needs more documentation HOT 1
- Can't create simple application. HOT 4
- FLOATING-POINT-INVALID-OPERATION HOT 5
- arithmetic error DIVISION-BY-ZERO signalled HOT 2
- Cant create wigets to store it in variable HOT 1
- When vertically scaling the window, there is an artifact with the buttons. HOT 1
- No symbol named "POINTER-OBJECT" HOT 2
- Error g_error_free on Windows 11 HOT 6
- Can't properly pass "user_data" to callback for open file dialog HOT 2
- Support for Subclassing? HOT 1
- Radio buttons HOT 1
- Connect widget to key-pressed event HOT 3
- Can I create my own widgets? HOT 2
- (ql:quickload :cl-gtk4) fails, many issues: HOT 3
- Making executable HOT 2
- cl-gtk4 not working under SBCL v2.4.5 HOT 2
- Compilation error when expanding RUN-IN-MAIN-EVENT-LOOP macro HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-gtk4.