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.

DarkBASIC Discussion / tdk file selectorr function problem. doesnt work in windowed mode. cpu jumps to 100%

Author
Message
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 13th Jan 2009 04:30
ok so i'v tried everything and it doesnt work i'v went over the functions a thousand times and it still won't work! ah! when i run it(EXE or in compiler) it jumps the cpu to 100! idk whats going wrong or if its the function or mycomputer
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 14th Jan 2009 13:29 Edited at: 14th Jan 2009 13:33
I'm afraid all programs in DBC cause the CPU to jump to 100%, maxing out one processor. If your using a Dual Core Processor, the CPU meter should register 50% - if it's actually registering 100%, then something is seriously wrong!.

I don't think I actually have TDK's File Selector routine - is it part of his medialess GUI collection? I'll see if I can track down a copy of it and have a look.

[Edit]Downloded it, but pressed for time right now. WIll post back in a few hours.

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 14th Jan 2009 17:06
Ok, I've been experimenting with TDK's Alerts Demo V1.2, with the "GUI.dba" include file - I think that's the one you're referring to, but in any case it doesn't really matter.

TDK's code is fine, the problem lies with the Perform Checklist For Drives command. Called in the function "DriveBoxes(TLX,TLY)", this command always crashes if the program is in Windows mode, whether it is running as an exe or from the editor.

The problem seems to be with removable drives - like floppy discs, CD drives, etc. These drives are fitted to my computer, but if there is nothing in them then (obviuosly) the path to them does not exist - I can't call Set Dir "D:/". However, I can't even check for the drive's existance with Path Exist("D:/").

This is why "Perform checklist for drives" is failing. Something's going wrong behind the scenes, and the only way to correct that would be to make a dll with a custom function - maybe one that returns a string of letters made up of the existing drive letters?

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Jan 2009 21:51
kernel32.dll

GetLogicalDrives

Should do the trick...

Enjoy your day.
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 15th Jan 2009 04:40 Edited at: 15th Jan 2009 04:50
Robert The Robot:
If didn't know it jumped it like that. ya my laptop is kinda old so idk if it has a dual core haha never looked.
ok so your saying if there is a cd in the drive it would work? if so then it should be working cuz theres a cd in it and it still doesn't work

LATCH:

Ok so how would that be implemented? i don't quite understand what robert was saying so i'm not sure


edit:

Ok just saying to robert that when i have windowed mode on i can click on drives and stuff just if i click on the files then it freezes. i have tried going in and printing something when the mouseclick code is ran in the function but even at the vary beginning it doesn't get there. it doesn't print. i don't know if that helps/makes sense
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Jan 2009 14:17
I think also in windowed mode, the position that the mouse is at is not quite the same as in fullscreen mode. This could cause some problems in returning the correct position of files names and buttons within the TDK file select function - though I haven't tested the function directly with this in mind.

Anyway, run the following snippet. Drag the borders to resize the window in different ways. Notice that the text position and the values of the mouse position change. If you were to drag the left border of a regular window towards the right, the content of the screen shifts to the right. If you drag the right border towards the left, usually content on the right gets hidden.

With a DB window, the content shifts not necessarily relative to the upper left corner of the window when the border are dragged. So I am suggesting that there may be some value differences in trying to retrieve the positions from the file select when in windowed mode.

Enjoy your day.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 15th Jan 2009 16:55 Edited at: 15th Jan 2009 16:56
@Caleb1994
When I call the file selector function in windows mode, I get a series of error messages saying "No disc", followed by a string of meaningless numbers. I can click continue to move on, and eventually I get returned to the DB app. Then, when I try and change folders, the program locks. It's as though the errors that the "Perform Checklist for drives" command generates give a bit of a jar to the system, and it doesn't quite recover.

@Latch
I haven't tried your code snippet yet, but if memory serves me right then I think all screen coordinates (including mouse coordinates) in the program are kept relative to the top left corner of the visible bitmap. When you call "Set Window On", all the titlebar and window trimmings appearing around the sides - if you set window mode on and hide the titlebar, it remains possible to make it look fullscreen if you correctly reposition the window.

If you shrink the window, you're application still draws to a (say) 640x480 window, except that you only see a part of the top left corner. Enlarge the window and you'll see a 640x480 bitmap centered in the window "frame", but with a white border. It's this inability to properly resize the window that's made me stick to DB fullscreen for so long!

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 15th Jan 2009 17:36
Latch:

Yes i tested that and i have experienced this problem before trying to make a breakout game in windowed mode sized down to the size of the game and i had to find the coordinates of the edges of the screen :/ hey i just thought of something(off topic) wouldn't using set display mode and setting it to the new size of the screen make that work(very off topic haha)

Robert:

I just tried it without a disk and i get the same error. i always had a cd in before this lol.

That is a good idea for why hmm. well wait that couldn't be it because the program doesn't freeze(and you can click on everything exept the files) until you click on the files so the mouse coordinates are correct the error would not be in the coordinates it would be something with clicking the files(or if you try and type a file in and hit enter it freezes also) it must be something with the files click stuff.

This is the file select code from the function.



I have tried adding a print (as i stated above) to the click part but it doesn't print. like this:



or


Or in the single click code doing the same thing it works in normal window but when you in windowed mode none of them print so it's not even getting to the fileclick part i don't know why. i also tried at the very beginning. at the first if statement and it doesnt print in windowed mode .
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Jan 2009 17:39 Edited at: 15th Jan 2009 17:51
Quote: "If you shrink the window, you're application still draws to a (say) 640x480 window, except that you only see a part of the top left corner."

You're right!
The frame or render area doesn't match up to the top left corner of the window if the window is resized; neither do the mouse coordinates. I guess I was looking for coordinates that are relative to the top left corner like in a regular windows app and when these didn't match, it led me to that supposition. But the coordinate offsets are relative to the bitmap like you said so there shouldn't be any problem with the pointing and clicking; except outside of the window itself!

So Caleb, the window mode and it's coordinates shouldn't affect the point and click area. You can disregard my previous post.

@Caleb1994 [EDIT]
In the file select code:



in between those repeat untils, stick in a SYNC. When waiting for key presses or a mouseclick, most often those tests inside a loop won't register timely without a SYNC.



Enjoy your day.
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Jan 2009 00:15 Edited at: 16th Jan 2009 01:26
i'll try that

btw what version are yall using? i'm using 1.2 cuz his site is down nd thats where all the others were


!!!!!!!!!EDIT!!!!!!!!!!!!

omg latch your amazing! i love you lol it works! i put a sync at the bottum of the directory select and file select part wait i just realized that there lready was a sync it was just after the until command so it didn't do anything! this is sooooo usefull lol i'm exited . i'v been talking about this paint program so i think i'm going to upload it in a minute tell me what youthink when i do the buttons r cheasy btw lol

edit:

here u go

Login to post a reply

Server time is: 2026-07-05 11:31:06
Your offset time is: 2026-07-05 11:31:06