Jump to content
Sign in to follow this  
sandyd

Select the last item in a listbox

Recommended Posts

sandyd

Hi Peeps,

I have been trying this for the past hour and getting nowhere.

I have been using CyberSlug's listbox_wrappers include file but just cannot seem to get itto work.

Can anyone offera snippet of code that does the job?

TIA


----[ SandyD ]---

Share this post


Link to post
Share on other sites
Lazycat

I have not wrapper under my hand, so this is code with msg using. You need get items count first and then set selection to the last item.

GUICreate("Test")
$hList = GUICtrlCreateList("", 5, 5)
GUICtrlSetData(-1, "Row1|Row2|Row3|Row4|Row5")
GUISetState()

$LB_GETCOUNT = 0x018B
$LB_SETCURSEL = 0x0186

$count = GUICtrlSendMsg($hList, $LB_GETCOUNT, 0, 0)
GUICtrlSendMsg($hList, $LB_SETCURSEL, $count - 1, 0)

While 1
    $nMsg = GUIGetMsg()
    If $nMsg = -3 Then Exit
Wend

Share this post


Link to post
Share on other sites
sandyd

Thanks.

That does the job nicely.


----[ SandyD ]---

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×