Re: Win32Lib: listbox: select item with RIGHT mouse click?
Al,
Thanks, I'll try it & see how it works for me.
Dan
----- Original Message -----
From: "Al Getz" <xaxo at AOL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, September 02, 2000 8:20 AM
Subject: Re: Win32Lib: listbox: select item with RIGHT mouse click?
> Here's a solution to right click list box selection:
>
> -----------------------------------------------------------------------
> include Win32Lib.ew
>
> constant Desktop=0
>
> constant Window1=
> create(Window,"Test LB right clicks",Desktop,10,10,580,460,0)
>
> constant ListBox2=create(List,"2",Window1,40,20,260,200,0)
>
>
>
> --test listbox demo items:
>
> for j=1 to 30 do
> addItem(ListBox2,"entry"&sprintf("%d",j))
> end for
>
>
>
>
>
> --define constants if not already defined in Win32Lib.ew:
>
> constant LB_GETITEMHEIGHT=#01A1,
> LB_GETTOPINDEX=#018E
> -- LB_SETCURSEL=#0186
>
> --include an onMouse event in your program code:
>
> procedure onMouse_ListBox2(integer event, integer x, integer y)
> --insert event code here:
> atom lParam,index,bool,height,topindex,indexoffset
> sequence itemtext
>
> if event=RIGHT_DOWN then
> height=sendMessage(ListBox2,LB_GETITEMHEIGHT,0,0)
> topindex=sendMessage(ListBox2,LB_GETTOPINDEX,0,0)
> indexoffset=floor(y/height)
> index=indexoffset+topindex
>
> bool=sendMessage(ListBox2,LB_SETCURSEL,index,0)
> itemtext=getItem(ListBox2,index+1)
>
> --printf(1,"%s\n",{itemtext}) --unrem to print values
>
> --put any further processing code here:
>
>
> --
> end if
> end procedure
> onMouse[ListBox2]=routine_id("onMouse_ListBox2")
>
> --may have to modify this last line for your version of Win32Lib:
> WinMain(Window1,Normal)
>
> ------------------------------------------------------------------
>
> Good luck with it.
> Al Getz
|
Not Categorized, Please Help
|
|