| assets/screenshots | ||
| cmake | ||
| docs | ||
| include/fxCGTUI | ||
| pc | ||
| src | ||
| tests | ||
| .gitignore | ||
| build.sh | ||
| buildall.sh | ||
| cleanall.sh | ||
| CMakeLists.txt | ||
| giteapc.make | ||
| maketargz.sh | ||
| makezip.sh | ||
| README.md | ||
| runprog.sh | ||
fxCGTUI !!
ncurses-like Widget Library for Casio fx-CG50 / fx-CG90
Overview
Once fxCGIO was in place and provided a clean terminal abstraction, the next obvious problem was building structured interfaces. Writing menus, dialogs, and form layouts by hand — calculating pixel positions, handling keyboard focus, redrawing on every keypress — was tedious, error-prone, and produced code that was impossible to maintain.
fxCGTUI is the answer to that problem. It is a widget toolkit modelled after the spirit of ncurses, built directly on top of fxCGIO. It provides a rich set of ready-to-use widgets — windows, labels, menus, inputs, scrollable text areas, rich text, file dialogs, progress bars, combo boxes, and many more — all hooked together by an automatic draw and focus system.
The library is designed to be simple to use yet expressive enough to build complete applications. If you can write ncurses code, fxCGTUI will feel immediately familiar.
fxCGTUI is based on:
- fxCGIO 1.1+ --- https://git-slyvtt.duckdns.org/sylvain/fxcgIO
- gint 2.11+ --- https://gitea.planet-casio.com/Lephenixnoir/gint
- fxSDK --- https://gitea.planet-casio.com/Lephenixnoir/fxsdk
Compatibility and Requirements
| Model | Supported |
|---|---|
| fx-CG50 | ✔ Yes |
| PC (Linux x86) | ✔ Yes — via pc/ CMake build |
| fx-CG10 / 20 | ✔ Yes |
| fx-CG100 | ✔ Yes |
| fx9860G-like | ❌ No |
Minimum fxCGIO version: 1.1 Minimum gint version: 2.11 Build system: fxSDK (calculator) or CMake 3.15+ (PC)
Widget Gallery
So far, the following widgets have been implemented across four development phases. I hope the variety will cover the needs of most calculator application developers.
Phase 1 — Core Widgets
-
Window --- Rectangular region with configurable single / double / heavy border, optional title, and Z-order. All other widgets are children of a window.
-
Label --- Static text with left / centre / right alignment. Supports foreground and background color.
-
Menu --- Scrollable list of selectable items with keyboard navigation. Supports separators, disabled items, and glyphs (star, arrow…) next to entries.
-
Button --- Clickable action widget that fires a callback on [EXE] / [ENTER].
-
Checkbox --- Boolean toggle — checked
[X]/ unchecked[ ]. -
Radio --- Single-choice group: selecting one item deselects all others in the group.
-
Input --- Single-line text entry field with cursor, insert mode, and configurable max length.
-
Textarea --- Multi-line scrollable text area with optional word-wrap, horizontal scrollbar linking, and a
no_draw_textmode for overlay-based syntax highlighting. -
Dialog --- Modal message box. Three variants: OK, OK/Cancel, Yes/No. Supports multi-line messages with
\n.
Phase 2 — Extended Widgets
-
Richtext --- Multi-segment text area where each segment carries its own foreground/background color. Used for syntax-highlighted code display. Supports up to 256 segments per render.
-
Progress --- Horizontal progress bar with percentage display and configurable fill color.
-
Gauge --- Analogue bar gauge for displaying a value within a range.
-
Filedialog --- Full-screen file browser with drive/directory navigation, file selection, and configurable file-type filter.
-
Table --- Scrollable grid of rows and columns with selectable cells.
-
Combo --- Drop-down selector combining a label display with a popup menu.
-
Spinner --- Numeric value widget with UP/DOWN increment/decrement.
-
Tab --- Tab bar allowing multiple pages to be stacked in the same window area.
Phase 3 — Layout and Polish
-
Separator --- Horizontal or vertical visual divider line.
-
Hint --- Single-row status/hint bar, typically placed at the bottom of the screen.
-
Scrollbar --- Standalone vertical or horizontal scrollbar, linkable to a textarea for automatic thumb positioning.
-
Toast --- Transient notification overlay that appears for a configurable duration then fades.
-
Panel --- Container widget for grouping related children within a bordered or borderless sub-region.
Phase 4 — Non-blocking Form Engine
-
fxCGTUI_form_step(form, key)--- processes one key event for all widgets registered to a form, returns focus changes and action events without blocking. Enables custom main loops with per-frame logic between input events. -
fxCGTUI_refresh_begin()--- draws all widgets to the frame buffer without callingdupdate(), allowing the caller to composite additional overlays before the single final LCD push. Eliminates the double-flush blink that occurred with the oldfxCGTUI_refresh()+ overlay pattern. -
fxCGTUI_menu_create_bare()/fxCGTUI_menu_popup_run(menu, x, y, title)--- create a standalone popup menu (not attached to a parent window), run it modally, and auto-destroy the temporary window.
Quick Example
#include <fxCGIO/fxCGIO.h>
#include <fxCGTUI/fxCGTUI.h>
#include <fxCGTUI/window.h>
#include <fxCGTUI/label.h>
#include <fxCGTUI/menu.h>
int main(void)
{
fxCGIO_init();
fxCGTUI_init();
fxCGTUI_window_t *win = fxCGTUI_window_create(5, 3, 30, 12);
fxCGTUI_window_set_border(win, FXCGTUI_BORDER_DOUBLE);
fxCGTUI_window_set_title(win, "Choose wisely");
fxCGTUI_label_create(win, 1, 0, "Pick an option:");
fxCGTUI_menu_t *menu = fxCGTUI_menu_create(win, 2, 2);
fxCGTUI_menu_add_item(menu, "New game");
fxCGTUI_menu_add_item(menu, "Load game");
fxCGTUI_menu_add_separator(menu);
fxCGTUI_menu_add_item(menu, "Quit");
fxCGTUI_refresh();
int choice = fxCGTUI_menu_run(menu);
fxCGTUI_free();
fxCGIO_free();
return 0;
}
Build & Install
Calculator Build and Install
cd fxcgTUI
fxsdk build-cg install
PC Build
# Build fxcgIO-pc first (dependency):
cd fxcgIO/pc && mkdir build && cd build && cmake .. && make
# Then build fxcgTUI-pc:
cd fxcgTUI/pc && mkdir build && cd build
cmake .. && make
# Produces: libfxcgtui-pc.a
TODO List
Short-Term (High Priority)
- Window with single / double / heavy border and title
- Label, Button, Checkbox, Radio
- Menu with separators, disabled items, glyphs
- Input (single-line), Textarea (multi-line, scrollable)
- Dialog (OK / OK-Cancel / Yes-No, multi-line)
- Richtext (multi-segment coloured text, 256 segments)
- Progress, Gauge
- Filedialog (full-screen browser with filter)
- Table, Combo, Spinner, Tab
- Separator, Hint, Scrollbar (V+H), Toast, Panel
- Non-blocking
fxCGTUI_form_step() fxCGTUI_refresh_begin()for flicker-free composite rendering- Popup menu (
fxCGTUI_menu_popup_run) - Treeview widget (hierarchical collapsible list)
- Animated spinner (busy indicator)
- Color picker widget
Long-Term (Possible Future Work)
- Layout manager (auto-flow, grid layout)
- Mouse cursor support (for PC build)
- Drag-and-drop between widgets
- Widget serialisation / UI description file
Version History
Phase 1 — Core Widgets
- Window, Label, Menu, Button, Checkbox, Radio, Input, Textarea, Dialog
- Automatic child-widget registration and Z-order draw
fxCGTUI_refresh()drives the full draw cycle
Phase 2 — Extended Widgets
- Richtext, Progress, Gauge, Filedialog, Table, Combo, Spinner, Tab
- Menu: separators, disabled items, glyph support
- Textarea: optional no-wrap mode
Phase 3 — Layout and Polish
- Separator, Hint, Scrollbar (vertical + horizontal), Toast, Panel
- Textarea ↔ Scrollbar auto-linking
- Dialog rewritten with true multi-line support
- Menu popup API (
fxCGTUI_menu_create_bare+fxCGTUI_menu_popup_run)
Phase 4 — Non-blocking Engine
fxCGTUI_form_step()— non-blocking event dispatchfxCGTUI_refresh_begin()— draw without LCD flush, eliminates blink- Scrollbar orientation API
- Richtext segment limit raised to 256 (was 32)
Documentation
Full documentation is available in the docs/ directory:
Disclaimer
This software is a Work in Progress and is provided "as is", without warranty of any kind. The widget API may change between phases as new requirements emerge from real application development.
Please:
- Pin your projects to a specific fxCGTUI version before starting a long development cycle
- Report bugs with a minimal reproducer — widget interactions can be subtle
- Check that your fxCGIO version matches the required minimum
The author cannot be held responsible for any issues caused by the use of this library.
Credits
Thanks to Lephenixnoir for gint, fxSDK, and for his steadfast support of the entire Casio development community.
Thanks to the Planète Casio community.



