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.

Newcomers DBPro Corner / BlueGui Problem

Author
Message
Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 25th Jun 2007 04:06 Edited at: 28th Jun 2007 06:23
I'm not entirely sure that this is the correct board, because I'm new to the DarkBasic side of these forums, but I'm having a little dilemma at the moment.

I'm trying to make a menu using BlueGui 2, which I just bought. Right now I'm just doing a basic test. I made the menu using the Rainbow Editor, so I don't think the menu could be screwed up. Here's what I have.



What I'm trying to achieve here is when the user clicks "New", it opens a pop-up message which says "Hello World", and "Exit" ends the program. Every time I try to compile, the DarkBasic editor gives me an error message saying "Constant declaration for 'MENU_FILE' duplicated.". I have included the gui.dba before I compile. Can anybody help me out?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Jun 2007 04:18
Make sure if you have the gui.dba included in your project you don't also have a line like #include "filenamehere.dba".

I had this problem before and you are essentially causing the file to be included twice - and hence the constant is declared twice - and throwing you this error.

Also note - you may simply have that constant declared in two or places in your program if the first tip doesn't help.

Do a search for "MENU_FILE" and if you find more than one #CONSTANT MENU_FILE in your project (check all included files) then one of gots to go!

Good Luck
Jason

Know way to many languages - Master of none
Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 25th Jun 2007 05:41
Hey, thanks Jason. I got it working now.

Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 25th Jun 2007 06:36
Arg...one problem to the next I guess. Just tested it out, and the buttons don't do anything, even though I specified what they did.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Jun 2007 06:57
Glad I got you through the first issue (I got help for that same issue in here also)..just passing on the help... but...

Unfortunately I don't know Blue GUI - never tried it etc.

Jason

Know way to many languages - Master of none
Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 27th Jun 2007 19:54
Got the buttons working!

But now I have another problem. When I create the status bar and the tool bar, neither of them show up.

Example:



And nothing shows up. The main menu shows up totally fine. The functions I've already programmed in work fine too! I'm not saying the above snippet is my entire code. And yes, I used startBlue.

vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 27th Jun 2007 20:48
I might be wrong but I don't think you are allowed to post your user key and ID in the code. And also you don't need to globally declare Statusbar, it can just be:

Statusbar=createStatusBar
Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 28th Jun 2007 06:35
Woah, I'm sorry, I can't believe I did that. I could have sworn I got rid of it. Woah. I apologize. Edited it out. Sorry again.

What would the benefit of declaring Statusbar globally? Because the Rainbow Editor sure does favor doing it. I usually just use the editor to see what I want, and then I program it without using any exported code. But any way I do it, it's not working. Your way doesn't work either, vorconan.

vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 28th Jun 2007 22:04
Quote: "Woah, I'm sorry, I can't believe I did that. I could have sworn I got rid of it. Woah. I apologize. Edited it out. Sorry again. "


It's ok, no problem

Quote: "What would the benefit of declaring Statusbar globally?"


It's just so you can edit it globally. If you just put it like I did, you wouldn't be able to assign a different value to the variable unless you did so inside the function itself.

Quote: "
But any way I do it, it's not working. Your way doesn't work either, vorconan."


Ok, I've created some code manually because I personally don't get along with the rainbow editor. I find it much easier to follow when it's done manually because there is a lot less variable declaration. It also doesn't need the gui.dba file, here's the code for you anyway, everything works.

Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 29th Jun 2007 09:11
Yeah, I code the GUI manually too.

I tried the code you posted, and everything shows up fine, except that the menu functions didn't work. I'll try screwing around with it tomorrow.

Another BlueGui problem. I don't understand what I'm doing wrong. If anybody could find some sort of error in my code, then please tell me, because this is driving me nuts.

When I compile the following code, nothing shows up unless I resize the window, in which the buttons flash in and out randomly. Can somebody please test this out and tell me if it does the same for them?



Also, what is the best way to keep the user from resizing the window?

Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 3rd Jul 2007 02:56
Anyone?

Alquerian
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 3rd Jul 2007 19:00
The reason why your buttons are flashing is probably because of your window mode. If you change it to 'windowed' mode, the flashing should go away. If you are running fullscreen, change it to windowed etc. This may also fix your menu problem.

Visit the Wip!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Jul 2007 01:53
Laos - a thought - maybe a bad one but - I program for a lot of different languages - and what you described sounds like the "paintwindow" event that windows generally "react" to when a user sizes the window. This event is used to initially draw the window contents - and is called when the window is resized. The good thing in your case is that you can explicity call it.

Basically - you take the window "handle" (kind of a pointeR) and pass it to the window messaging via a call to SendMessage(blah blah). There is a constant for Paintwindow. When Darkbasic is doing its house keeping - it will see this "request" or "Message" and will react the same way it does when the user indirectly generates one via mouse moves, , alt-tab, resizing etc.

This might not be ideal - I realize that - but if "resizing" more or less fixes it - it may be a workaround for ya to investigate.

Look for the Win32 API - and if you have prob's I can get you a help file likely to help you.

Jason

Know way too many languages - Master of none
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 4th Jul 2007 11:46 Edited at: 4th Jul 2007 11:46
Quote: "I tried the code you posted, and everything shows up fine, except that the menu functions didn't work. I'll try screwing around with it tomorrow."


Try replacing eventdata() with eventsource(), worth a shot.

EDIT - I wasn't using the gui.dba file, so you don't need to include it, if you already did that is.

Login to post a reply

Server time is: 2024-11-25 15:32:31
Your offset time is: 2024-11-25 15:32:31