Closed ITwrx closed 3 years ago
@#%^ i see now that the gintro readme (!) has an example of how to pass variables as parameters to callbacks. Looking at that now. I hope my bug report is valid.
nim c -r EZMP.nim --gc:orc
Sometimes I really hate the "r" or "c -r" options of the Nim compiler. The may be OK for general use, but in case of bugs it is helpful to know exactly if it is a compiletime or runtime issue.
And please try --gc:refc and --gc:arc also.
it's a compile time error.
This is invalid code:
home_chooser_btn.connect("clicked", home_chooser_btnCb(home_box, home_chooser_btn))
I am not sure what you intend, but you pass a proc call as last argument, while last argument should be justb the proc/callback name, e.g. like
home_chooser_btn.connect("clicked", home_chooser_btnCb) # or with optional ref object parameter
home_chooser_btn.connect("clicked", home_chooser_btnCb, myRefObjOrwidgetOrIntAndSuch)
right, i understand that now, but i still didn't know if it was exposing a gintro bug anyways. i'll close now. sorry for all the noise. Thanks again.
Maybe this was intented:
import gintro/[gtk4, gdk4, glib, gio, gobject]
var home_box = newBox(gtk4.Orientation.horizontal)
var home_chooser_btn = newButtonFromIconName("folder-open")
proc home_chooser_btnCb(home_chooser_btn: Button; home_box: Box) =
#home_box.remove(home_chooser_btn)
#let notify_label = newLabel("home chooser box and button are gone!")
#home_box.append(notify_label)
echo "home chooser clicked"
#error triggered by next line
home_chooser_btn.connect("clicked", home_chooser_btnCb, home_box)
if it was exposing a gintro bug anyways.
We can always try to improve the connect macro to catch invalid calls better. But in real life it is not a real issue, as when you have learned Nim and gintro for a few weeks, you just generally do it right.
Rewriting all the gintro macros is indeed on the to do list, I was hoping all the years that maybe someone of the Nim experts would do it, instead sitting the whole day in from of the Nim IRC. But now Araq and a few other Nim devs seems to favour the fidget GUI toolkit, so I have not much hope. When we will have at least 100 really active gintro users I will do it myself, or hire someone to do it.
Rewriting all the gintro macros is indeed on the to do list, I was hoping all the years that maybe someone of the Nim experts would do it, instead sitting the whole day in from of the Nim IRC.
lol
But now Araq and a few other Nim devs seems to favour the fidget GUI toolkit, so I have not much hope.
Yeah, don't get me started on this whole topic. :)
I very well may be doing something dumb. I'm just trying to figure out how to modify my gui when a button is pressed, but through my crapulence maybe i've stumbled upon a gintro bug?
results in:
thanks