PDA

View Full Version : thinbasic explorer



sandyrepope
18-11-2007, 03:04
I would like to post my script and get some opinions about it. I'd just like to know what other people think about it.

The script does some of the things that windows explorer does. It doesn't have very many features right now because I haven't been able to think of anything else to have in the script.

All comments will be appreciated.

Thanks
Sandy

Michael Hartlef
18-11-2007, 12:41
Hi Sandy,

very nice script and with a good layout. Here are some ideas you could use to enhance it.

1) Have file details (size, date) displayed next to the file
2) Have a context menu showing up once a fiel is selected and you press right mouse button

I have more but for some you might need to use the windows API to actually get it to work.

Anyway good work.

Michael

Petr Schreiber
18-11-2007, 15:14
Thanks Sandy,

really nice!
Just one suggestion - I am used from "Servant Salamander" file manager that except root, there is "..." as first item in list of directories, and when you click it you go up one level in directory structure ( same functionality as UP button now ).


Thanks,
Petr

sandyrepope
18-11-2007, 20:47
1) Have file details (size, date) displayed next to the file
2) Have a context menu showing up once a fiel is selected and you press right mouse button

I have more but for some you might need to use the windows API to actually get it to work.

I like the idea about a context menu. I'll try this in an update version.
I also like the file details. I'll see if it is something I can do.


I have more but for some you might need to use the windows API to actually get it to work.

I would love to hear some of the ideas whether they require windows api or not.


Just one suggestion - I am used from "Servant Salamander" file manager that except root, there is "..." as first item in list of directories, and when you click it you go up one level in directory structure ( same functionality as UP button now ).

I like the idea of using "..." and I think it shouldn't be very hard to add. I'll try to have it in the next update.
The servant salamander sounds interesting. I'll go there and check it out.

Thanks for the ideas. It is appreciated.
Sandy

ErosOlmi
18-11-2007, 23:05
Sandy,

great, great script.
After I will finish with UDT and thinBasic Core engine, I will work much more on UI (User Interface) module to give more power and new functionalities.

For the moment, a big thanks.
Eros

PS: I perfectly remember your first questions (just few months ago) about programming and now you have done a so good tool with a nice to read and follow source code. Well done!

Michael Clease
19-11-2007, 00:14
Nice Job sandy. I guess folders report their data with a different function because they dont work in this example.

Pass it 1 of the 3 equates and it fills 2 arrays, how you handle the data after that is up to you.
NOTE....DisplayDirectory() must be called first.

I've added a quick example.



DIM FileDates() AS STRING
DIM FolderDates() AS STRING
' %DATE_TIME_FILE_CREATION
' %DATE_TIME_LAST_FILE_ACCESS
' %DATE_TIME_LAST_FILE_WRITE

GetFileDates(%DATE_TIME_LAST_FILE_ACCESS)

FUNCTION GetFileDates(BYVAL nChoice as DWORD)
LOCAL n as DWORD
REDIM FolderDates(nFolders)
REDIM FIleDates (nFiles)
FOR n = 1 to nFolders
FolderDates(n) += " " + FILE_GetDateTimeStamp(Current_path + Folders(n), nChoice)
NEXT
FOR n = 1 to nFiles
FileDates(n) += " " + FILE_GetDateTimeStamp(Current_path + Files(n), nChoice)
NEXT
END FUNCTION



I never know the size of an equate so I thought it might be a Long but I played it safe with a Dword.

kryton9
19-11-2007, 08:50
Thanks Sandy a very nice script. It is really a quick way to zip around folders and files.

marcel
19-11-2007, 11:34
Yep, nice script Sandy. I would also add a function to compare two folders if they are the same for file name, date, time stamp etc. and what differs between the two.

Michael Hartlef
19-11-2007, 12:29
Ok Sandy, you asked for it :)

1) Instead of lisboxes, use treeviews. This way you can have folders and files in one view.
2) Use the empty space (from the folder box) for another treeview.
3) make it easy to copy/move selected files from one view to the other.
4) Have toolbars with nice icons instead of the textbuttons.

Michael

ErosOlmi
19-11-2007, 12:57
I think Sandy will need a help to achieve all the requests because some of them has never been showed with a thinBasic example, like, for example, SysTreeView32, syslistview32 or icons in those controls.

From my side I need to create more examples on using those controls.

Ciao
Eros

sandyrepope
19-11-2007, 16:58
there is "..." as first item in list of directories
I have added "[...]" to the script. I tried using "..." but the three dots didn't show up very well. This was a very good idea. Thanks Psch.

I appreciate all the suggestions and have added all of them to my list. As I'm still a beginner and have a lot to learn it may take me a while to work some of them into the script. I'll use as many as I can.

Thanks
Sandy

Petr Schreiber
19-11-2007, 19:48
Thanks Sandy,

good luck on your project!


Petr

sandyrepope
21-11-2007, 05:37
Here is a minor update to my explorer program.

Thanks
Sandy

kryton9
21-11-2007, 06:45
Thanks Sandy, so far the new script is working fine for me.

ErosOlmi
21-11-2007, 12:06
Sandy,

it is better to keep just one copy of the script so usually it is better to re-edit your original post, delete old attached file and post the new one.
Than add a new post telling original post has changed.

This in order to keep thing better organized.

Thanks a lot
Eros

Petr Schreiber
21-11-2007, 14:49
Thanks Sandy,

[...] works exactly as I need, great work!


Petr

sandyrepope
21-11-2007, 16:47
it is better to keep just one copy of the script so usually it is better to re-edit your original post, delete old attached file and post the new one.
Than add a new post telling original post has changed.

This in order to keep thing better organized.

This is the way I will do it from now on. Sorry that I didn't realize I should do it like that here.

Thanks
Sandy

sandyrepope
10-12-2007, 02:24
Have a context menu showing up once a file is selected and you press right mouse button

I'm afraid that this will have to wait for quite some time. I haven't figured out how to detect the right mouse button click and I haven't figured out how to make a context menu either. I'm sorry!


Instead of listboxes, use treeviews. This way you can have folders and files in one view.

I can't figure out how to do treeviews yet so they will have to wait. I'm sorry!

Thanks
Sandy

Michael Clease
10-12-2007, 10:14
Have a context menu showing up once a file is selected and you press right mouse button

I'm afraid that this will have to wait for quite some time. I haven't figured out how to detect the right mouse button click and I haven't figured out how to make a context menu either. I'm sorry!


This is a very rough idea



USES "UI"
Dim hDlg As DWORD
Dim Msg, wparam,lparam As DWORD
DIM hRbutMenu AS DWORD
DIm sRMenu(4) as STRING

sRMenu(1) = "Line1" : sRMenu(2) = "Line2"
sRMenu(3) = "Line3" : sRMenu(4) = "Line4"

DIALOG New 0, "APPTITLE",-1,-1, 330, 203, _
%WS_POPUP Or %WS_VISIBLE Or _
%WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX, 0 To hDlg

DIALOG NEW 0, "Menu",-1,-1, 100, 100, _
%DS_CENTERMOUSE OR _
%WS_POPUP Or %WS_VISIBLE Or %WS_CLIPCHILDREN Or _
%WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX, 0 TO hRbutMenu

CONTROL ADD BUTTON, hDlg, 1001, "Click to kill", 90, 50, 150, 100
CONTROL ADD LISTBOX, hRbutMenu, 2000, sRMenu(), 0, 0, 150, 100, %LBS_STANDARD

DIALOG SHOW MODELESS hDlg
GetAsyncKeyState -1

While ISWINDOW(hDlg)
Msg = GETMESSAGE(hDlg, wParam, lParam)
Select Case Msg
Case %WM_Command
If wParam = 1001 Then Exit While
Case %WM_SYSCOMMAND
If wParam = %SC_Close Then Exit While
End Select
IF GetWindowKeyState(hDlg, %VK_RBUTTON) THEN
' CONTROL ADD LISTBOX, hRbutMenu, ....
DIALOG SHOW MODELESS hRbutMenu
DIALOG SHOW STATE hRbutMenu, 1
WHILE IsWindow(hRbutMenu)
Msg = GETMESSAGE(hRbutMenu, wParam, lParam)
Select Case Msg
' Case %WM_Command
' If wParam = 1001 Then DIALOG SHOW STATE hRbutMenu, 0 : Exit While
Case %WM_SYSCOMMAND
If wParam = %SC_Close Then DIALOG SHOW STATE hRbutMenu, 0 : Exit While
End Select
WEND
ENDIF
Wend
DIALOG End hRbutMenu
DIALOG End hDlg

ErosOlmi
10-12-2007, 11:31
Hi guy.

Regarding treeview and other complex controls, I 'm working on UI module to let them working.
The complexity is the way those controls respond to events. %WM_NOTIFY message and special structures different for each control are in place.

So, please be patient. Maybe in Jan I will be able to release a UI module able to handle them.

Sorry
Eros

Michael Clease
10-12-2007, 15:55
look up 2 posts I posted a quick example.

sandyrepope
11-12-2007, 00:07
Abraxas, The script you posted is simply awesome! It does things I'd never have thought of on my own. I can hardly wait to try using the programming it shows.

Thank you for a really great script!

Thanks
Sandy

ErosOlmi
11-12-2007, 17:39
Thanks Abraxas for your help. You gave me an idea to show how to create a right click menu.
Attached the example.

Ciao
Eros

Change: removed some unnecessary code

kryton9
12-12-2007, 00:16
Thanks guys, nice examples.

sandyrepope
12-12-2007, 00:20
Eros, That's a terrific example script. Thank you very much for posting it.


Thanks Abraxas for your help. You gave me an idea to show how to create a right click menu.This is one of the things I love about this forum. Things we post can give others ideas which they can share.

Thanks
Sandy

Michael Clease
12-12-2007, 09:58
thanks Eros, I was thinking about tracking the mouse but didnt know about "TrackPopupMenu" nice work.

I think it would be nice to have a new keyword using the GetCurPos but it would better to call it GetMousePos, I will leave that to you.


thanks

Mike

ErosOlmi
12-12-2007, 17:52
Nice idea Mike.
Maybe a screen position (absolute) and a client area position (relative) inside the foreground window.

sandyrepope
17-12-2007, 02:12
I've just uploaded the newest version of thinBasic Explorer (see first post). It now has a right-click menu thanks to Eros.

I now plan to see what can be done about having additional information on the files section. I haven't worked out just how this should work yet so it might be a short while before I can get it working.

Please let me know if you find any bugs that I didn't. I try to catch all bugs but no matter how careful I am I know that it is possible for some to get by me.

Thanks
Sandy

Petr Schreiber
17-12-2007, 11:57
Sandy,

thanks a lot. I discovered I have some garbage files in root thanks to your program.


Petr

ErosOlmi
17-12-2007, 12:10
Very nice work Sandy.

The only thing I do not like so far is usage of all capital letters for buttons and menues. But this is your software so do as you prefer.

During holidays I will work with advanced listbox and treeview in order to give you the power for this script, especially the usage of icons inside lists. It will need to add new features on UI message pump. It is not easy because advanced listview and treeview use notifications and special personalized structures but I'm working on it.

Ciao
Eros

sandyrepope
17-12-2007, 17:10
The only thing I do not like so far is usage of all capital letters for buttons and menues. But this is your software so do as you prefer.Would it be better if the text was like this example? 'Delete File'

The capital letters was just an experiment, not a big deal. I have noticed that in firefox that only the first letter of a word is capitalized. I've been thinking about changing to this type of text.

Thanks
Sandy

ErosOlmi
17-12-2007, 17:24
Sandy,

is just a personal taste. I prefer proper capitalization, ie just first letter.

A way to get things organized is to have all texts as string equates. For example:


$mnuTxt_DeleteFile = "Delete file"
$mnuTxt_MoveFile = "Move file"

and than use


MENU ADD STRING, hMenu, $mnuTxt_DeleteFile, 401, %MF_ENABLED
MENU ADD STRING, hMenu, $mnuTxt_MoveFile , 402, %MF_ENABLED


Another suggestion I can give is about numeric commands: 401, 402, ...
When script starts becoming complex (read advanced) it is much better to use mnemonics equates instead of numbers. So, again, it is much better to use something like:


$mnuTxt_DeleteFile = "Delete file"
$mnuTxt_MoveFile = "Move file"
'...
%cmdMenu_DeleteFile = 401
%cmdMenu_MoveFile = 402

and than use


MENU ADD STRING, hMenu, $mnuTxt_DeleteFile, %cmdMenu_DeleteFile, %MF_ENABLED
MENU ADD STRING, hMenu, $mnuTxt_MoveFile , %cmdMenu_MoveFile, %MF_ENABLED

The same in message pump command selection


case %wm_command
select case wParam
case = %cmdMenu_DeleteFile
File_delete()
case = %cmdMenu_MoveFile
Move_file()
'...


Better to setup those things till the very beginning because changing them later is a much more complex job that, at some point, you will have to do.

Ciao and keep up the good job.
Eros

sandyrepope
18-12-2007, 00:49
Eros, those are some really good suggestions. I like them.

I've been thinking about replacing the buttons with a standard menu. I think this will make the program look better. What does everyone think?

Thanks
Sandy

kryton9
18-12-2007, 01:17
Sandy, I prefer buttons as you have quick access.... but I know this is not really standard and more people prefer standard menus.

I use menus, usually to get a good feel for what an app can do, by just going through and looking through the menus.
It feels safer than just clicking on buttons to see what happens :)

It will be interesting to hear other's opinions about this.