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.

Code Snippets / Windows Explorer

Author
Message
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 4th Jan 2003 17:59
Here's a snippet to demonstrate how you can have a Windows Explorer view in your app. You can scroll and browse folders.

It's lifted directly from my FTP client, minus fancy things like XP scrollbars and file icons

DBPro, it should work in 1.13, but not tested.

rem Windows Explorer in DBPro
rem by David89 - Jan 2003
rem Feel free to use but a credit would be nice!
rem -----------------------------------------

rem Dim arrays
Dim PCShown$(28)
Dim PCShown(28)

rem Setup sys
sync on
sync rate 20 : ` deliberately low
set text font "Verdana"

MaxVisible = 20 : `max number of files visible
White = rgb(255,255,255)
FolderColour = RGB(230,115,0)
Blue = rgb(0,0,200)

DownImg = 1
UpImg = 2

rem Generate images
cls blue
ink white,0
line 0,0,5,10
line 5,10,10,0
get image Downimg,0,0,10,10

cls blue
ink white,0
line 0,10,5,0
line 5,0,10,10
get image UpImg,0,0,10,10

cls

rem Main loop
do

cls

goSub ShowPCFiles
goSub CheckPCClicks

rem Mouse clickin
if mouseclick()=0 then down = 0

sync

loop

rem PERFORM CEHCKLIST FOR FILES AND EXTRACT INFORMATION
rem -------------------------------------------------------------------------------

ShowPCFiles:


perform checklist for files
numoffiles = checklist quantity()

rem Get excess number of files (not shown)
If NumOfFiles > MaxVisible then endbit = MaxVisible else endbit = NumOfFiles
if endbit = MaxVisible then Excess = NumOfFiles - MaxVisible

If NumOfFiles = 0 then return

rem Show Scrollbar
UpX = 302
UpY = 6
UpX2 = UpX+13
UpY2 = UpY+14

DOWNX = 302
DOWNY = 365
DOWNX2 = DOWNX+13
DOWNY2 = DOWNY+14

paste image Upimg,302,6
paste image Downimg,302,365

rem Scroll through list
If MouseOverArea(downx,downy,downx2,downy2)=1 and mouseclick()=1 then inc PCOffset
If MouseOverArea(upx,upy,upx2,upy2)=1 and mouseclick()=1 then dec PCOffset

If PCOffset > Excess then PCoffset = Excess
If PCOffset = -1 then PCOffset = 0

rem Set text display settings
set text size 12
set text to normal
ink white,0


rem Set starting height
y = 10
i = 0

rem Get files from HD and show
for f = 1+PCOffset to Endbit+PCOffset

inc i

name$ = checklist string$(f)
filetype = checklist value a(f)

rem Get file type
if filetype = 1 then ink Foldercolour,0 else ink white,0

rem Add the "visible" index
PCShown$(i) = name$
PCShown(i) = filetype

rem Show file
text 25,y,name$

inc y,13

next f

return

rem ACCESS INFO STORED IN ARRAY BY SUB ABOVE AND CHECK IF WE ARE CLICKING ON ENTRY
rem -------------------------------------------------------------------------------

CheckPCClicks:

rem Set starting height
y = 10
i = 0

if NumOfFiles > MaxVisible then Endbit = MaxVisible else Endbit = NumOfFiles

rem Get files from HD and show
for f = 1 to Endbit

inc i

name$ = PCShown$(i)
filetype = PCShown(i)

rem Define mouseover area
x = 10
y = y
x2 = 300
y2 = y+12

rem Get file type
if filetype = 1 then ink Foldercolour,0 else ink white,0

Over = MouseOverArea(x,y,x2,y2)

If Over = 1 then LineBox(x,y,x2,y2)
If Over = 1 and MouseClick()=1 and down = 0 and FileType = 1 then set dir get dir$()+"/"+name$ : pcoffset = 0 : down=1
If Over = 1 then selectedPC$ = name$

inc y,13

next f


return

Function MouseOverArea(x1,y1,x2,y2)
if mousex() > x1 and mousey() > y1 and mousex()
http://www.aozf28.dsl.pipex.com/rgt_xmas_banner.gif[/img]
Merry Christmas to all Apollo members!
Visit [url]www.lightning-systems.co.uk[/url] :: [url]www.realgametools.net/forums[/url]
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 4th Jan 2003 17:59
Code tag didn't work!




Merry Christmas to all Apollo members!
Visit [url]www.lightning-systems.co.uk[/url] :: [url]www.realgametools.net/forums[/url]
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 4th Jan 2003 18:00
And what do you know? I make a spelling mistake.


Merry Christmas to all Apollo members!
Visit [url]www.lightning-systems.co.uk[/url] :: [url]www.realgametools.net/forums[/url]
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Jan 2003 19:47
I'll have to try that later

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
No Sanity!
21
Years of Service
User Offline
Joined: 10th Dec 2002
Location: United Kingdom
Posted: 7th Jan 2003 21:26
That is really good. Give it a nice user interface thats fast and responsive and it'll be amazing, try combining it with Magic Windows (also in the code snipits section of the forum). The only problem i can see is that it doesnt appear to have any logical order for listing the files although ihavn't looked at the code properly yet. By the way it runs fine on db 1.13.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 12th Jan 2003 15:32
That's DBP's order for files and so I can't help that

It's a shame there are no SORT FILES BY NAME() commands, as that will be really useful.

Visit [url]www.lightning-systems.co.uk[/url] :: [url]www.realgametools.net/forums[/url]
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 16th Jan 2003 07:12
heres a load save DLL combo that saves tonnes of time

You need to search for DBCOMMDLG.DLL
if its in your windows directory then these will work.


sync on
sync rate 0
rem load the DLL required
LOAD DLL "DBCOMMDLG.DLL", 1
print "DLL loaded"
sync



`LOAD DIALOG
`Syntax: Return Value=Call Dll(DLL#,"loaddialog",file_extensions$,default_extension$,window_title$,startup_path$)
`What it does: Runs that familiar
`"Open" window and returns the full filename of the selected file.
`For the file extensions string, use this format:
`"Images|*.bmp;*.jpg|All Files|*.*" etc. And for the default extension,
`I'd leave it blank, or you could use "bmp" or whatever.
rem ----------------------------------------------------------------------------------
`sync
`myfile$=Call Dll(1,"loaddialog",DTT,DTT,"Load a file oh:",startup_path$)
`print myfile$
`sync
`suspend for key
`end





`SAVE DIALOG
`Syntax: Return Value=Call Dll(DLL#,"savedialog",file_extensions$,default_extension$,window_title$,startup_path$)
`What it does: Basically the same as the Load dialog.
`If you choose a file that already exists,
`it brings up that "File already exists.
`Are you sure you want to save over?" message.
`For the file extensions string, use this format:
`"Images|*.bmp;*.jpg|All Files|*.*" etc. And for the default extension,
`I'd leave it blank, or you could use "bmp" or whatever.
rem --------------------------------------------------------------------------
`sync
`myfile$=Call Dll(1,"savedialog",DTT,DTT,"save the file as::",startup_path$)
`print myfile$
`sync
`suspend for key
`end

kenmo got me started on some groovy DLLS

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Jan 2003 17:21
Wow, great code!!

xxxpetratxxx
B. R. W
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 16th Jan 2003 18:23
except i found out that it only works in wondowed mode otherwise there behind the app!.

David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 18th Jan 2003 16:38
Indi - I already have that DLL (and use it frequently) but it does not do what I want for an FTP client. It's only an open / save dialog

Visit [url]www.lightning-systems.co.uk[/url] :: [url]www.realgametools.net/forums[/url]
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Jan 2003 03:58
not my problem now is it.

I added it as an alternative to the name of the post.
next time ill skip it.

David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 19th Jan 2003 14:40
I thought you were just giving me an alternative way to view files, as the previous post was:

"That's DBP's order for files and so I can't help that

It's a shame there are no SORT FILES BY NAME() commands, as that will be really useful."

And I thought you were trying to help me. Obviously I was wrong.

Visit [url]www.lightning-systems.co.uk[/url]
You are the th person ot view this signiture.
ShockFire
21
Years of Service
User Offline
Joined: 18th Jan 2003
Location: United Kingdom
Posted: 22nd Jan 2003 22:44
could anyone tell me where i could find DBCOMMDLG.DLL please?

i did a search on google but couldnt find anything.

thanx
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Jan 2003 01:47
If DB and DBPro were done in C++ then they could include the usort or qsort commands to sort files

xxxpetratxxx
B. R. W
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 23rd Jan 2003 04:59
sort files by name would be great.

soz peace

regujka
21
Years of Service
User Offline
Joined: 23rd Jan 2003
Location:
Posted: 23rd Jan 2003 20:54
Please send me the examples for the shaders and the vectors! My adress: regulyistvan@hotmail.com

David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 29th Jan 2003 19:01
www.realgametools.net/forums/attachments/dbcommdlg.zip

Is what you're looking for

Visit [url]www.lightning-systems.co.uk[/url]
You are the th person to view this signature.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jan 2003 03:37
theres two commands

minimize window and maximize window that can be used in conjunction with this DLL and therefore it should be ok for exclusive mode also

Login to post a reply

Server time is: 2024-11-24 07:58:11
Your offset time is: 2024-11-24 07:58:11