Jump to content

Select the last item in a listbox

Recommended Posts

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?


----[ SandyD ]---
Link to post
Share on other sites

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.

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

$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
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...