Hi,
I'm configuring a "standard" screen which according a variable I want to configure with one or two SWIPELIST.
If only there is a Swipelist, I want it will be from pixel 1 to pixel 318, and if there are 2 swipelist, I want the first is from pixel 1 to pixel 158, and the second from pixel 161 to pixel 318.
Display All
And, then I want to select one option or other, I pass a variable or other into , as you can see:
Display All
where:
Display All
So, according to "type" value, I will create one or two Swipelist.
Into cbDialog, I call:
Display All
Where:
Untill here, it seems without errors. But:
1) When I want 1 only swipelist, I see this:
[img]https://i.imgsafe.org/e3f85d0e6f.jpg[/img]
How I can hide, disable, or delete the others swipelists?
2) Why, the TextColor is white if I configure it as 0x000000 (black)?
Thanks
I'm configuring a "standard" screen which according a variable I want to configure with one or two SWIPELIST.
If only there is a Swipelist, I want it will be from pixel 1 to pixel 318, and if there are 2 swipelist, I want the first is from pixel 1 to pixel 158, and the second from pixel 161 to pixel 318.
C Source Code
- For this reason, I define a DialogCreate with 3 types of swipelist, as you can see:
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { WINDOW_CreateIndirect, "Basica", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, 0 },
- { IMAGE_CreateIndirect, "Msup", ID_IMAGE_0, 0, 0, 320, 23, 0, 0, 0 },
- { TEXT_CreateIndirect, "Data", ID_TEXT_0, 226, 4, 50, 15, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "Hora", ID_TEXT_1, 285, 4, 30, 15, 0, 0x0, 0 },
- { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_0, 1, 204, 318, 36, 0, ( 36 << 16) | 53, 0 },
- { SWIPELIST_CreateIndirect, "", ID_SWIPELIST_0, 1, 89, 318, 115, 0, 0x0 , 0},
- { SWIPELIST_CreateIndirect, "", ID_SWIPELIST_1, 1, 89, 158, 115, 0, 0x0 , 0},
- { SWIPELIST_CreateIndirect, "", ID_SWIPELIST_2, 1, 89, 158, 115, 0, 0x0 , 0}, // ->> it will be x=161.
- // USER START (Optionally insert additional widgets)
- // USER END
- };
And, then I want to select one option or other, I pass a variable or other into , as you can see:
C Source Code
where:
C Source Code
- const STRUCTMENU aMSetup =
- {
- 2, // type
- 5, // Qty SWP1
- 2, // Qty SWP2
- _aSetup1,
- _aSetup2,
- };
- const STRUCTMENU aMComunicacions =
- {
- 1, // type
- 5, // Qty SWP1
- 0, // Qty SWP2
- _aComunicacions,
- NULL_,
- };
- const char *_aSetup1[] = {
- "Setup11", //0
- "Setup12", //1
- "Setup13", //2
- "Setup14", //3
- "Setup15", //4
- };
- const char *_aSetup2[] = {
- "Setup21", //5
- "Setup22", //6
- " ",
- " ",
- " ",
- };
- const char *_aComunicacions[] = {
- "Com 1",
- "Com 2",
- "Ethernet",
- "Rs485",
- "USB",
- };
So, according to "type" value, I will create one or two Swipelist.
Into cbDialog, I call:
C Source Code
- static void _cbDialog(WM_MESSAGE * pMsg) {
- const void * pData;
- WM_HWIN hItem;
- U32 FileSize;
- int NCode;
- int Id;
- uint8_t i, j;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Msup'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
- pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
- IMAGE_SetDTA(hItem, pData, FileSize);
- //
- // Initialization of 'Data'
- //
- hTxtData = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
- TEXT_SetFont(hTxtData, &GUI_FontHelveticaLTStd14_9punts_aa2_normal);
- TEXT_SetText(hTxtData, "23.03.17");
- TEXT_SetTextColor(hTxtData, GUI_MAKE_COLOR(BLAU_MARI));
- //
- // Initialization of 'Hora'
- //
- hTxtHora = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
- TEXT_SetFont(hTxtHora, &GUI_FontHelveticaLTStd14_9punts_aa2_normal);
- TEXT_SetText(hTxtHora, "16:57");
- TEXT_SetTextColor(hTxtHora, GUI_MAKE_COLOR(BLAU_MARI));
- // USER START (Optionally insert additional code for further widget initialization)
- if (StrMenu->type == 1)
- { // un sol SWP
- WM_InvalidateWindow (hSwp1);
- WM_InvalidateWindow (hSwp2);
- hSwp0 = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
- /* lletra */
- SWIPELIST_SetFont(hSwp0,SWIPELIST_FI_ITEM_TEXT,&GUI_FontHelveticaLTStd14_9punts_aa2_normal);
- SWIPELIST_SetTextColor(hSwp0,SWIPELIST_CI_ITEM_TEXT_UNSEL, 0x00000000);
- SWIPELIST_SetTextColor(hSwp0,SWIPELIST_CI_ITEM_TEXT_SEL, 0x00000000);
- SWIPELIST_SetTextColor(hSwp0,SWIPELIST_CI_SEP_ITEM_TEXT, 0x00000000);
- /* background */
- SWIPELIST_SetBkColor(hSwp0,SWIPELIST_CI_BK_ITEM_UNSEL, GRIS_CLAR);
- SWIPELIST_SetBkColor(hSwp0,SWIPELIST_CI_BK_ITEM_SEL, BLAU_CIAN);
- SWIPELIST_SetBkColor(hSwp0,SWIPELIST_CI_BK_SEP_ITEM, BLANC);
- for (i = 0; i < StrMenu->menu1; i++)
- {
- SWIPELIST_AddItem(hSwp0, StrMenu->MenuPtr1[i], (PIXELS_Y_ITEMP + PIXELS_SEP)); // 21 + 1 del separador
- /* alineació text */
- SWIPELIST_SetTextColor(hSwp0,SWIPELIST_CI_ITEM_TEXT_SEL,BLANC);
- SWIPELIST_SetTextAlign(hSwp0,i, GUI_TA_HCENTER);
- /* separador */
- SWIPELIST_SetSepSize(hSwp0, i , PIXELS_SEP);
- SWIPELIST_SetSepColor(hSwp0,i, BLANC);
- }
- if(i < MAX_ITEMS)
- {
- for (j = i; j < MAX_ITEMS; j++)
- {
- SWIPELIST_AddItem(hSwp0, " ", (PIXELS_Y_ITEMP + PIXELS_SEP));
- /* alineació text */
- SWIPELIST_SetTextAlign(hSwp0,j, GUI_TA_HCENTER);
- /* separador */
- SWIPELIST_SetSepSize(hSwp0, j, PIXELS_SEP);
- SWIPELIST_SetSepColor(hSwp0,j, BLANC);
- }
- }
- }
- else if (StrMenu->type == 2)
- {
- WM_HideWindow (hSwp0);
- /* SWP ESQUERRA */
- hSwp1 = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_1);
- /* lletra */
- SWIPELIST_SetFont(hSwp1,SWIPELIST_FI_ITEM_TEXT,&GUI_FontHelveticaLTStd14_9punts_aa2_normal);
- SWIPELIST_SetTextColor(hSwp1,SWIPELIST_CI_ITEM_TEXT_UNSEL, 0x00000000);
- SWIPELIST_SetTextColor(hSwp1,SWIPELIST_CI_ITEM_TEXT_SEL, 0x00FF0000);
- SWIPELIST_SetTextColor(hSwp1,SWIPELIST_CI_SEP_ITEM_TEXT, 0x00FF0000); //vermell
- /* background */
- SWIPELIST_SetBkColor(hSwp1,SWIPELIST_CI_BK_ITEM_UNSEL, GRIS_CLAR);
- SWIPELIST_SetBkColor(hSwp1,SWIPELIST_CI_BK_ITEM_SEL, BLAU_CIAN);
- SWIPELIST_SetBkColor(hSwp1,SWIPELIST_CI_BK_SEP_ITEM, BLANC);
- SWIPELIST_SetTextColor(hSwp1,SWIPELIST_CI_ITEM_TEXT_SEL,BLANC);
- for (i = 0; i < StrMenu->menu1; i++)
- {
- SWIPELIST_AddItem(hSwp1, StrMenu->MenuPtr1[i], (PIXELS_Y_ITEMP + PIXELS_SEP)); // 21 + 1 del separador
- /* alineació text */
- SWIPELIST_SetTextAlign(hSwp1,i, GUI_TA_HCENTER);
- /* separador */
- SWIPELIST_SetSepSize(hSwp1, i , PIXELS_SEP);
- SWIPELIST_SetSepColor(hSwp1,i, BLANC);
- }
- /* SWP DRET */
- hSwp2 = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_2);
- /* lletra */
- SWIPELIST_SetFont(hSwp2,SWIPELIST_FI_ITEM_TEXT,&GUI_FontHelveticaLTStd14_9punts_aa2_normal);
- SWIPELIST_SetTextColor(hSwp2,SWIPELIST_CI_ITEM_TEXT_UNSEL, GRIS_FOSC);
- SWIPELIST_SetTextColor(hSwp2,SWIPELIST_CI_ITEM_TEXT_SEL, BLANC);
- SWIPELIST_SetTextColor(hSwp2,SWIPELIST_CI_SEP_ITEM_TEXT, BLANC);
- /* background */
- SWIPELIST_SetBkColor(hSwp2,SWIPELIST_CI_BK_ITEM_UNSEL, GRIS_CLAR);
- SWIPELIST_SetBkColor(hSwp2,SWIPELIST_CI_BK_ITEM_SEL, BLAU_CIAN);
- SWIPELIST_SetBkColor(hSwp2,SWIPELIST_CI_BK_SEP_ITEM, BLANC);
- for (i = 0; i < StrMenu->menu2; i++)
- {
- SWIPELIST_AddItem(hSwp2, StrMenu->MenuPtr2[i], (PIXELS_Y_ITEMP + PIXELS_SEP));
- /* alineació text */
- SWIPELIST_SetTextAlign(hSwp2,i, GUI_TA_HCENTER);
- /* separador */
- SWIPELIST_SetSepSize(hSwp2, i , PIXELS_SEP);
- SWIPELIST_SetSepColor(hSwp2,i, BLANC);
- }
- if(i < 5)
- {
- for (j = i; j < 5; j++)
- {
- SWIPELIST_AddItem(hSwp2, " ", 22);
- /* alineació text */
- SWIPELIST_SetTextAlign(hSwp2,j, GUI_TA_HCENTER);
- /* separador */
- SWIPELIST_SetSepSize(hSwp2, j , 1);
- SWIPELIST_SetSepColor(hSwp2,j, BLANC);
- }
- }
- }
- // USER START (Optionally insert additional code for further widget initialization)
- hIcones = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_0);
- ICONVIEW_SetSpace(hIcones, GUI_COORD_X, 0);
- ICONVIEW_SetFrame(hIcones, GUI_COORD_X, 0);
- ICONVIEW_SetFrame(hIcones, GUI_COORD_Y, 0);
- ICONVIEW_SetIconAlign(hIcones, ICONVIEW_IA_TOP);
- for (i = 0; i < GUI_COUNTOF(_aBitmapItem); i++)
- {
- ICONVIEW_AddBitmapItem(hIcones, _aBitmapItem[i].pBitmap, _aBitmapItem[i].pText);
- }
- [....]
Where:
Untill here, it seems without errors. But:
1) When I want 1 only swipelist, I see this:
[img]https://i.imgsafe.org/e3f85d0e6f.jpg[/img]
How I can hide, disable, or delete the others swipelists?
2) Why, the TextColor is white if I configure it as 0x000000 (black)?
Thanks