final beta version posted at newer post. let me know if you find any bugs and let me know what you think.
Posted on 2004-07-16 00:05:14 by smurf
Hi Smurf,

Cool. A couple of suggestions though. First the FIND function should be capable of finding any word or string in the title, for example A Fist Full of Dollars was not found when I searched for "fist", wildcards would be ideal. Second you should parse the title to not sort "the" and "a" for example The Matrix should be listed under M not T, otherwise you will just end up with 2 letters containing 80% of all titles. Finally since you are using SQL to seach the database, it would be nice to include a user defined grouping tab, the user could set it up with combo boxes. The information is too limited, a synopsis and/or rating field is needed perhaps a type as well (VHS/DVD/VCD). These need not be displayed but a double click could present a "more info" dialog.
Posted on 2004-07-16 01:01:50 by donkey
I'm also interested in a robust filesearch based on wildcard patterns, I've written one for my p2p but it's not very strong.
What I do is search for *$*.* (where $ represents the searchterm), and if no result is obtained, I decrease the length of the search string..

*fist*.*
*fis*.*
*fi*.*
*f*.*

I'm almost certain to find a result this way, but it may be far and away from the intended.

Who has a better idea?
Posted on 2004-07-16 04:28:56 by Homer
i still need to implement listvew editing.

First the FIND function should be capable of finding any word or string in the title, for example A Fist Full of Dollars was not found when I searched for "fist", wildcards would be ideal.

this will be easy to do. i was surprised as to how easy it is to work with sql statements.

Second you should parse the title to not sort "the" and "a" for example The Matrix should be listed under M not T, otherwise you will just end up with 2 letters containing 80% of all titles.

good point!

Finally since you are using SQL to seach the database, it would be nice to include a user defined grouping tab, the user could set it up with combo boxes. The information is too limited, a synopsis and/or rating field is needed perhaps a type as well (VHS/DVD/VCD). These need not be displayed but a double click could present a "more info" dialog

i dont think i will be implementing anything along those lines. this is pretty much tailored to my needs. i will release the source and if someone wants to they can change it.
Posted on 2004-07-16 08:52:32 by smurf
I'm having problem with odbc and sql. I would like to see how you did it. Just post that part if
you want.
Posted on 2004-07-16 13:58:42 by avalon
I was thinking about wildcard searches and I'm going to try to come up with something. In the mean time I was reading about SoundEx which seems pretty cool, it lets you find words that sound similar so I wrote a routine to generate a SoundEx key and added it to my Strings library. It will generate a 4 byte key for any word and you can use it to search for words that sound the same. I am not sure how effective it is but it seemed interesting. For example :

Philosophy = F421
filosofy = F421
lamb = L500
lamn = L500

The function in the lib is lszSoundEx, the source is available in the Strings.lib download from my website.

Note: My SoundEx is a little different than the one in SQL which I have just discovered. It allows for 2 characters separated by a vowel to generate separate numbers also it will replace some of the more common letter combinations that sound the same (PH is replaced by F). I think this will make it a little more accurate than the SQL version. Besides those 2 major differences it should generate the same values.
Posted on 2004-07-16 16:06:20 by donkey
Oh, there's a SoundEx in SQL? How do you use it? :)
Posted on 2004-07-16 20:52:08 by f0dder

Oh, there's a SoundEx in SQL? How do you use it? :)

No idea, I was just googling around for more information after I wrote my SoundEx from an outline I found and found that SQL has it too...

MS Transact-SQL

DB2 SQL Reference

I was working from these notes:

The SoundEx Algorithm as an Outline
    [*]Capitalize all letters in the word and drop all punctuation marks. Pad the word with rightmost blanks as needed during each procedure step.
    [*]Retain the first letter of the word.
    [*]Change all occurrence of the following letters to '0' (zero):
    'A', E', 'I', 'O', 'U', 'H', 'W', 'Y'.
    [*]Change letters from the following sets into the digit given:
    * 1 = 'B', 'F', 'P', 'V'
    * 2 = 'C', 'G', 'J', 'K', 'Q', 'S', 'X', 'Z'
    * 3 = 'D','T'
    * 4 = 'L'
    * 5 = 'M','N'
    * 6 = 'R'
    [*]Remove all pairs of digits which occur beside each other from the string that resulted after step (4).
    [*]Remove all zeros from the string that results from step 5.0 (placed there in step 3)
    [*]Pad the string that resulted from step (6) with trailing zeros and return only the first four positions, which will be of the form <uppercase letter> <digit> <digit> <digit>.


I looked at the Smith/Smythe example from the MSDN page and I got S530 in both cases, as well the LUCCHESSI/Loucesy example from the other site gives me matching SoundEx keys (L220).
Posted on 2004-07-16 21:22:05 by donkey
i cleaned up the code a bit so i can post it. the controls are all in separate include files. You can download the new version along with the source up at my original post. the attachment has been changed.

I was also wondering where movies that start with numbers like "28 days" should be listed under? should i make another button instead of including them alphabetically?

When my complete list is shown should i also sort the list by inoring the "The" and "A" at the begining or should i leave it like i have it. The alphabetically list now sorts them appropriately.
Posted on 2004-07-18 21:31:26 by smurf
Hi smurf,

Didn't have alot of time to look at it yet but I would go with another button for 0..9, just one should do, there are not alot of movies that would fall into that category. The program seems to work fine with Win2K on a quick look.
Posted on 2004-07-18 21:43:31 by donkey
im not able to find a solution for sorting the movies in the database in the complete listing in my program.

im sure there must be an sql statement that will sort by ignoring leading words such as "The" or "A". Anyone familar with sql?
Posted on 2004-07-20 00:06:03 by smurf
Hi Smurf,

The normal way would be to parse the input to move them to the end...

The Matrix is stored as Matrix, The You can then decide whether to display them like this or to switch it back before adding them to the listview.
Posted on 2004-07-20 00:50:47 by donkey
so far everything is going good. the problem i have is when editing a subitem in my listview. i create a combobox as a child of the listview and place if over the subitem to edit. my problem is detecting when the combobox loses focus. So far my method detects WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN, WM_MOUSEWHEEL AND WM_VSCROLL. This seems to be too much and there should be something easier to implement.
Posted on 2004-07-21 07:11:14 by smurf
I create a combobox in a listview in the UpdateManager program on my website, in essence I subclass the control so I can find out when it loses focus. You must be careful to also watch for scrolling when you create the combo as well.

ComboboxProc FRAME hwnd,uMsg,wParam,lParam

uses ebx,edi,esi
LOCAL lvi :LV_ITEM

cmp D[uMsg],WM_KILLFOCUS
jne >>M3
invoke GetWindowLong,[hwnd],GWL_USERDATA
mov ebx,eax
cmp D[ebx+CHILDDATA.fType],0
jne >>M5
invoke SendMessage,[hwnd],CB_GETCURSEL,0,0
or eax,eax
js >>
invoke SendMessage, [hwnd], CB_GETLBTEXT, eax, OFFSET cbstring
mov eax,[ebx+CHILDDATA.iItem]
mov [lvi.iItem],eax
mov eax,[ebx+CHILDDATA.iSubitem]
mov [lvi.iSubItem],eax
mov D[lvi.imask],LVIF_TEXT
mov D[lvi.pszText],OFFSET cbstring
invoke SendMessage, [ebx+CHILDDATA.hParent], LVM_SETITEMTEXT,
[ebx+CHILDDATA.iItem], OFFSET lvi
mov D[UpdateFlag], TRUE
:
invoke SendMessage, [hwnd], WM_CLOSE, 0, 0
jmp >>M5

M3:
cmp D[uMsg], WM_CLOSE
jne >M5
invoke DestroyWindow,[hwnd]

M5:
; Win9x can return a zero for GWL_USERDATA so we must
; check it and call DefWindowProc if it returns 0 or it will GPF
invoke GetWindowLong,[hwnd],GWL_USERDATA
or eax,eax
jz >
invoke CallWindowProc,[eax+CHILDDATA.pOldProc],[hwnd],[uMsg],[wParam],[lParam]
ret
:
invoke DefWindowProc,[hwnd],[uMsg],[wParam],[lParam]
ret

ENDF


The CHILDDATA structure just contains information about the item that created the combo...

CHILDDATA struct

pOldProc DD
hParent DD
iItem DD
iSubitem DD
fType DD
ENDS
Posted on 2004-07-21 07:19:21 by donkey
confusion regarding the CHILDDATA structure. does sending the getwindowlong with GWL_USERDATA to a listview also return the same values you have for your CHILDDATA structure?

ok figured out my problem was that my combobox never had focus after it was created.


why can i not add this struture in my .data? section only as a LOCAL in a procedure without getting an error?

LV_HITTESTINFO or
LVHITTESTINFO
Posted on 2004-07-21 07:47:50 by smurf
Hi Smurf,

Actually the GWL_USERDATA contains a pointer to the CHILDDATA structure for that particular control. It is just a structured way of keeping track of handles and pointers for child controls that I use from time to time though it was not essential in this case I put it in to allow for easy expansion later. I am not sure why you are having a problem with LOCAL vs GLOBAL allocations for LV_HITTESTINFO, it should not make a difference.
Posted on 2004-07-21 09:55:20 by donkey
ok final beta version is posted at first thread. Lots of time spent fine tuning it. Could I get some testers to see if you can find some bugs? Let me know how things turn out.
Posted on 2004-07-24 21:32:12 by smurf
Bug Report :)

In complete list window :
1) changing genre doesn't work.
2) after changing te genre, tried to change the movie, this doesn't work either.

That's all i found so far.
Posted on 2004-07-24 21:56:14 by Jurgen

im not able to find a solution for sorting the movies in the database in the complete listing in my program.

im sure there must be an sql statement that will sort by ignoring leading words such as "The" or "A". Anyone familar with sql?

Hi

Did you "play" with RIGHT or SUBSTR function?

RIGHT(<string>,X) - Returns the rightmost X characters of the string
SUBSTR(<string>,X,Y) - Extracts Y letters from the string beginning at position X

stanks
Posted on 2004-07-25 02:19:49 by stanks
Did you "play" with RIGHT or SUBSTR function?

RIGHT(<string>,X) - Returns the rightmost X characters of the string
SUBSTR(<string>,X,Y) - Extracts Y letters from the string beginning at position X


used hutch's masm32 library for that. my sorting works like i want it to now. just have some bugs to work out on the editing of text in the listview.
Posted on 2004-07-25 08:08:48 by smurf