Closed jonprairie closed 4 years ago
You are probably using outdated version from main quicklisp dist. Do
(ql-dist:install-dist "http://bodge.borodust.org/dist/org.borodust.bodge.testing.txt")
And try again.
I tried adding the testing dist and running ql:update-all-dists, then loading the system in a clean slime repl and it still blows up. I did a ql:where-is-system on bodge-ui just to make sure and it returned #P"/home/jonnyp/quicklisp/dists/org.borodust.bodge.testing/software/bodge-ui-20200418160241/"
, which looks right to me.
For reference, here's the test code I'm using:
(defpackage #:ctj.testing
(:nicknames :test)
(:use :cl :bodge-ui :bodge-ui-window :bodge-host))
(in-package :test)
(defparameter *game-window* nil)
(defparameter *window-width* 800)
(defparameter *window-height* 600)
(defpanel
(main-panel
(:title "Main Menu")
(:origin 100 100)
(:width 200)
(:height 400)
(:options))
(vertical-layout
(button :label "Continue")
(button :label "New Game")
(button :label "Load Game")
(button :label "Options")
(button :label "Exit" :on-click (lambda (panel) (close-window *game-window*)))))
(defpanel
(new-game
(:title "New Game")
(:origin 400 100)
(:width 200)
(:height 400)
(:options))
(vertical-layout
(float-property
:start 1200
:end 2200
:step 1
:increment 1f0
:value 1500)
(text-edit)))
(defclass main-window (ui-window) ()
(:default-initargs
:title "testing"
:width *window-width*
:height *window-height*
:panels '(main-panel new-game)
:floating t))
(defun run () (open-window (setf *game-window* (make-instance 'main-window))))
Then I inspect *game-window* and drill down through ui-context -> panels -> new-game -> children -> vertical-layout -> children -> text-edit, I bring the text-edit element over to the slime repl and call text-of on it, and that's where it's blowing up for me.
I tried exploring a bit, messing with the text-of method, but I'm hopeless with C and couldn't follow what was happening in the nuklear stuff with the claw wrapper x).
Indeed, I thought I've fixed the problem earlier, but apparently that's the different one. Fixed in https://github.com/borodust/bodge-ui/commit/fba64e80cd8031e9bd443dc7fbada4bb36162189
I also updated drawing example of bodge-ui-window
to demonstrate how to get text from text-edit
.
Fix should be in testing
dist in an hour. Don't forget to
(ql:update-all-dists)
Thanks for the report! Feel free to reopen the issue if problem ain't gone for you after testing
dist update.
If you are wondering what was happening, actual fix is in this line:
https://github.com/borodust/bodge-ui/commit/fba64e80cd8031e9bd443dc7fbada4bb36162189#diff-3c73591d7526e1e6bd0e2d323d305bbdR28
Structure was passed as an argument to %nk:str-len-char
, but this function expects a pointer to the structure instead.
Updated and tested, everything's looking good. Thanks!
I'm trying out bodge-ui-window, I created a text-edit element and tried navigating to it via the slime-inspector: main-window->nuklear-context->panels->children->text-edit. I brought it over to the slime repl and called text-of on it and it drops me into the slime debugger:
I'm not sure what I'm doing wrong, is this expected? Is there a standard way to get the text out of a text-edit element?
Thanks for taking a look!