Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,16 @@ static void WriteConstText(char *toolstr, int *pos, GuiLayout *layout, GuiLayout
case GUI_LISTVIEW:
case GUI_DUMMYREC:
case GUI_STATUSBAR:
case GUI_LINE:
case GUI_PANEL:
case GUI_VALUEBOX:
case GUI_SPINNER:
case GUI_SCROLLPANEL:
case GUI_COLORPICKER:
{
// Skip constant text for elements with no text
if (layout->controls[i].text[0] == '\0') continue;

TextAppend(toolstr, TextFormat("const char *%sText = \"%s\";", layout->controls[i].name, layout->controls[i].text), pos);
if (config.fullComments)
{
Expand Down Expand Up @@ -1079,7 +1088,12 @@ static char *GetControlTextParam(GuiLayoutControl control, bool defineText)
static char text[512];
memset(text, 0, 512);

if (defineText) strcpy(text, TextFormat("%sText", control.name));
if (defineText)
{
// Skip constant text for elements with no text
if (control.text[0] == '\0') strcpy(text, "NULL");
else strcpy(text, TextFormat("%sText", control.name));
}
else
{
// NOTE: control.text will never be NULL
Expand Down