Thursday, April 26th 2018, 7:02pm 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.

14404

Beginner

Date of registration: Feb 18th 2018

Posts: 4

1

Thursday, February 22nd 2018, 5:48pm

Draw a circle in gui window

I make a window in gui builder and put some text and button. I can control them with their ID in main routine but i want draw a circle in window and control it in main for omit or draw. I cannt find a command which get ID of window until can draw circle or any object in it. How can i draw object in gui window with command in main routine for draw and omit? ?(

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 562

2

Monday, February 26th 2018, 9:00am

Hi,

you have to add a 'case WM_PAINT' to the callback function of the dialog. This will allow you to draw into the WINDOW area. Please be aware that you have to take care about the whole window area then. If you set a back ground color for the window with WINDOW_SetBkColor() it has no effect any longer.

Try to add this to your callback function:

C/C++ Source code

1
2
3
4
5
6
7
8
  case WM_PAINT:
	GUI_SetBkColor(GUI_WHITE);
	GUI_Clear();
	GUI_SetColor(GUI_RED);
	GUI_DrawCircle(120, 120, 60);
	GUI_SetColor(GUI_BLUE);
	GUI_DrawLine(20, 20, 130, 130);
	break;


This can be done for any widget/window but will overwrite the default look of a widget. If you want to change the look of a widget you should use the skinning function or set a owner draw function (depends on the widget).

Regards
Sven

14404

Beginner

Date of registration: Feb 18th 2018

Posts: 4

3

Tuesday, February 27th 2018, 3:48pm

Thanks for your answer
I want to change it in main routin but this function draw circle for once when window creat and you cannt change it. Skinnig function only use for widget but i would draw object like circle or rectangle. Can i use multilayer support for it?
Thanks for regard