请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:BOOSTXL-K350QVG-S1 #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); ...
我没有找到很多有关列表框的示例、因此这个基本问题。
我在 TM4C 板上使用此显示屏、 并尝试 在第二个屏幕上添加列表框控件。 我 将带有空字符串表的 ListBox 定义为第二个 CanvasStruct. 现在、我得到这个"表达式必须有一个常量值错误"。 我出了什么问题?