Open williamclocksin opened 1 year ago
First off, cool project - hope it brings you much enjoyment and not too much frustration :-)
Second, in case you don't have it here's the JavaFX CSS reference page.
See Text
, Shape
, and Node
for possible CSS options that you could use.
Third, you are right (as far as I know) JavaFX doesn't have -fx-variable:pagenum
Forth, my suggestion: Would a border or background of some kind around the variable maybe work ? Note: if I remember correctly backgrounds are buggy, so try borders first if feasible. Then once that's working you could try adding/replacing it with a background if you want too.
Thanks for the suggestion. I have time to experiment with the various ways to style variables. What the user will see is for example Page 5, and not Page \<pagenum>, so it is a question of putting the variable in the styling string somehow and then substituting when the area is displayed. I would prefer not to change any code in RichTextFX itself. I just use the fat jar. Yes, this is a fun and challenging project. I moved from Objective-C to Java in 2000 with a job move. I prefer Java, With JavaFX I don't need to do much window management,and don't have to worry about recovering freed memory space. However, event handling is a pain because my Canvas is enclosed in a ScrollView, which (not documented) intercepts the arrow keys, and I anchor the Canvas with other nodes (such as RichTextFX areas), so I had to completely re-design the event handling so the right node gets the right events at the right time. Also, JavaFX does not correctly measure some fonts, so I have a mixture of FX font handling and AWT font handling in the same program.
I have started exploring RichTextFX. I am porting 56,000 lines of Objective-C that I wrote for NextStep in the 1990s to JavaFX, and need an editable styled text box in graphics documents (used for running headers and footers etc). I have multiple InlineCssTextArea in the document, with editor buttons in the GUI of the application. What I need now is to insert 'variables' such as page number, total number of pages, date and time etc into the styled areas. I am happy to do the coding to replace the variable with the appropriate value, but I would like to know a good way to represent variables in the styled area. It would be cool if CSS had something like -fx-variable:pagenum, but I don't think it does. Any suggestions?