Friday, February 23rd 2018, 3:15am UTC+1

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.

bama

Beginner

Date of registration: Apr 15th 2013

Posts: 11

1

Tuesday, August 13th 2013, 3:03pm

one Background icture for differen menu's/windows

Hello,
I have to use the same background picture for differen menus and windows on my screen.
At the moment I have to draw it in the on paint section for each window, dialog,...
My idea is to draw it only one after startup and all new window and dialog has a transparency and will have automtic the background from the main window.
But at the moment every time I draw a new window the background from the main window will be overwritten.
I have tried several different flags but no one helped

Is there a possibility to draw a backgroudn picture that will be shown/used for all new window and dialogs?

regards
markus

Date of registration: May 26th 2009

Posts: 1,022

2

Wednesday, August 14th 2013, 9:23am

Hello Markus,

It should be sufficient to draw the background image in the callback function of the background window.

Best regards,
Adrian

bama

Beginner

Date of registration: Apr 15th 2013

Posts: 11

3

Wednesday, August 14th 2013, 11:04am

Hello Adrian,

I have tried it in the following way:

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
static const GUI_WIDGET_CREATE_INFO _aBatInfoCreate [ ] = {
	{ WINDOW_CreateIndirect, "", ID_WINDOW_0, 0, 0, 320, 240, WM_CF_SHOW | WM_CF_HASTRANS },
	{ TEXT_CreateIndirect, "", ID_TEXT_0, 0, 0, 320, 35, TEXT_CF_HCENTER | TEXT_CF_VCENTER },
	{ TEXT_CreateIndirect, "", ID_TEXT_1, 10, 35, 320, 160, 0, 0, 0 },
};
//==========================================================================
static void _cbBatInfo ( WM_MESSAGE * pMsg )
{
	WM_HWIN hItem;
	int Id, NCode, Sel;
	char HelpString [ 50 ] = "";
	char TempString [ 0xFF ] = "";

	switch ( pMsg->MsgId )
	{
		case WM_NOTIFY_PARENT :
			NCode = pMsg->Data.v;
			Id = WM_GetId ( pMsg->hWinSrc );
			if ( Id == ID_ICONVIEW_0 )
			{
				switch ( NCode )
				{
					case WM_NOTIFICATION_RELEASED :
						Sel = ICONVIEW_GetSel ( pMsg->hWinSrc );
						if ( Sel == 0 )
						{
...
						}
						break;
				}
			}
			break;

		default :
			WM_DefaultProc ( pMsg );
			break;
	}
}
static void _cbBatInfo2 ( WM_MESSAGE * pMsg )
{
	switch ( pMsg->MsgId )
	{
		case WM_PAINT :
			GUI_DrawBitmap ( &bmBackground, 0, 0 );
			break;
		default :
			WM_DefaultProc ( pMsg );
			break;
	}
}
//==========================================================================
void CreateBatInfoWindow ( void )
{
	WM_HWIN hWin, hIconView, hDialog;

	hWin = WM_CreateWindowAsChild ( 0, 0, 320, 240, WM_HBKWIN, WM_CF_SHOW, &_cbBatInfo2, 0 );

	hDialog = GUI_CreateDialogBox ( _aBatInfoCreate, GUI_COUNTOF(_aBatInfoCreate), &_cbBatInfo, hWin, 0, 0 );
.....
}

I run then CreateBatInfoWindow () and then I have the Dialog on the display but without the background picture of the parent window

Do you see any error or wrong used flags in this code? Is there a example that you could provide me?

regards
markus

Date of registration: May 26th 2009

Posts: 1,022

4

Thursday, August 15th 2013, 3:00pm

Hello Markus,

Please create a callback function for the background window and use it to draw the background image.

Best regards,
Adrian