|
Author
|
Topic: Help with Borje Virtual ListBox control
|
Gösta H. Lovgren-2 Member
|
posted January 14, 2006 02:10 PM
Dunno why but I can't return Top Line of the listbox:
Static Now_Showing_Item& 'from array SendMessage hVList3, %VLB_GETSELECTED, Now_Showing_Item, 1 '''' returns the right number Local Top_Line_Showing& ( '''from "manual" in Vlist.Inc: ' %VLB_GETTOPLINE - returns first visible line in control ' wParam = not used, should be 0. ' lParam = not used, should be 0. ' Returns: Index of control's top (first visible) line. ' Example: index = SendMessage(hWndCtrl, %VLB_GETTOPLINE, 0, 0) ''' end manual snippet ) ''' Each of the following always returns 0 ' Top_Line_Showing = SendMessage hVList3, %VLB_GETTOPLINE, 0, 0 ' always zero so don't use ' SendMessage hVList3, %VLB_GETTOPLINE, Top_Line_Showing, 1 ' SendMessage hVList3, %VLB_GETTOPLINE, Top_Line_Showing, 0
Hopefully someone can see an error in my syntax or something. (I'm hours into this.) ------------------ Thx............Gösta [EMAIL]Gosta AT SwedesDock.com[/EMAIL] http://www.SwedesDock.com http://www.PondersBible.com IP: Logged |
Pierre Bellisle Member
|
posted January 14, 2006 06:47 PM
Hi Gösta,Is hVList3 global ? -> GLOBAL hVList3 AS LONG Is hVList3 was obtain by -> hVList3 = CreateVirtualList(hDlg, ... Try this code and make sure that hVList3 is not zero...
Now_Showing_Item& = SendMessage(hVList3, %VLB_GETTOPLINE, 0, 0) MSGBOX "Handle of hVList3 is" & HEX$(hVList3) & $CRLF & _ "Top item number is" & STR$(Now_Showing_Item&)
PierreIP: Logged |
Gösta H. Lovgren-2 Member
|
posted January 14, 2006 10:45 PM
quote: Originally posted by Pierre Bellisle: Hi Gösta,Is hVList3 global ? -> GLOBAL hVList3 AS LONG Pierre
Yup, it is Perre. That's why I included the:
Static Now_Showing_Item& 'from array SendMessage hVList3, %VLB_GETSELECTED, Now_Showing_Item, 1 line so you could see the Now_Showing_Item is returned correctly. My guess is the answer is in VLIST.INC (Borje's code for the Virtual List Box) and I was hoping he could help. ------------------ Thx............Gösta [EMAIL]Gosta AT SwedesDock.com[/EMAIL] http://www.SwedesDock.com http://www.PondersBible.com IP: Logged |
Pierre Bellisle Member
|
posted January 15, 2006 12:11 AM
Gösta, if I understand correctly, you want to get the number of the first visible line in the virtual listbox. To test, I did download listview demo from http://www.tolkenxp.com/pb/pbvlist.htm in PBVLtest.bas I did...
replace CASE %IDCANCEL IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN DIALOG END CBHNDL with CASE %IDCANCEL 'IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN DIALOG END CBHNDL MSGBOX("First visible line is " & STR$(SendMessage(hVList1, %VLB_GETTOPLINE, 0, 0))) MSGBOX("Now the first visible line will be set to 123") SendMessage hVList1, %VLB_SETSELECTED, 123, 0 SendMessage hVList1, %VLB_SETTOPLINE, 123, 1 MSGBOX("First visible line is " & STR$(SendMessage(hVList1, %VLB_GETTOPLINE, 0, 0)))
And everything work's as expected when I click the "Create array", "Show array" and "Exit" button. Is it what you want to acheive? Pierre
IP: Logged |
Gösta H. Lovgren-2 Member
|
posted January 15, 2006 10:40 AM
quote: Originally posted by Pierre Bellisle: Gösta, if I understand correctly, you want to get the number of the first visible line in the virtual listbox. Pierre
As I knew I was doing something wrong. (what else is new?) Thanks to your code example, Pierre, I got it figured out. Somehow I was incorrectly using SendMessage. I was using: SendMessage hVList3, %VLB_GETTopLine, Top_Line_Showing&, 1 When I should have used: Top_Line_Showing& = SendMessage(hVList3, %VLB_GETTOPLINE, 0, 0) Works for me now. Thanks. ------------------ Thx............Gösta [EMAIL]Gosta AT SwedesDock.com[/EMAIL] http://www.SwedesDock.com http://www.PondersBible.com [This message has been edited by Gösta H. Lovgren-2 (edited January 15, 2006).] IP: Logged |
Jules Marchildon Member
|
posted January 15, 2006 10:45 AM
Test on PBWin 8.01 and PBWin 7.02...Custom message %VLB_GETTOPLINE Using Borje original code from source forum, the custom message works correctly. Using Borje original code from Pierre link above , the custom message works correctly. Using Borje original code from either case above with modified include file pvlist1.inc, (that one includes horizontal scrollbar), the custome message works correctly. Did you make any modifications to the include file? Are you sure you are passing the correct window handle?
Regards, Jules  ------------------ OK, never mind, a little latter, you solved your problem. Cheers! 
[This message has been edited by Jules Marchildon (edited January 15, 2006).] IP: Logged |