Closed GoogleCodeExporter closed 9 years ago
As far as I can tell that seems to be the way choose() works in IDA. The
parameter passed
in 'title' becomes the title of the chooser window but only in the GUI version.
It is indeed
quite weird that IDA takes the last item and makes it the column title.
One way to work around this is to subclass Choose() and override sizer() to
return len(self.list)-1 so the last item does not show up in the list.
Original comment by gergely.erdelyi
on 2 Jul 2008 at 8:23
[deleted comment]
The following code works without any problem..
################
int data[] = { 1,2,3,0};
int widths[] = {16,16,16};
char *headers[] = {"Test 1","Test 2","Test 3"};
char *formats[] = { "%d","%d","%d"};
ulong idaapi my_sizer(void *obj)
{
int *p = (int *)obj;
int i = 0;
while (*p++)
i++;
return i;
}
void idaapi my_getline(void *obj,ulong n, char* const *cells)
{
int *p = (int *)obj;
if (n == 0)
{
for(int i = 0; i < 3; i++)
qstrncpy(cells[i],headers[i],widths[i]);
}
else
{
for (int i = 0; i < 3; i++)
qsnprintf(cells[i],widths[i],formats[i],p[n - 1]);
}
}
void run(int arg)
{
choose2(data,3,widths,my_sizer,my_getline,"Testing 123");
}
Original comment by zarulsha...@gmail.com
on 8 Dec 2008 at 9:54
Okie,
Gergely fixed both the header and the "string only" problem. Thanks!
http://code.google.com/p/idapython/source/detail?r=129
Original comment by zarulsha...@gmail.com
on 10 Dec 2008 at 11:40
Original comment by gergely.erdelyi
on 10 Dec 2008 at 11:44
Original issue reported on code.google.com by
stam.co...@gmail.com
on 2 Jul 2008 at 7:49