[Paraview-developers] Callback not being called when deselecting an item in the GUI of a plugin
Daniel Wilches Maradey
dwilches at gmail.com
Thu Jan 8 14:05:58 EST 2015
Hello Cory,
At the beginning I was trying with the same XML and function prototype
you told me, with no good results, so I gave up on that way.
But well, as you suggest it I have tried again copying&pasting your
XML and function prototype and putting this implementation:
void vtkVSUIFilter::SetAttributeEnabled(const char * name, int status)
{
char s[255];
sprintf(s, "SetAttributeEnabled/2 was invoked %s %d\n", name, status);
QMessageBox::information(NULL, "MyAction", s);
}
With these changes the problems I'm getting with it are:
* The callback is not being called when only one of my elements is
selected, I have to select two. And when I do so, the callback is
called just for the first element and the status == 0
* I see that for each 2 elements I select a single callback is
invoked, it seems it is ignoring each other selected element.
* Again, deselecting an element is not working, it doesn't generate a callback
My guess is that my function is not being passed the "status" but
instead the second selected element, converting it somehow from char*
to int (it always is 0 after that conversion). But this is just a wild
guess after seeing the consistent behaviour of ignoring the
even-numbered selected elements.
Maybe I'm missing something else?
--
Daniel Wilches
On Thu, Jan 8, 2015 at 11:47 AM, Cory Quammen <cory.quammen at kitware.com> wrote:
> Daniel,
>
> The signature for SetAttributeEnabled() should be
>
> void SetAttributeEnabled(const char * name, int status)
>
> The status argument tells whether the attribute is enabled or not.
>
> Also, your XML should be
>
> <StringVectorProperty command="SetAttributeEnabled"
> element_types="2 0"
> label="Enabled attributes"
> name="CellArrayStatus"
> number_of_elements="0"
> number_of_elements_per_command="2"
> repeat_command="1">
> <ArrayListDomain name="array_list">
> <RequiredProperties>
> <Property name="Input" function="Input" />
> </RequiredProperties>
> </ArrayListDomain>
> </StringVectorProperty>
>
> The element_types indicate the type of argument (2 for char string, 0 for int).
>
> Please see ParaView/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml
> lines 241 - 262 for more hints that might help you.
>
> Hope that helps,
> Cory
>
> On Thu, Jan 8, 2015 at 1:05 PM, Daniel Wilches Maradey
> <dwilches at gmail.com> wrote:
>> Hello,
>>
>> I'm creating a plugin that shows a list of the avaiable inputs, and
>> allows the user to select which inputs should be processed. The
>> following is the part of my XML that generates the list of inputs,
>> each with a checkbox that allows me to select several of them:
>>
>> <StringVectorProperty command="SetAttributeEnabled"
>> label="Enabled attributes"
>> name="CellArrayStatus"
>> number_of_elements="1"
>> repeat_command="1">
>> <ArrayListDomain name="array_list">
>> <RequiredProperties>
>> <Property name="Input" function="Input" />
>> </RequiredProperties>
>> </ArrayListDomain>
>> </StringVectorProperty>
>>
>> The problem I'm facing is that the callback "SetAttributeEnabled" is
>> only being called when I select an item, but not when I deselect it,
>> so I cannot know the actual state of the checkboxes in this way.
>>
>> Do you know how to force the callback to be called when deselecting an
>> item? or how can I retrieve an array of all selected items from my C++
>> plugin?
>>
>> If needed, this is my C++ callback:
>>
>> public:
>> void SetAttributeEnabled(char* name);
>>
>>
>> Thanks.
>> _______________________________________________
>> Paraview-developers mailing list
>> Paraview-developers at paraview.org
>> http://public.kitware.com/mailman/listinfo/paraview-developers
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
More information about the Paraview-developers
mailing list