Monday, January 22nd 2018, 11:10am 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.

Nairolf

Beginner

Date of registration: Jan 3rd 2018

Posts: 5

1

Wednesday, January 3rd 2018, 1:30pm

Button problem

Hello,

For a project I have, I want to add product at the end of a specification process and I need access to process after they're created. An idea of mine is to add button linked to product every time I create a new one.
My problem is that I just can't get rid of it. I've tried to create button via every avaible method (BUTTON_Create, BUTTON_CreateEx, BUTTON_CreateIndirect...) but every time, either I supposedly have a button with a "callback" function but I'm not able to display it or I display correctly the button but his "callback" is the default one that I can't exploit.
So I need just a little help because I'm a bit lost in all those code lines. ;(

Thanks by advance,

Nairolf

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 468

2

Wednesday, January 3rd 2018, 2:25pm

Hi,

Unfortunately, I'm not entirely sure what you mean by 'to add product at the end of a specification process'.

Do mean a window which represents a specific 'product' and you want to switch between the different windows on a click on the buttons?

Regards
Sven

Nairolf

Beginner

Date of registration: Jan 3rd 2018

Posts: 5

3

Wednesday, January 3rd 2018, 4:19pm

Hi Schoenen,

I've said product but it more like a production program. A menu allows to create new production program and I want to create in live the button used to select the correct program when the system is in production.
And a program is just a serie of values that the main program have to know before starting the production.

regards
nairolf

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 468

4

Thursday, January 4th 2018, 2:15pm

Hi,

So you want to create some buttons in a menu and want to react on button press?

Attached is simple application which has 'menu' (which is nothing more than a window with some buttons). When pressing a button a TEXT widget displays which button has been pressed.

Regards
Sven
SEGGER - Schoenen has attached the following file:

Nairolf

Beginner

Date of registration: Jan 3rd 2018

Posts: 5

5

Thursday, January 4th 2018, 2:27pm

Hi,

Not exactly. I want a menu with button linked to a program.
And I want to dynamicaly add button to this menu if a new program is
created (on react of the validate button of program creator menu).
I already know how to react on button touch but, as I was saying, I'm not able to create a button with the behavior I want.

regards,

nairolf

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 468

6

Thursday, January 4th 2018, 2:42pm

Hi,

So, you got a menu(1) with a button for each program. If you add a program from another(?) menu the first menu(1) should get an additional button?

Regards
Sven

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 468

7

Thursday, January 4th 2018, 3:00pm

Hi,

maybe like this (see attachment).

Regards
Sven
SEGGER - Schoenen has attached the following file:

Nairolf

Beginner

Date of registration: Jan 3rd 2018

Posts: 5

8

Thursday, January 4th 2018, 4:22pm

Hi,

That's what I want to do but how can I catch input on the newly created buttons ? Which callback are they attached to ?

regards,

Nairolf

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 468

9

Thursday, January 4th 2018, 4:58pm

Hi,

I have modified my last example (attached). The buttons are created as child windows of the window with the callback _cbMenu(). Simply add a case WM_NOTIFY_PARENT to _cbMenu() and check which child sends the message. On button press the text in the background window gets changed.

Regards
Sven
SEGGER - Schoenen has attached the following file:

Nairolf

Beginner

Date of registration: Jan 3rd 2018

Posts: 5

10

Monday, January 8th 2018, 3:29pm

Hi,

Thanks a lot ! I have not tested it so far because I'm busy on something else but it look like it is what I search for !

regards,

Nairolf

Similar threads