Hi, I'm using fidget for the GUI of my app, but can't figure a these two out :
1) Scrollable text output
I don't find any examples for getting a scrollable text window/area. Basically, it would be the fidget example padoftext or padofcode, but where one can scroll the contents but not edit it. This is basically for displaying a text file for reading. I tried adding "scrollbars true", but that doesn't do the trick. When using "binding textfileContents" it becomes scrollable with the mouse wheel (no scrollbars) but all formatting is lost (text without newlines).
some of the code :
var textfileContents: string = "" # gets filled with text file contents
proc guiShowText() =
frame "autoLayoutText":
box 130, 0, root.box.w - 130, 491
scrollBars true
fill "#ffffff"
layout lmVertical
counterAxisSizingMode csFixed
horizontalPadding 20h
verticalPadding 20
itemSpacing 10
text "T1":
box 0, 0, 326, 100
fill black
font "Typewriter", 20, 400, 20, hLeft, vTop
characters textfileContents
textAutoResize tsHeight
layoutAlign laStretch
scrollBars true
What needs to be used to get a (vertically) scrollable, not editable text viewer ?
2) Closing the app
The program is for Windows, with the opengl backend. The only way to close it is by clicking the X button upper left. I'd like to have a button to close the app, but can't find what function to call. Fidget checks the bool windowShouldClose, but how do I force that directly from my code ?
Ivan
Sorry, Fidget is still in development and probably does not have the feature you want. Fidget 1 is a dead end, I have plans for a different system with Fidget 2.
Currently Fidget 1 does not support scrollable text output. Fidget 2 would. But Fidget 1 is pretty simple and I am sure you might be able to hack in your own solution. Like removing top lines after you have N lines printed.
For closing the app you can just use quit(). The os will clean up all of the openGL handles. You can also use your own running var to exit the even loop as well.
Thanks for taking the time to answer.
I was aware you've shifted your attention to fidget 2.
I'll hack it further (already did a hack of updateLoop(). I didn't need a repaint each frame, but a frequent repaint nonetheless, so I stuck with RepaintOnEvent and added some code to force a repaint every 500 ms. Best of both worlds.
Looking forward to fidget 2.0