NO

Author Topic: Changing Button Ids for Dialog Box designed in Resource Editor.  (Read 3427 times)

EdPellesC99

  • Guest
Changing Button Ids for Dialog Box designed in Resource Editor.
« on: February 06, 2010, 05:22:59 PM »


  Hi,

  I have a c file which opens a dialog box. I designed the dialog box in the Resource editor. (which of course wrote the .rc file) The editor calls one of the two buttons "4001". I would like to change it (to "IDB1").

  Nothing I do seems to enable the project to re-build.

  The only place I can change the name is in the text view of the .rc file.
Of course In my switch statement of my c file I change the name also.

  It seems that the project "knows" the ID should be 4001. As if it is stored somewhere else. It is NOT in the project files, as I could open a new project, import the .c, .h, .rc files and Build and somehow Pelles C IDE knows that the ID is supposed to be 4001, and the project will not build until I revert back to using 4001.

  If I design my DialogBox in the resource editor, of course it gives names to the controls, and "writes" the .rc file. I WANT to utilize the editor, but be able to change the names of the controls.

  Any suggestions?

  Tx, Ed

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Changing Button Ids for Dialog Box designed in Resource Editor.
« Reply #1 on: February 06, 2010, 06:16:19 PM »
You should define IDB1 to 4001 in common header file xx.h that you include in both xx.c and xx.rc-file.

May the source be with you

EdPellesC99

  • Guest
Re: Changing Button Ids for Dialog Box designed in Resource Editor.
« Reply #2 on: February 06, 2010, 10:02:42 PM »
What is the symtax for a Button ID?

Does it have to be a four digit number?

Instead of changing the ID from 4001 to IDB1, I changed it in the .rc file to 4444, and also to 4444 in my switch statement in the c file.

My project then compiled fine.

I should be able to write my dialogbox manually in the .rc file, I want to grow into this. I would like to be able to generate a dialog box with the Resource Editor, and then be able to edit the .rc file and compile without going back to the Resource editor.

You are saying live with the editor generated Id of 4001 by having the define macro substitution

#define IDB1 4001

both in the header area of my .c file and in my resource.h file (Is this what your are saying?).

  I have looked, but not found the required syntax for the button control ID.

  Tx Ed


EdPellesC99

  • Guest
Re: Changing Button Ids for Dialog Box designed in Resource Editor.
« Reply #3 on: February 07, 2010, 12:00:04 AM »

  Well experimenting a bit, I have found it must be an integer, and apparently four digits.
I have two buttons, and Id's of 0001 and 0002 will not compile.

1001 and 1002 will.

  As long as I can assign my own logic, and edit the .rc myself I am happy.

  Tx Timo, and I realize your solution works perfectly.
 
--- Ed