Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How can I load Windows Dialog Forms to use it like part of editor?

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 4th Nov 2011 14:58
Please help!

How can I load Windows Dialog Forms to use it like part of editor?
It is going to be complex scenes editor.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th Nov 2011 15:19
Use a great utility called resedit and use that for your dialogs. Attach the .rc file to your project and include the .h file within your project.

From that you can open your dialogs as either modal or non-modal and add a callback function to handle the messaging.



Your callback function is just to catch and handle the messages:



Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 4th Nov 2011 20:13
Sorry but I'm not really good programmer. So can you explain in details?
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 5th Nov 2011 01:32
It would take a lot to explain the use of dialog handling if you're new to it. Even standard windows messages in GDK are handled by the GDK itself, such as mouse movement, keyboard input.

Although I have by now a fair bit of experience with dialog handling myself, it would still be hard to explain everything, let alone in detail. There's tons of controls to learn too but if you do want to have a blast I'd suggest downloading the Win32Api reference from HERE. It took me a while before I linked an up/down with an editbox using the buddy control method for example.

Message boxes are easy enough to implement, dialogs are harder.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Nov 2011 14:53 Edited at: 5th Nov 2011 15:08
Unfortunately neither C++ nor Dark GDK has a built-in GUI system. (If you were thinking about .NET forms, I think those can be used with Dark GDK .NET, but it's a different product.) These are the possibilities I know for making a GUI:

1. Windows API, using ResEdit and Windows functions, as WLGfx already mentioned. I warn you, this is difficult, if you are not already familiar with Windows API programming. But you can try. I too started to make an editor using such GUI system and made a good progress with it, but to learn how to use Windows API as you go along is painstaking and slow. If you want to try, here are some good resources to start with.

WinAPI tutorial:
http://www.winprog.org/tutorial/

Tutorial for combining Dark GDK with Windows GUI elements:
http://forum.thegamecreators.com/?m=forum_view&t=137633&b=22&msg=1599900#m1599900

ResEdit:
http://www.resedit.net/index.html

Combine Dark GDK with an MDI application:
http://forum.thegamecreators.com/?m=forum_view&t=152825&b=22


2. CEGUI. That's a GUI system for DirectX applications, which is not so easy to master either, but worth trying it out. Matty provides some guidance for starting here:

http://forum.thegamecreators.com/?m=forum_view&t=183417&b=22


3. Hawkblood has made a GUI available which I haven't tried but the screenshot looks good and I'm sure it's easy to use:

http://forum.thegamecreators.com/?m=forum_view&t=178271&b=22


If others know of more options, please chime in. For example I'm sure TechLord's project has a GUI system too but I'm not familiar with the current status of the project.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 6th Nov 2011 17:58 Edited at: 6th Nov 2011 21:15
Thanks a lot Mireben!!! This is really useful!
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 7th Nov 2011 00:04
Using the WinApi dialogs, there's two types modal and modeless.

1. A MODAL dialog is called with:
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MYDIALOG), hWnd, (DLGPROC)MYDIALOGFUNCTIONNAME);
This type of dialog when called will hold the execution of your program until the dialog ends, ie closed, cancel or okay button has been pressed. It is the most commen dialog.

2. A MODELESS dialog is called with:
CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MYDIALOG), hWnd, (DLGPROC)MYDIALOGFUNCTIONNAME);
This dialog will allow your program to carry on running, however, you will have to check the dialog by maybe using a flag to say it's running. These dialogs are useful for controlling things in real-time situations.

When editing a resource in ResEdit it will give you 2 files, a ".h" file and a ".rc" file. The ".h" file has to be included in your program somewhere were you are using it. You will notice that from ResEdit it will give lines like this:

#define IDD_MYDIALOG 100

These are used when creating your dialog.

Other defines will have such things as IDC_MYCONTROL. These are used within the messaging system.

In the above I've called my CallBack - MYDIALOGFUNCTIONNAME which is usually setup (this is just a skeleton) like this:



Within the WM_INITDIALOG you will transfer your own values into the controls on the dialog before it gets run. ie. Transferring your coordinates to the dialog. On MODELESS dialogs, it's useful from here to set a flag to let your program know that the dialog is active.

As you will notice within the WM_COMMAND braces the IDOK which is the OKAY button on the dialog. This ends the dialog, closes it down. In here you can transfer your data from the dialog back to your own variables. It is also here where you would reset your flag if using a MODELESS dialog so that your program is aware that the dialog has ended.

The rest is basically up to you, but I do recommend getting the Win32Api reference if you do go any further with working with resources. As well as that, I've found that googling any refernces comes up with a mine of information and tutorial which will help you understand the Win32Api programming.

Good luck...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 9th Nov 2011 05:14
@WLGfx
Does WinAPI work in full screen mode? I wanted to use it (a few years ago), but when I discovered it had no interface in full screen, I abandoned that idea.

The fastest code is the code never written.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 9th Nov 2011 10:37
I've had dialogs and message boxes working in fullscreen no problems yes. I doubt menus will work though although menus can be on dialogs instead.

Mostly I've been using PureGDK (hopefully won't run out yet) so it's fullscreen is different from Dark GDK's and Bark Basic's, but saying that even, when I've used dialogs and message boxes in Dark Basic they've ran fine. You just have to account for the screen size when designing a dialog.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-11-19 06:33:57
Your offset time is: 2024-11-19 06:33:57