Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions src/elem/XKeyPad.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ gslc_tsElemRef* gslc_XKeyPadCreateBase(gslc_tsGui* pGui, int16_t nElemId, int16_
rElem.w = (nButtonSzW * pConfig->nMaxCols) + (2 * pConfig->nFrameMargin);
rElem.h = (nButtonSzH * pConfig->nMaxRows) + (2 * pConfig->nFrameMargin);

// Things tend to drop off on very small screens
// Move it as far left/up as it goes. And ignore
// the issue if it is still too large.
//
if (rElem.x + rElem.w > pGui->nDispW)
rElem.x = pGui->nDispW - rElem.w;
if (rElem.y + rElem.h > pGui->nDispH)
rElem.y = pGui->nDispH - rElem.h;

gslc_tsElem sElem;
gslc_tsElemRef* pElemRef = NULL;

Expand Down Expand Up @@ -349,8 +358,8 @@ gslc_tsElemRef* gslc_XKeyPadCreateBase(gslc_tsGui* pGui, int16_t nElemId, int16_

// Determine offset coordinate of compound element so that we can
// specify relative positioning during the sub-element Create() operations.
int16_t nOffsetX = nX0 + pConfig->nFrameMargin;
int16_t nOffsetY = nY0 + pConfig->nFrameMargin;
int16_t nOffsetX = rElem.x + pConfig->nFrameMargin;
int16_t nOffsetY = rElem.y + pConfig->nFrameMargin;

// Reset buffer and associated state
gslc_ElemXKeyPadReset(pXData);
Expand Down
11 changes: 3 additions & 8 deletions src/elem/XListbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ extern const char GSLC_PMEM ERRSTR_PXD_NULL[];

// ----------------------------------------------------------------------------

// TODO: Combine with GUIslice MAX_STR
// Defines the maximum length of a listbox item
#define XLISTBOX_MAX_STR 20

// ============================================================================
// Extended Element: Listbox
// - A Listbox control
Expand Down Expand Up @@ -620,8 +616,7 @@ bool gslc_ElemXListboxDraw(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw
// Determine top-left coordinate of list matrix
nItemBaseX = nX0 + pListbox->nMarginW;
nItemBaseY = nY0 + pListbox->nMarginH;
char acStr[XLISTBOX_MAX_STR+1] = "";

char * acStr = (char *)"";

// Loop through the items in the list
int16_t nItemTop = pListbox->nItemTop;
Expand All @@ -645,8 +640,8 @@ bool gslc_ElemXListboxDraw(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw
}

// Fetch the list item
bool bOk = gslc_ElemXListboxGetItem(pGui, pElemRef, nItemInd, acStr, XLISTBOX_MAX_STR);
if (!bOk) {
acStr = gslc_ElemXListboxGetItemAddr(pListbox, nItemInd);
if (NULL == acStr) {
// TODO: Erorr handling
break;
}
Expand Down