Giter Club home page Giter Club logo

Comments (2)

bohonghuang avatar bohonghuang commented on August 20, 2024

Fixed in bohonghuang/cl-gobject-introspection-wrapper@2d197cb and 2a8a091. You may need to install the cl-gtk4 and cl-gobject-introspection-wrapper manually into local-projects before they get updated in Ultralisp. Here is an example of TextView for your reference:

cl-gtk4/examples/gtk4.lisp

Lines 154 to 185 in ae99571

(define-application (:name text-view-test
:id "org.bohonghuang.gtk4-example.text-view-test")
(define-main-window (window (make-application-window :application *application*))
(setf (window-title window) "TextView Test")
(let ((window-box (make-box :orientation +orientation-vertical+
:spacing 0)))
(let ((body-box (make-box :orientation +orientation-vertical+
:spacing 0)))
(let ((scrolled-window (make-scrolled-window)))
(setf (widget-hexpand-p scrolled-window) t
(widget-vexpand-p scrolled-window) t)
(let ((view (make-text-view)))
(setf (scrolled-window-child scrolled-window) view)
(box-append body-box scrolled-window)
(let ((buffer (text-view-buffer view)))
(setf (text-buffer-text buffer) "Hello world!")
(let ((button (make-button :label "Insert markup")))
(connect button "clicked" (lambda (button)
(declare (ignore button))
(multiple-value-bind (has-selection-p start end) (text-buffer-selection-bounds buffer)
(let ((pos (text-iter-offset start))
(text (if has-selection-p
(prog1 (text-buffer-get-text buffer start end nil)
(text-buffer-delete-selection buffer nil nil))
"Hello World!")))
(text-buffer-insert-markup buffer (text-buffer-get-iter-at-offset buffer pos) (format nil "<span foreground=\"red\" font=\"Serif 20\">~A</span>" text))))))
(box-append body-box button)))))
(setf (widget-size-request body-box) '(400 200))
(box-append window-box body-box))
(setf (window-child window) window-box))
(unless (widget-visible-p window)
(window-present window))))

text-view

from cl-gtk4.

bradrn avatar bradrn commented on August 20, 2024

Thanks!

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.