File Requestor in FUllScreen 3d

Blitz3D Forums/Blitz3D Beginners Area/File Requestor in FUllScreen 3d

Doggie(Posted 2007) [#1]
I've searched and searched but can't find a simple file requester that will work in fullscreen 3D.
Anyone got one? I want to load levels.

Thanks

Dog


Abrexxes(Posted 2007) [#2]
http://www.east-power-soft.de/index.php?menu=blitzbasic_bescape

Try escape3D. There is a filerequester. (Download at the bottom of the page)


Doggie(Posted 2007) [#3]
OK. I'll try that. Not sure just what I d/l'ed since I no sprechen sie deutsch but appreciate the feedback.

Dog


Abrexxes(Posted 2007) [#4]
http://translate.google.com/translate?u=http%3A%2F%2Fwww.east-power-soft.de%2Findex.php%3Fmenu%3Dblitzbasic_bescape&langpair=de%7Cen&hl=de&ie=UTF8

;)


Doggie(Posted 2007) [#5]
Thanks for your help but I'm unable to get your program to function. Like so many GUI programs they seem to run just fine by themself but are difficult to implement in your own app since there's always conflicts of types and vars etc etc etc.
I keep getting a "parent entity doesn't exist" or something even though I've copied all the code right where it should be and setup the right dirs. Hard to believe such a simple thing as a file requester isn't a Blitz3D command. Oh well.

thanks


big10p(Posted 2007) [#6]
Like so many GUI programs they seem to run just fine by themself but are difficult to implement in your own app since there's always conflicts of types and vars etc etc etc.
If that's the case, whoever wrote the lib should be shot. :P It's easy to avoid, e.g. in my lib, everything with global scope has a vl_ prefix to virtually guarantee no conflicts occur.


Abrexxes(Posted 2007) [#7]
;.....
Global eg_keyb_repeattime	= 100		;--> Keyboard Repetierzeit (in ms)
Global eg_keyb_timetorepeat	= 350		;--> Zeit bis zum Einsetzen des Repeatiervorgangs (in ms)
Global eg_keyb_timer						;--> Zeitmesser für Keyboard

Global eg_curs_pos						;--> Position Cursor
Global eg_curs_blinkspeed	= 250		;--> Blinkgeschwindigkeit des Cursors (in ms)
Global eg_curs_blinkstate				;--> Status für Cursorblinken
Global eg_curs_timer						;--> Timer für Cursorblinken
;.....and so on


so, no comment.


big10p(Posted 2007) [#8]
I did say 'if that's the case'. Must be some other issue Doggie is having, then. ;)


Ross C(Posted 2007) [#9]
Doggie i used someone's file requester and it seemed to work ok. Sometimes you'd need to call it twice, but apart from that, it was excellent. Uses the file requester built into windows.

; This Procedure is for free MPZ (@) from Berlin
; Version 0.2 1/2004
; 
; in the USERLIBS must be the file kernel32.decls
;.lib "kernel32.dll"
;api_RtlMoveMemory(Destination*,Source,Length) : "RtlMoveMemory"

; in the USERLIBS must be the file comdlg32.decls
;.lib "comdlg32.dll"
;api_GetOpenFileName% (pOpenfilename*) : "GetOpenFileNameA"
;api_GetSaveFileName% (pOpenfilename*) : "GetSaveFileNameA"


;Graphics 800,600;,0,2

Global hWnd=SystemProperty("AppHWND")

; GetOpen/saveFileName consts Flags (useful ones only!)...
Const OFN_CREATEPROMPT         = $2000    ; Prompts the user as to whether they want to create a file that doesnt exist.
Const OFN_FILEMUSTEXIST        = $1000    ; File must exist for it to be returned.
Const OFN_HIDEREADONLY         = 4        ; Hides the read only button in the dialog...
Const OFN_NOCHANGEDIR          = 8        ; Stops the user from changing the initial directory.
Const OFN_NONETWORKBUTTON      = $20000   ; Hides and disables the network button.
Const OFN_NOREADONLYRETURN     = $8000    ; Stops the requester returning readonly files..
Const OFN_NOVALIDATE           = 256      ; If selected, no check will be done for invalid characters.
Const OFN_OVERWRITEPROMPT      = 2        ; Prompt for overwrite file...
Const OFN_PATHMUSTEXIST        = $800     ; Specifies that the path MUST exist for it to be able to be selected.
Const OFN_READONLY             = 1        ; Makes the read only checkbox in the dialog box to be checked immediately.

; getopenfile $(Title_of_Requester$, SearchPath$,Files_with_ending$, Flags); 	
; getsavefile $(Title_of_Requester$, Save_File_name$,Files_with_ending$, Flags); 	
;
; Title_of_Requester$= "Name of the Requester / Name des Dateifragefensters
; SearchPath$ = "C:\" ; Path for File searching / Pfad wo nach der Datei gesuchet werden soll 
; Files_with_ending$ = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
;					 = "Blitzbasic" + Chr$(0) + "*.bb" + Chr$(0) + "Text" + Chr$(0) + "*.txt" + Chr$(0)
; Flags = See Flag lists
; Save_File_name$ = "C:\test.bb" ; Name of the Savefile with Path / Name der Datei mit Pfad zum speichern


;file$ = getopenfile$("File open / Datei öffnen","c:\documents and settings\","*.bmp" + Chr$(0) + "*.bmp" + Chr$(0)); flags optional
;image = LoadImage(file)
;DebugLog file$
;DrawImage image,0,0

;file$ = getopenfile$("File open / Datei öffnen","c:\documents and settings\","*.bmp" + Chr$(0) + "*.bmp" + Chr$(0)); flags optional
;image = LoadImage(file)
;DebugLog file$
;DrawImage image,0,500

;temp$ = getsavefile$("File Save / Datei sichern","c:\hello.bb","Blitzbasic" + Chr$(0) + "*.bb" + Chr$(0) + "Text" + Chr$(0) + "*.txt" + Chr$(0));; flags optional
;DebugLog(temp$)
;While MouseHit(1) <> 1
;Wend

;End

;--------------------------You can use it as BlitzLIB

Function getOpenFile$(lpstrTitle$,lpstrInitialDir$,lpstrFilter$,flags=$1000)

	nextOffset%=0 
	theBank=CreateBank(76)
	lStructSize=76
	PokeInt theBank,nextOffset%,lStructSize
	nextOffset%=nextOffset%+4 

	hwndOwner=hWnd
		
	PokeInt theBank,nextOffset%,hwndOwner
	nextOffset%=nextOffset%+4 
		
	hInstance=0
	PokeInt theBank,nextOffset%,hInstance
	nextOffset%=nextOffset%+4 

	If lpstrFilter$ = "" Then
		lpstrFilter$ = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)+ Chr$(0)
	Else	
		lpstrFilter$ = lpstrFilter$ + Chr$(0)		
	End If
	lpstrFilter_ = CreateBank(Len(lpstrFilter$)) 
	string_in_bank(lpstrFilter$,lpstrFilter_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFilter_)
	nextOffset%=nextOffset%+4
		
	lpstrCustomFilter=0
	PokeInt theBank,nextOffset%,lpstrCustomFilter
	nextOffset%=nextOffset%+4 
	
	nMaxCustFilter=0
	PokeInt theBank,nextOffset%,nMaxCustFilter
	nextOffset%=nextOffset%+4 
	
	nFilterIndex=0
	PokeInt theBank,nextOffset%,nFilterIndex
	nextOffset%=nextOffset%+4 

	lpstrFile$= String$ (" ", 254)
	lpstrFile_ = CreateBank(Len(lpstrFile$)) 
	string_in_bank(lpstrFile$,lpstrFile_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFile_)
	nextOffset%=nextOffset%+4 
	
	nMaxFile=255
	PokeInt theBank,nextOffset%,nMaxFile
	nextOffset%=nextOffset%+4 
	
	lpstrFileTitle$=String$ (" ", 254)
	lpstrFileTitle_ = CreateBank(Len(lpstrFileTitle$)) 
	string_in_bank(lpstrFileTitle$,lpstrFileTitle_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFileTitle_)
	nextOffset%=nextOffset%+4  
	
	nMaxFileTitle=255
	PokeInt theBank,nextOffset%,nMaxFileTitle
	nextOffset%=nextOffset%+4 
	
	If lpstrInitialDir$="" Then
		lpstrInitialDir$="c:\"+Chr$(0)
	Else
		lpstrInitialDir$=lpstrInitialDir$+Chr$(0)
	End If
	lpstrInitialDir_ = CreateBank(Len(lpstrInitialDir$)) 
	string_in_bank(lpstrInitialDir$,lpstrInitialDir_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrInitialDir_)
	nextOffset%=nextOffset%+4 
	
	If lpstrTitle$="" Then
		lpstrTitle$="Open"+Chr$(0) 
	Else
		lpstrTitle$ = lpstrTitle$ + Chr$(0)
	End If	
	lpstrTitle_ = CreateBank(Len(lpstrTitle$)) 
	string_in_bank(lpstrTitle$,lpstrTitle_)	
	PokeInt theBank,nextOffset%,AddressOf(lpstrTitle_)
	nextOffset%=nextOffset%+4 

	PokeInt theBank,nextOffset%,flags
	nextOffset%=nextOffset%+4 
	
	nFileOffset=0
	PokeShort theBank,nextOffset%,nFileOffset
	nextOffset%=nextOffset%+2
	
	nFileExtension=0
	PokeShort theBank,nextOffset%,nFileExtension
	nextOffset%=nextOffset%+2
	
	lpstrDefExt=0
	PokeInt theBank,nextOffset%,lpstrDefExt
	nextOffset%=nextOffset%+4 
	
	lCustData=0
	PokeInt theBank,nextOffset%,lCustData
	nextOffset%=nextOffset%+4 
	
	lpfnHook=0
	PokeInt theBank,nextOffset%,lpfnHook
	nextOffset%=nextOffset%+4 

	lpTemplateName$=""+Chr$(0)
	lpTemplateName_ = CreateBank(Len(lpTemplateName$)) 
	string_in_bank(lpTemplateName$,lpTemplateName_)
	PokeInt theBank,nextOffset%,AddressOf(lpTemplateName_)
	nextOffset%=nextOffset%+4 
	If api_GetOpenFileName (theBank) Then
		lpstrFile$ = bank_in_string$(lpstrFile_)
	Else
		lpstrFile$ =""
	End If
	FreeBank theBank
	FreeBank lpstrFilter_
	FreeBank lpstrFile_
	FreeBank lpstrFileTitle_
	FreeBank lpstrInitialDir_
	FreeBank lpstrTitle_
	FreeBank lpTemplateName_
	Return lpstrFile$
End Function

Function getsaveFile$(lpstrTitle$,lpstrFile$,lpstrFilter$,flags=2) ; Get a SAVEFILENAME

	nextOffset%=0 
	theBank=CreateBank(76)
	lStructSize=76
	PokeInt theBank,nextOffset%,lStructSize
	nextOffset%=nextOffset%+4 
		
	hwndOwner=hWnd
	PokeInt theBank,nextOffset%,hwndOwner
	nextOffset%=nextOffset%+4 
		
	hInstance=0
	PokeInt theBank,nextOffset%,hInstance
	nextOffset%=nextOffset%+4 

	If lpstrFilter$ = "" Then
		lpstrFilter$ = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)+ Chr$(0)
	Else	
		lpstrFilter$ = lpstrFilter$ + Chr$(0)		
	End If
	lpstrFilter_ = CreateBank(Len(lpstrFilter$)) 
	string_in_bank(lpstrFilter$,lpstrFilter_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFilter_)
	nextOffset%=nextOffset%+4
		
	lpstrCustomFilter=0
	PokeInt theBank,nextOffset%,lpstrCustomFilter
	nextOffset%=nextOffset%+4 
	
	nMaxCustFilter=0
	PokeInt theBank,nextOffset%,nMaxCustFilter
	nextOffset%=nextOffset%+4 
	
	nFilterIndex=0
	PokeInt theBank,nextOffset%,nFilterIndex
	nextOffset%=nextOffset%+4 

	lpstrFile_ = CreateBank(255) 
	string_in_bank(lpstrFile$+Chr$(0),lpstrFile_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFile_)
	nextOffset%=nextOffset%+4
	
	nMaxFile=255
	PokeInt theBank,nextOffset%,nMaxFile
	nextOffset%=nextOffset%+4 
	
	lpstrFileTitle$=String$ (" ", 254)
	lpstrFileTitle_ = CreateBank(Len(lpstrFileTitle$)) 
	string_in_bank(lpstrFileTitle$,lpstrFileTitle_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrFileTitle_)
	nextOffset%=nextOffset%+4  
	
	nMaxFileTitle=255
	PokeInt theBank,nextOffset%,nMaxFileTitle
	nextOffset%=nextOffset%+4 
	
	lpstrInitialDir$=""+Chr$(0)
	lpstrInitialDir_ = CreateBank(Len(lpstrInitialDir$)) 
	string_in_bank(lpstrInitialDir$,lpstrInitialDir_)
	PokeInt theBank,nextOffset%,AddressOf(lpstrInitialDir_)
	nextOffset%=nextOffset%+4 
	
	If lpstrTitle$="" Then
		lpstrTitle$="Save"+Chr$(0) 
	Else
		lpstrTitle$ = lpstrTitle$ + Chr$(0)
	End If	
	lpstrTitle_ = CreateBank(Len(lpstrTitle$)) 
	string_in_bank(lpstrTitle$,lpstrTitle_)	
	PokeInt theBank,nextOffset%,AddressOf(lpstrTitle_)
	nextOffset%=nextOffset%+4 

	PokeInt theBank,nextOffset%,flags
	nextOffset%=nextOffset%+4 
	
	nFileOffset=0
	PokeShort theBank,nextOffset%,nFileOffset
	nextOffset%=nextOffset%+2
	
	nFileExtension=0
	PokeShort theBank,nextOffset%,nFileExtension
	nextOffset%=nextOffset%+2
	
	lpstrDefExt=0
	PokeInt theBank,nextOffset%,lpstrDefExt
	nextOffset%=nextOffset%+4 
	
	lCustData=0
	PokeInt theBank,nextOffset%,lCustData
	nextOffset%=nextOffset%+4 
	
	lpfnHook=0
	PokeInt theBank,nextOffset%,lpfnHook
	nextOffset%=nextOffset%+4 

	lpTemplateName$=""+Chr$(0)
	lpTemplateName_ = CreateBank(Len(lpTemplateName$)) 
	string_in_bank(lpTemplateName$,lpTemplateName_)
	PokeInt theBank,nextOffset%,AddressOf(lpTemplateName_)

	If api_GetSaveFileName (theBank) Then
		lpstrFile$ = bank_in_string$(lpstrFile_)
	Else
		lpstrFile$ =""
	End If
	FreeBank theBank
	FreeBank lpstrFilter_
	FreeBank lpstrFile_
	FreeBank lpstrFileTitle_
	FreeBank lpstrInitialDir_
	FreeBank lpstrTitle_
	FreeBank lpTemplateName_
	Return lpstrFile$
End Function

Function AddressOf(Bank) ; Find the correct Adress of a Bank (for C *Pointer)
	Local Address = CreateBank(4) 
	api_RtlMoveMemory(Address,Bank+4,4) 
	Return PeekInt(Address,0) 
End Function

Function string_in_bank(s$,bankhandle) ; Put a String in a Bank
	Local pos=1
	Local pos2=0
	Repeat
		PokeByte(bankhandle,pos2,Asc(Mid(s$,pos,Len(s$))))
		pos=pos+1
		pos2=pos2+1
	Until pos=Len(s$)+1
End Function

Function bank_in_string$(bankhandle) ; Get a String from a Bank
	Local s$=""
	Local pos=0
	Repeat
		s$=s$+Chr(PeekByte(bankhandle,pos))
		pos=pos+1
	Until pos=BankSize(bankhandle)
	s$=Replace$(s$,Chr(0)," ")
	Return s$
End Function


Sorry i can't give credit to anyone, cause i forgot what it was called :o)

I simply call:

file$ = getopenfile$("File open",file_path$,"*.b3d" + Chr$(0) + "*.b3d" + Chr$(0) + "*.3ds" + Chr$(0) + "*.3ds" + Chr$(0)); flags optional


The "File open", is the text that appears at the top of the dialog box.

Only problem is... I can't find the two .decls files anywhere...


big10p(Posted 2007) [#10]
He needs a fullscreen file requestor, Ross. ;)


Doggie(Posted 2007) [#11]
I didn't mean any offense to Abrexxes. I'm sure it's me that's overlooking something. But when I add the code from the example and make sure all the libs are present and that I have all the directories in order I still get errors such as texture does not exist or entity parent does not exist.
Then it pops up the include file with the offending line but since there are at least eight or nine includes that cross reference each other trying to hunt down the error is next to impossible and frankly not worth the effort. Why can't there be a simple fullscreen mode way to load custom levels. The other thing I can do is build in the load command then force the user to name his custom level the names that are coded in but that limits the use of the game.
Thanks for all your help!

Dog


Ross C(Posted 2007) [#12]
Bummer, i'm sure that worked in full screen :D I must be setting the window to the desktop size or summit.


big10p(Posted 2007) [#13]
Oh, maybe it does work in fullscreen, then. I just assumed it wouldn't because it's a windows dialog. I haven't actually tried it. :P


Ross C(Posted 2007) [#14]
I'd go with it probably doesn't. From the man who can't read :D


Abrexxes(Posted 2007) [#15]
I still get errors such as texture does not exist or entity parent does not exist.


Normally that means that Draw3D is not initialized (Origin) ore Escape3D is not startet. But with the new drivers of nVidia and Blitz 1.99 there are some problems at the moment as i use the Createtextur command(see bug section), that is why i can not give support now.

But it is (like other problems) reported as bug, so i think that i can give you support for all this if it is fixed in the next 2 years. (.....)

But you can still use ONLY the simple Escape Version, it is 2D and you can draw this simple after your 3D stuff (Renderworld). All what you must do is call the Filerequester (so..very simple). As Escape3D is compatible to the 3D Version, this maybe help you out the first time and you can replace later. But here another code that i have found here in the forum, but it is also simple 2D.

;File requester
;
;activePath$ = the active path 
;
;selectedFile$ = the selected file
;
;drv$(drive) = the selected drive
;
;-------------------------------------------------------------------------

Graphics 640, 480, 0, 3

SetBuffer BackBuffer()

;cam=CreateCamera ()

;light=CreateLight()

;CameraClsColor cam,40, 40, 55


;------------------------GLOBALS------------------------------------------
Global filter$=".que"	;file filter

Dim drctrs$(0)			;temp directories
Dim realfiles$(0)		;temp files
Dim txtfiles$(0)		;temp filtered files
Dim drv$(0)				;drives

Global selectedFile$	;current selected file $
Global directories		;temp no. of directories
Global drvcnt			;no. of drives
Global check$			;$ to compare with filter$
Global txtcount			;temp no. of files in a directory
Global drd1				;start position of directories to display
Global drd2				;end    -"-      -"-
Global trd1				;start position of files to display
Global trd2				;end    -"-      -"-
Global dscr				;how many more directories then 20
Global tscr				;how many more files then 20
Global drive			;current drive no.
Global mouseInUse		;if mouse in use
Global activePath$	="levels\"	;the active path

;----------------OPEN FILE------------------------------------------------
count_drives

;--------------------loop
While Not  KeyHit(1)
Cls
;RenderWorld

;highlight ^up--------------------------------------------------
If MouseY()>47 And MouseY()<60 And MouseX()>144 And MouseX()<170
Color 64,80,110
Rect 144,47,27,12
 If MouseDown(1)
				ypos=0
				ypos2=0
	actualpos=0
	pos=1
	While (pos>actualpos)And (pos<Len(activePath$))
 		actualpos=pos
		pos=Instr(activePath$,"\",pos+1)
	Wend
	If (actualpos=1) Then actualpos=0
	activePath$ =Left$(activePath$,actualpos)
	
	read_dir(drive,activePath$)
	selectedFile$=""	
  Repeat
  Until (Not MouseDown(1))
 EndIf
EndIf

;----------------------
Color 56,78,112:Rect 0,30,40,270:Rect 0,0,400,29
Line 41,45,400,45:Line 41,60,400,60
Line 384,46,384,300:Line 180,46,180,300:Line 196,46,196,300
Color 50,50,75:Rect 41,30,359,15
Color 50,255,100:Line 40,0,40,300:Line 0,29,400,29

Text 1,2,"Select"
Text 1,13,"Drive"
Text 50,7,"Open file     Back"
Text 50,48,"Directories                    File:"
Text 50,32,"Path: "
Color 255,255,80:Text 80,32,drv$(drive)+":\"+Left$(activePath$, 60)
Text 145,48,"|^Up|":Text 233,48,Left$(selectedFile$,29)
Text 200,7,"Filter: "+filter$

;-----------------------------------------------------

If MouseY()<29
		;----open file --------------------
		If MouseX()>50 And MouseX()<100
		Color 50,170,170:Rect 47,3,51,23,0

;Put here your action when open file is pressed
			If MouseDown(1) Then End

		EndIf
		; back--------------------------
		If MouseX()>113 And MouseX()<145
		Color 50,170,170:Rect 113,3,36,23,0
		
			If MouseDown(1) Then End			
				
		EndIf		
		
	EndIf

;------------------------------------------------

For t=0 To drvcnt-1

Color 50,255,100
Text 16,35+t*20,drv$(t)+":"

	If MouseX()<29 And MouseY()>30+t*20
	
		If MouseY()<30+(drvcnt)*20 And MouseDown(1)
	
		drive=(MouseY()-30)/20
		read_dir(drive,"")
		activePath$=""
		selectedFile$=""
		ypos=0
		ypos2=0
	
	EndIf
;---------------------------------------------	
	If MouseY()>30+(drvcnt)*20 Then Goto skip
	
	Color 50,170,170	
	Rect 1,31+t*20,38,20,0
	
		If t=0 Then Goto skip
		Color 56,78,112
		Rect 1,31+(t-1)*20,38,20,0
.skip
		EndIf
	Next


;--------------------scroller position----------------------------
If directories>19		
	FlushMouse()
	If MouseDown(1)
		If (MouseX()>179 And MouseX()<197 Or (mouseInUse And MouseX()<210 And MouseX()>160)) And MouseY()>61 And MouseY()<299

		ypos = MouseY()-6
		If dscr >0 
		met#=227.0/dscr
		drd1=Floor ((ypos-56)/met#)
		drd2=drd1+19
		EndIf
		mouseInUse =True

		EndIf
	Else
		mouseInUse =False
	EndIf

	Color 255,234,99
	If (ypos<62) Then ypos=62
	If (ypos>284) Then ypos=284
	Rect 182,ypos,13,15		
	
EndIf
	
	;-----------------------------------------------	
If txtcount>19
	FlushMouse()
	If MouseDown(1)	
		If (MouseX()>383 And MouseX()<400 Or (mouseInUse And MouseX()<400 And MouseX()>360)) And MouseY()>61 And MouseY()<292
			ypos2 = MouseY()-6
			If tscr >0 
			met2#=227.0/tscr
			trd1=Floor ((ypos2-56)/met2#)
			trd2=trd1+19
			EndIf
		mouseInUse =True
		EndIf 
	Else
		mouseInUse =False
	EndIf

	Color 255,234,99
	If (ypos2<62) Then ypos2=62
	If (ypos2>284) Then ypos2=284
	Rect 386,ypos2,13,15

EndIf

;---------------------file selector highlight-----------------------------

	If MouseY()>60 And MouseX()>50 And MouseX()<180 And (Not mouseInUse)
	
	Color 64,80,110
	Rect 49,49+((MouseY()-46)/12)*12,130,11
			FlushMouse()
			If MouseDown(1)
			
			dirmet=(drd1+Floor ((MouseY()-46)/12))-1
			
			If dirmet<directories
				activePath$ = activePath$+drctrs$(dirmet)+"\"
				read_dir(drive,activePath$)
				ypos=0
				ypos2=0
				selectedFile$=""
			EndIf 

			Repeat 
			Until Not MouseDown(1)
			
		EndIf
		
	EndIf
;--------------------------------------------------------------------	

If MouseY()>60 And MouseX()>202 And MouseX()<384 And (Not mouseInUse)
	
	Color 64,80,110
	Rect 201,49+((MouseY()-46)/12)*12,182,11


		If MouseDown(1)

		filmet=(trd1+Floor ((MouseY()-46)/12))-1
		If filmet<txtcount
			selectedFile$ = txtfiles$(filmet)
		EndIf

			Repeat 
			Until Not MouseDown(1)
			
		EndIf
	
	EndIf

;----------display Directories and Files-------------
display
	
Flip

Wend



;---------------F U N C T I O N S ----------------------------------------



;---------------READ_DIR--------------------------------------------------

Function read_dir(drive,path$)
directories=0
drf=0
drd1=0
trd1=0

dir=ReadDir (drv$(drive)+":\"+path$)

Repeat

file$=NextFile$(dir)

If file$="" Then Goto readfiles
	drf=drf+1
	If file$<>".." And file$<>"."
	If FileType (drv$(drive)+":\"+path$+file$)=2 Then directories=directories+1
	EndIf
Forever

;--------readfiles---------------------------

.readfiles
Dim drctrs$(directories)
Dim realfiles$(drf-directories)


tempdir=(ReadDir(drv$(drive)+":\"+path$))
tmpcnt=0

For i=0 To drf-1
temp$=NextFile$(tempdir)
 
	If FileType (drv$(drive)+":\"+path$+temp$)=2 
	If temp$<>".." And temp$<>"."
	drctrs$(tmpcnt)=temp$
	tmpcnt=tmpcnt+1
	EndIf
	
	Else realfiles$(i-tmpcnt)=temp$
	EndIf
		
Next

; sort directories
For i=1 To directories-1
If Upper(drctrs$(i))< Upper(drctrs$(i-1))
 temp$ = Upper(drctrs$(i-1))
 drctrs$(i-1) = Upper(drctrs$(i))
 drctrs$(i) =Upper$(temp$)
 For j= i-1 To 1 Step -1
  If drctrs$(j)<drctrs$(j-1)
   temp$ = Upper(drctrs$(j-1))
   drctrs$(j-1) = Upper(drctrs$(j))
   drctrs$(j) =Upper(temp$)
  Else 
   j=1
  EndIf
 Next 
EndIf
Next 

; get only filtered files
tmpcnt=0
For i=0 To drf-directories-1
 check$ = Right(realfiles$(i),4)
 check$=Lower(check$)
 If (check$=filter$)
  tmpcnt=tmpcnt+1
 EndIf	 	
Next
txtcount =tmpcnt

Dim txtfiles$(txtcount+21)
tmpcnt=0
For i=0 To drf-directories-1
 check$ = Right(realfiles$(i),4)
 check$=Lower(check$)
 If (check$=filter$)
  txtfiles$(tmpcnt)=realfiles$(i)
  tmpcnt=tmpcnt+1
 EndIf	 	
Next
 
; sort filtered files
For i=1 To txtcount-1
If Upper(txtfiles$(i)) < Upper(txtfiles$(i-1))
 temp$ = Upper(txtfiles$(i-1))
 txtfiles$(i-1) = Upper(txtfiles$(i))
 txtfiles$(i) =temp$
 For j= i-1 To 1 Step -1
  If txtfiles$(j)<txtfiles$(j-1)
   temp$ = Upper(txtfiles$(j-1))
   txtfiles$(j-1) = Upper(txtfiles$(j))
    txtfiles$(j) = Upper(temp$)
  Else 
   j=1
  EndIf
 Next 
EndIf
Next 

;---if more then 20 directories or files calculate how many more
	If directories<20
		drd2=directories-1
				Else drd2=19:dscr=directories-20
			EndIf

	If txtcount<20
		trd2=txtcount-1
			Else trd2=19:tscr=txtcount-20
		EndIf

End Function

;-------------------DISPLAY-----------------------------------------------
Function display()

Color 70,255,220
For i=drd1 To drd2
Text 50,60+12*(i-drd1), Left$(drctrs$(i),25)
Next

Color 180,180,230
For i=trd1 To trd2
Text 205,60+12*(i-trd1), Left$(txtfiles$(i),35)
Next

End Function

;---------COUNT_DRIVES----------------------------------------------------
Function count_drives()
drvcnt=0

Dim drv$(14)
    
	For i=Asc("C") To Asc("K")
;For i=Asc("c") To Asc("k");put this if the above doesn't work
	fr=ReadDir(Chr$(i)+":\")
	If fr<>0 Then
	drv$(drvcnt)=Chr$(i)
	drvcnt=drvcnt+1
	CloseDir(fr)
	EndIf
	Next

End Function


You can be shure that you will not find a 100% perfekt requester, but with this code you can start to make your own with nice gfx and whatever you need. ;)


cu