Author Topic: Resource Menu System  (Read 26707 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Resource Menu System
« on: September 23, 2010 »
Wonder if you could help with an example of making a menu system with radio buttons and check boxes with a resource.
I'd like to link it with the ogl textured cube routines and jims tinyptc d3d lib.

I'd be really stuck on how to make choice1=option1 or option2, etc.

here's an example I knocked up in notepad:
Code: [Select]
----------------------------------------
   [minimize][exit]
 =======================
 =        =
 = image goes in here  =
 =        =
 =======================
 -----------------------
 option 1 ( )
 option 2 (0)
 -----------------------
 fullscreen [/]
 
 =========  ========
 = start =  = exit =
 =========  ========
----------------------------------------

Cheers and hugest of thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #1 on: September 23, 2010 »
Open your cubes project.
In the Solution Explorer window, right click 'Open GL Vol 1'
Choose Add->Resource.
Pick Dialog and click New.

That will show you a blank dialog window.
From the View menu, select Toolbox.
You can drag all the options, labels, check boxes etc out of the Toolbox menu onto your blank dialog.

That's half the problem, the other half is getting the information in and out of the control.

Is this what you are after?

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #2 on: September 24, 2010 »
Was hoping to do this manually to start out with, and then use an editor. will have a stab in the dark at the dialog thing in the toolbox.
 
And yup, the other half about using the data from the controls.

edit - it won't let me add a resource - perhaps that's in the full version of visual studio.
« Last Edit: September 24, 2010 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #3 on: September 24, 2010 »
How about if you go
Project (menu)->Add New Item->Resource->Resource File
and then muck around from there?

I am also almost certainly not the right guy to help you with how to use the resources.  I'm a nuts-and-bolts win32 programmer and I suspect what I teach you will not help you.

I also do not know how to create these dialogs in code, though I can almost certainly find out.  Hellfire (without dumping him in it :P) knows more than me in this space, but I'll have a look if this is really what you want to do.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #4 on: September 24, 2010 »
I REALLY appreciate all the help dude.
these resource must be apart of the full version of visual studio.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Resource Menu System
« Reply #5 on: September 24, 2010 »
Maybe this piece of code from Gargaj already does most of the stuff you're looking for.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #6 on: September 25, 2010 »
thankyou for that Hellfire. I fiddled with some aspects, it's a bit alien and dont know how to run that into a project and add the .rc file.

this attachment is pretty crappy below, but I put together what I thought more or less near a dialog menu. it looks as if you call it more or less like when updating a window / registering a windows class.

perhaps there's a book that I can ask for Christmas about menu resources?

time for bed it's gone 3 am. o_0
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #7 on: September 25, 2010 »
Dialogs *are* windows.  Text boxes are windows.  Buttons are windows.  Radio buttons are windows... They all have WindowProcs which respond to messages being sent to them telling them to do things, in exactly the same way that the window *you* create for *your* application behaves.

All the dialog components works by sending messages to each others' WindowProcs, even if you just want to get the text from an edit control, under the covers it will send a 'GETTEXT' message which will ask the window which is the textbox to reply with its value.

Jim
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Resource Menu System
« Reply #8 on: September 25, 2010 »
My advice for you, if you like, start from the basics (not compiler ;)), ie:

1 - Learn how to create a empty window.

2 - Add a text on this window, "hello world" text is ok.

3 - Add a button, and see how it works, ie when user click on it, how to process it's message.

For every step above you must understand what each part of the code is doing.
After all those steps done, you're ready to code your dialog/setup window.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #9 on: September 26, 2010 »
thanks for the suggestions. I can register a windows class if that's whats meant by an empty window.
I'll stick with yes or no, will have to try and look for a recent book on the subject; maybe there's a visual studio 2010 express for Dummies book.

thanks for your time all.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Resource Menu System
« Reply #10 on: September 26, 2010 »
I do believe there is some good books about it indeed, but nothing better than tutorials that you can find on the net.

You can start from here:
http://sol.gfxile.net/wintut/ch2.html
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #11 on: September 26, 2010 »
looks as if i need the full version of visual studio 2010, ive got express c++. it says to use a dialog tool to create the menu, and then some sort of pascal for the resource files, which Im not able to add in express, and not sure with those values at the end.

im not after a permanent menu like in word / excel. a startup menu.

thanks for digging up the link.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #12 on: September 27, 2010 »
I've found a very small chapter in one of my Dummies books on it. It still refers to make them with the inbuilt tool.
 
it doesnt mention anything about getting settings that can be used with variables.
 
With VS 2010 C++ Express there's no way of adding .rc files that I can see, which is a shame. Unless other know otherwize?
 
« Last Edit: September 27, 2010 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #13 on: September 27, 2010 »
You're right, no resource editor for C++ in VS Express.
Try using this program instead
http://www.resedit.net/
You need to point it at your Platform SDK include folder though I was able to test it by just ignoring the messages.
Once you've done designing, add the .rc and .h files to your VS project in the normal way.

To get values from dialogs you have to send them messages.  For instance, a checkbox:
Code: [Select]
int checked = (int)SendDlgItemMessage(hwndDialog, ID_CHECKBOX, BM_GETCHECK, 0, 0);
Where hwndDialog is the window handle of the dialog box (you used CreateDialog or DialogBox to open the dialog)
ID_CHECKBOX is the name of the check box in the dialog editor.
BM_GETCHECK is the message you want to send, and the two 0s are parameters for the message (in this case there aren't any).
The value of checked will be one of
BST_CHECKED
BST_UNCHECKED
BST_INDETERMINATE (greyed out)
So you might do
Code: [Select]
switch (checked)
{
  case BST_CHECKED: fullscreen = true; break;
  default: fullscreen = false;
}

There are a lot of possible messages you can send and unfortunately the docs for them are scattered all over the win32 help.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #14 on: September 27, 2010 »
absolutely awesome and thankyou.
will have a play and report back!
 
edit - Something has just dawned on me, as I want to have the menu let the user select options, and then fire up the ptc d3d engine. Am I needing to create 1 window with the dialog on. And then registering another window with the ptc3d3 parts. What I mean is, am I creating two windows classes etc?
« Last Edit: September 28, 2010 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #15 on: September 28, 2010 »
Every dialog box has its own WindowProc, so you can intercept the messages sent to it when you click buttons.  You don't need to register a new class for each one though, you just pass the WindowProc in when you CreateDialog() or DialogBox().

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #16 on: September 28, 2010 »
Still stuck, main 1-2.cpp is the getting ready part of the options.
haven't seen any options at all.
not too sure what extra stuff res Edit might add.
I get redefinition errors, and a long list of lots of symbols loaded.
im hoping to have an options dialog for the tinyptc d3d lib you did Jim.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline efecto

  • C= 64
  • **
  • Posts: 90
  • Karma: 4
    • View Profile
Re: Resource Menu System
« Reply #17 on: September 28, 2010 »
Here's my version of the Gargaj setup dialog.
I changed it a bit and with the help of the tool Jim posted (Thanks Jim for that) I got it working. (on my system).

It's a VS 2008 express solution, so you'll have to convert it probably.

You can see the code behind the RC file by right clicking it and selecting view code.

Any questions/remarks, just let me know, I'll try answering then.

and yes i kwow the combobox looks ugly like this

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Resource Menu System
« Reply #18 on: September 28, 2010 »
FTFY Clyde.
Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Resource Menu System
« Reply #19 on: September 29, 2010 »
Cheers to you both!!

Thanks for pointing me in the right direction Jim, those additions weren't in the book. probably as it was for a permanent menu.

I now have to get those buttons with the structure to behave. You've given me some pointers, so let's see if the brains working today again. ;)

Efecto, I only have one screen resolution option from the menu.
« Last Edit: September 30, 2010 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: