2016-09-14 06:02 AM
Hi,
I am using stemwin on my stm32f7-discovery board. When using an Edit widget, text selection is rendered in all black so that you are not able to read the text when it is selected. The same thing happens to the insert cursor when changing from insert to replace mode. I expected it to reverse the colors when rendering the selected text or cursor. Is there any configuration setting I am missing to get the desired behavior?I am using :GCC,ST_Addons.h v1.1.1,emWin V5.28,STM32F746G-DISCOThanks in advance,2016-09-15 07:01 AM
Hi,
I think EDIT_SetTextColor() and EDIT_SetBkColor()
functions
could be used for setting the text and cursor color.
For detailed information about the
Edit widget
function, you can refer to this
https://www.segger.com/emwin-widgets.html
,it maybe helpful for you and the emWin manual (19.8 EDIT: Edit widget)
Regards
2016-09-15 08:51 AM
2016-10-04 11:03 AM
I found a solution and/or workaround for this. The issue appears to be inside the lcd driver. I am using GUIDRV_LIN_32. It appears that it doesn't correctly implement LCD_DEVFUNC_FILLRECT whenever (GUI_GetDrawMode() == GUI_DM_XOR).
To work around the issue, I implemented my own XOR Fill Rect in LCDConf.c/*************** ORIGINAL CODE *************************/static void LCD_LL_FillRect(int LayerIndex, int x0, int y0, int x1, int y1, U32 PixelIndex) { U32 BufferSize, AddrDst; int xSize, ySize; if (GUI_GetDrawMode() == GUI_DM_XOR) { LCD_SetDevFunc(LayerIndex, LCD_DEVFUNC_FILLRECT, NULL); LCD_FillRect(x0, y0, x1, y1); LCD_SetDevFunc(LayerIndex, LCD_DEVFUNC_FILLRECT, (void(*)(void))LCD_LL_FillRect); } else { xSize = x1 - x0 + 1; ySize = y1 - y0 + 1; BufferSize = GetBufferSize(LayerIndex); AddrDst = layer_prop[LayerIndex].address + BufferSize * layer_prop[LayerIndex].buffer_index + (y0 * layer_prop[LayerIndex].xSize + x0) * layer_prop[LayerIndex].BytesPerPixel; DMA2D_FillBuffer(LayerIndex, (void *)AddrDst, xSize, ySize, layer_prop[LayerIndex].xSize - xSize, PixelIndex); }}/*************** WORK AROUND *************************/static void draw_rect_xor(int x0, int y0, int x1, int y1){ int temp; if (x1 < x0) { temp = x0; x0 = x1; x1 = temp; } if (y1 < y0) { temp = y0; y0 = y1; y1 = temp; } for (int y=y0; y <= y1; y++) for(int x=x0; x<= x1; x++) { unsigned int new_color = LCD_GetPixelIndex(x, y); new_color = (new_color ^ 0x00FFFFFF); LCD_SetPixelIndex(x, y, new_color); }}static void LCD_LL_FillRect(int LayerIndex, int x0, int y0, int x1, int y1, U32 PixelIndex) { U32 BufferSize, AddrDst; int xSize, ySize; if (GUI_GetDrawMode() == GUI_DM_XOR) { draw_rect_xor(x0,y0,x1,y1); } else { xSize = x1 - x0 + 1; ySize = y1 - y0 + 1; BufferSize = GetBufferSize(LayerIndex); AddrDst = layer_prop[LayerIndex].address + BufferSize * layer_prop[LayerIndex].buffer_index + (y0 * layer_prop[LayerIndex].xSize + x0) * layer_prop[LayerIndex].BytesPerPixel; DMA2D_FillBuffer(LayerIndex, (void *)AddrDst, xSize, ySize, layer_prop[LayerIndex].xSize - xSize, PixelIndex); }}