From 6e6077a351b2aebd0d7921441960adea247ea643 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Thu, 16 Oct 2025 23:28:24 +0000 Subject: [PATCH] color wheel: have the color display show the color hex git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@385 b9cfdab3-6d41-4d17-bbe4-086880011989 --- examples/color_picker.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/color_picker.c b/examples/color_picker.c index a9c99a3..0140aea 100644 --- a/examples/color_picker.c +++ b/examples/color_picker.c @@ -61,6 +61,7 @@ typedef struct { MwWidget value_slider; MwWidget alpha_slider; MwWidget color_display; + MwWidget color_display_text; MwLLPixmap color_wheel_pixmap; MwLLPixmap color_display_pixmap; double value; @@ -128,6 +129,8 @@ static void color_wheel_click(MwWidget handle, void* user, void* call) { char* hexColor = malloc(8); snprintf(hexColor, 8, "#%02X%02X%02X", r, g, b); MwSetText(wheel->color_display, MwNbackground, hexColor); + MwSetText(wheel->color_display_text, MwNbackground, hexColor); + MwSetText(wheel->color_display_text, MwNtext, hexColor); free(hexColor); } static void color_wheel_on_change_value(MwWidget handle, void* user, void* call) { @@ -172,6 +175,8 @@ void color_wheel_setup(MwWidget parent, color_wheel* wheel) { MwSetInteger(wheel->color_display, MwnhasBorder, 1); MwSetInteger(wheel->color_display, MwNinverted, 1); + wheel->color_display_text = MwCreateWidget(MwLabelClass, "colorDisplayFrameText", wheel->color_display, MwDefaultBorderWidth, MwDefaultBorderWidth, PICKER_SIZE - MwDefaultBorderWidth, (PICKER_SIZE / 16) - (MwDefaultBorderWidth * 2)); + wheel->value_slider = MwVaCreateWidget(MwScrollBarClass, "value-slider", wheel->parent, // x IMG_POS +