Saturday, December 16th 2017, 4:33am 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.

Manfred

Beginner

Date of registration: Apr 26th 2017

Posts: 8

1

Wednesday, April 26th 2017, 4:46pm

show child windows and hide the parent window

Hello,

I have created a window as parent which has multiple child windows. My intention is to hide the parent window and show one of it's child window at once. But
when I hide the parent the entire child windows are hidden, even if I try to show one of the child window. How can I solve this problem? Or does anybody know how can I supress the pointer Input device of a window in general? I mean it shouldn't receive any Input devices after creation anymore.

Thanks for your help. :)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 443

2

Thursday, April 27th 2017, 10:47am

Hi Manfred,

You can try to detach the child window from its parent by using WM_DetachWindow(). To attach it again use WM_AttachWindow().

EDIT:
To suppress touch inout you can try to overwrite the callback of a window, react on WM_TOUCH and simply do nothing. Or use WM_SetCapture() and make sure just one specific window receivs touch inout.

Regards
Sven

Manfred

Beginner

Date of registration: Apr 26th 2017

Posts: 8

3

Friday, April 28th 2017, 10:45am

Hey Schoenen,

thanks for your report. To overwrite the callback could be a good idea. But what exactly happens when I detach a child window? How is the new parent? I red that detached Windows will not be redrawn. So I guess when I detach a child window from it's hidden parent for Intention to show it will not be redrawn and as a result it will not be visible. Is it right?

Regards Manfred

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 443

4

Monday, May 8th 2017, 9:57am

Hello Manfred,

A detached window gets deleted from a list of present windows and therefore won't get redrawn.

But you hide the parent, detach the child and attach it immediately to another window (e.g. WM_HBKWIN). This will hide the parent and the child stays visible.

Like this:

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "DIALOG.h"

/*********************************************************************
*
*   	Defines
*
**********************************************************************
*/
#define COLOR_BLUE   	GUI_MAKE_COLOR(0x00623700)
#define COLOR_LIGHTGRAY  GUI_MAKE_COLOR(0x00F2F2F2)
#define COLOR_LEMON  	GUI_MAKE_COLOR(0x0014B6A9)

/*********************************************************************
*
*   	Typedefs
*
**********************************************************************
*/
/*********************************************************************
*
*   	Static data
*
**********************************************************************
*/
/*********************************************************************
*
*   	Static code
*
**********************************************************************
*/
/*********************************************************************
*
*   	_cbWin0
*/
static void _cbWin0(WM_MESSAGE * pMsg) {
  switch (pMsg->MsgId) {
  case WM_PAINT:
	GUI_SetBkColor(COLOR_LIGHTGRAY);
	GUI_Clear();
	break;
  default:
	WM_DefaultProc(pMsg);
	break;
  }
}


/*********************************************************************
*
*   	_cbWin01
*/
static void _cbWin1(WM_MESSAGE * pMsg) {
  switch (pMsg->MsgId) {
  case WM_PAINT:
	GUI_SetBkColor(COLOR_LEMON);
	GUI_Clear();
	break;
  default:
	WM_DefaultProc(pMsg);
	break;
  }
}

/*********************************************************************
*
*   	Public code
*
**********************************************************************
*/

/*********************************************************************
*
*   	MainTask
*/
void MainTask(void) {
  WM_HWIN hWin0, hWin1;
  int 	xSize;
  int 	ySize;

  GUI_Init();
  WM_SetDesktopColor(COLOR_BLUE);
  WM_MULTIBUF_Enable(1);
  xSize = LCD_GetXSize();
  ySize = LCD_GetYSize();
  hWin0 = WM_CreateWindowAsChild(10, 10, 140, 80, WM_HBKWIN, WM_CF_SHOW, _cbWin1, 0);
  hWin1 = WM_CreateWindowAsChild(10, 10, 120, 60, hWin0, WM_CF_SHOW, _cbWin0, 0);
  GUI_Delay(1500);
  WM_HideWindow(hWin0);
  WM_DetachWindow(hWin1);
  WM_AttachWindowAt(hWin1, WM_HBKWIN, 20, 20);
  while (1) {
	GUI_Delay(50);
  }
}

/*************************** End of file ****************************/


Regards,
Sven