PDA

View Full Version : Setting panel selected item


xmcnuggetx
May 11th, 2009, 09:06 AM
Is there a way to set the selection to the 1st item when the panel receives focus instead of remembering where the user was last?

idan
May 11th, 2009, 09:17 AM
yes, in the <onup/ondown/onright/onleft> put this <onright>SetFocus(100, 0)</onright>
where 0 is the position in the list you want to set focus on.

xmcnuggetx
May 11th, 2009, 09:32 AM
hrm... It seems to be working (consistently selecting an item), but 0 is selecting the 2nd item in the panel.

xmcnuggetx
May 14th, 2009, 10:09 AM
Something seems funny with the SetFocus(id,index)... (I'm on the Windows build incase its an os build issue). If I do SetFocus(1100, 0) it selects the second item in the list not the first, doing SetFocus(1100,1) it selects the third item.. like the index's are 1 off. Take these examples:

<onright>SetFocus(1201, 0)</onright>



<onright><![CDATA[CallPython(
nextlist = mc.GetActiveWindow().GetList(1201)
nextlist.SetFocusedItem(0)
nextlist.SetFocus()
)]]></onright>


The first code snippet has the problem, but the second functions correctly selecting the top item in the list.