New method controllist.selectitem
#1
i 'd like to have a method in object controllist to select an item...  Blush

i make some changes and prepared a diff...

*** controllist.cpp 2005-04-15 19:19:55.516992600 +0200
--- controllist_setitem.cpp 2005-04-15 20:23:31.016983500 +0200
***************
*** 211,240 ****
--- 211,267 ----
  self->vecitems.push_back(plistitem);
 
  // create message
  cguimessage msg(gui_msg_label_add, self->iparentid, self->icontrolid);
  msg.setlpvoid(plistitem->item);
 
  // send message
  pyguilock();
  if (self->pguicontrol) self->pguicontrol->onmessage(msg);
  pyguiunlock();
 
  py_incref(py_none);
  return py_none;
  }
 
+ /*
+ * controllist_selectitem(int item)
+ * select an item by index
+ */
+ pydoc_strvar(selectitem,
+ "selectitem(item) -- select an item by index\n"
+ "\n"
+ "item is the index on the item to select.");
+
+ pyobject* controllist_selectitem(controllist *self, pyobject *args)
+ {
+ long itemindex;
+
+ if (!pyarg_parsetuple(args, "l", itemindex))    return null;
+
+ // create message
+ cguimessage msg(gui_msg_item_selected, self->iparentid, self->icontrolid, itemindex);
+
+ // send message
+ pyguilock();
+ if (self->pguicontrol) self->pguicontrol->onmessage(msg);
+ pyguiunlock();
+
+ py_incref(py_none);
+ return py_none;
+ }
+
  pydoc_strvar(reset,
  "reset() -- clear all listitems in this control list.");
 
  pyobject* controllist_reset(controllist *self, pyobject *args)
  {
  // create message
  controllist *pcontrol = (controllist*)self;
  cguimessage msg(gui_msg_label_reset, pcontrol->iparentid, pcontrol->icontrolid);
 
  // send message
  pyguilock();
  if (pcontrol->pguicontrol) pcontrol->pguicontrol->onmessage(msg);
  pyguiunlock();
 
  // delete all items from vector
***************
*** 376,405 ****
--- 403,433 ----
  // send message
  pyguilock();
  if ((self->vecitems.size() > 0) && pcontrol->pguicontrol)
         {
             pcontrol->pguicontrol->onmessage(msg);
             plistitem = (pyobject*)self->vecitems[msg.getparam1()];
         }
  pyguiunlock();
 
  py_incref(plistitem);
  return plistitem;
  }
 
  pymethoddef controllist_methods[] = {
  {"additem", (pycfunction)controllist_additem, meth_varargs, additem},
+ {"selectitem", (pycfunction)controllist_selectitem, meth_varargs,  selectitem},
  {"reset", (pycfunction)controllist_reset, meth_varargs, reset},
  {"getspincontrol", (pycfunction)controllist_getspincontrol, meth_varargs, getspincontrol},
  {"getselectedposition", (pycfunction)controllist_getselectedposition, meth_varargs, getselectedposition},
  {"getselecteditem", (pycfunction)controllist_getselecteditem, meth_varargs, getselecteditem},
  {"setimagedimensions", (pycfunction)controllist_setimagedimensions, meth_varargs, setimagedimensions},
  {"setitemheight", (pycfunction)controllist_setitemheight, meth_varargs, setitemheight},
  {"setspace", (pycfunction)controllist_setspace, meth_varargs, setspace},
  {null, null, 0, null}
  };
 
  pydoc_strvar(controllist,
  "controllist class.\n"
  "\n"
  "controllist(\n"
         "   x, y, width, height, font, textcolor,\n"
Reply
#2
adding to cvs. thanks for the patch.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
thanks to you jmarshall!
Reply
#4
selectitem method is not correct...

instead of send a message i have created a new method cguilistcontrol:Confusedelectitem:

here are the patchs:
selectitem diff

i tested and now seems ok

i have upload also in http://www.xboxmediacenter.com/upload.htm

tracker was down
Reply
#5
what was wrong with the original technique of sending the select item message?

seemed like a suitable method to me.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
nothing happens when i call the method...

i don't investigate soo much (i dont't have a development xbox yet)

the new patch seems ok but i want to investigate soon as possible (i'm curious)... if you can wait... i will tell you
Reply
#7
ah - wrong message is what it was. (gui_msg_item_selected rather than gui_msg_item_select)

fixed.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
sorry

thanks
Reply
#9
thanks alot for this...
Reply
#10
-deleted.

i'm a moron... :nuts:



Reply

Logout Mark Read Team Forum Stats Members Help
New method controllist.selectitem0