#ifndef SCREEN_H_ #define SCREEN_H_ #include <stdint.h> #include <stdbool.h> #include "grlib/grlib.h" #include "grlib/widget.h" #include "grlib/canvas.h" #include "grlib/pushbutton.h" #include "grlib/slider.h" #include "grlib/listbox.h" #include "images.h" // default variable names extern tCanvasWidget g_psPanels[]; extern tWidget *infoPage; extern tWidget *logPage; extern uint32_t g_ui32Panel; extern char *g_pcPanei32Names[]; extern tPushButtonWidget g_sPrevious, g_sNext; extern tCanvasWidget g_sTitle, g_sDashboard, g_sCAN; extern tListBoxWidget g_sMenu; ...
#include <stdio.h> #include <stdint.h> #include <math.h> #include <string.h> #include <Screen.h> #include "driverlib/sysctl.h" #include "drivers/Kentec320x240x16_ssd2119_spi.h" #include "drivers/touch.h" #include "images.h" #include "grlib/grlib.h" #include "grlib/widget.h" #include "grlib/canvas.h" #include "grlib/pushbutton.h" #include "grlib/slider.h" #include "grlib/listbox.h" char* error = "test"; char** ppcText = &error; // Forward declaration of functions void OnDashboardPaint(tWidget *psWidget, tContext *psContext); void OnErrorLogPaint(tWidget *psWidget, tContext *psContext); void OnCanPaint(tWidget *psWidget, tContext *psContext); // The panel that is currently being displayed. uint32_t g_ui32Panel; // An array of canvas widgets, one per panel. Each canvas is filled with // black, overwriting the contents of the previous panel. tCanvasWidget g_psPanels[] = { CanvasStruct(0, 0, &g_sDashboard, &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0), CanvasStruct(0, 0, &g_sMenu, &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0), }; // The list of panels being displayed on screen Canvas(g_sDashboard, g_psPanels, 0, 0, &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240, CANVAS_STYLE_APP_DRAWN, 0, 0, 0, 0, 0, 0, OnDashboardPaint); //************************************************************************ //"../Screen.c", line 66: error #28: expression must have a constant value //************************************************************************ ListBox(g_sMenu, g_psPanels + 1, 0, 0, &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240, LISTBOX_STYLE_WRAP|LISTBOX_STYLE_LOCKED, 0, 0, 0, 0, 0, 0, ppcText, 8, 0, OnErrorLogPaint); Canvas(g_sCAN, g_psPanels + 2, 0, 0, &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240, CANVAS_STYLE_APP_DRAWN, 0, 0, 0, 0, 0, 0, OnCanPaint); ...
I didn't find many examples about Listbox, thus this basic question.
I am using this display on a TM4C board, and I am trying to add a Listbox Widget on the second screen. I defined a ListBox with an empty string table as the child of the second CanvasStruct. Now I get this "expression must have a constant value error". What did I do wrong?