Sunday, May 20th 2018, 11:57am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

XT-Matz

Beginner

Date of registration: Jul 16th 2015

Posts: 40

1

Friday, June 3rd 2016, 10:59am

Some FRAMEWIN API functions doesnt work with skinning (?)

Hi,

I have an issue concerning skinning in conjunction with widget API methods.

I have multiple FRAMEWIN-dialogs.
I use an own skinning callback routine for all of the FRAMEWINs, means in principle all FRAMEWINs look similar.

But a few properties of the different FRAMEWINs must differ, e.g.:
- Title Bar Height
- Text Font
- Title Bar Color
- Title Text Color

For that I initializes each FRAMEWIN when the particular dialog receives the WM_INIT_DIALOG command:

C/C++ Source code

1
2
3
4
5
6
7
case WM_INIT_DIALOG:
    FRAMEWIN_SetSkin(hDlg, mySkinningCallback); // same for each framewin
    FRAMEWIN_SetTitleHeight(hDlg, <height>);	// same for each framewin
    FRAMEWIN_SetFont(hDlg, &<font>);        	// same for each framewin
    FRAMEWIN_SetTextColor(hDlg, <color>);   	// different for each framewin
    FRAMEWIN_SetBarColor(hDlg, 1, <color>); 	// different for each framewin
    FRAMEWIN_SetBarColor(hDlg, 0, <color>); 	// different for each framewin

I found out, that some of the properties could be changed, some not:

FRAMEWIN_SetTitleHeight - works :)
FRAMEWIN_SetFont - works :)
FRAMEWIN_SetTextColor - works :)
FRAMEWIN_SetBarColor - doesn't work ?(

Is there a special reason why SetBarColor doesn't work but other functions work? I dont understand the difference behaviour.
Are there some more widget API functions that wont work in conjunction with skinning?

Best regards
Matz

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 584

2

Thursday, June 9th 2016, 3:44pm

Hi Matz,

unfortunately this is not possible with skinning and the FRAMEWIN widget. The default skin of the FRAMEWIN has no color bar..

But you can either define your own skin and handle the look or you set the colors used for the gradient which is drawn in the topmost area of the FRAMWIN (see below).

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "DIALOG.h"

/*********************************************************************
*
* 	MainTask
*/
void MainTask(void) {
  FRAMEWIN_SKINFLEX_PROPS PropsActive;
  FRAMEWIN_SKINFLEX_PROPS PropsInactive;

  GUI_Init();
  WM_SetDesktopColor(GUI_BLACK);
  //
  // Create two frame windows
  //
  FRAMEWIN_Create("Framewin0", 0, WM_CF_SHOW, 10, 10, 120, 120);
  FRAMEWIN_Create("Framewin1", 0, WM_CF_SHOW, 140, 10, 120, 120);
  //
  // Receive the default properties for selected and un-selected state
  //
  FRAMEWIN_GetSkinFlexProps(&PropsActive, FRAMEWIN_SKINFLEX_PI_ACTIVE);
  FRAMEWIN_GetSkinFlexProps(&PropsInactive, FRAMEWIN_SKINFLEX_PI_INACTIVE);
  //
  // Overwrite the colors used for drawing a gradient
  //
  PropsActive.aColorTitle[0] = GUI_RED;
  PropsActive.aColorTitle[1] = GUI_DARKRED;
  PropsInactive.aColorTitle[0] = GUI_BLUE;
  PropsInactive.aColorTitle[1] = GUI_DARKBLUE;
  //
  // Write back the properties
  //
  FRAMEWIN_SetSkinFlexProps(&PropsActive, FRAMEWIN_SKINFLEX_PI_ACTIVE);
  FRAMEWIN_SetSkinFlexProps(&PropsInactive, FRAMEWIN_SKINFLEX_PI_INACTIVE);
  while (1) {
	GUI_Delay(100);
  }
}



Regards,
Sven