2 Replies Latest reply on Jul 20, 2017 5:14 AM by Pickory

    Highlight Frames When Frames Selected C++

    kokilap3519345

      Hi All,

                I am new to  Building c++ plugin with IndesignCC 2015 . I am creating panel with list of text frame name when i selected the name and click on  the show button my frame getting selected  . And i decided to highlight frames while it is selected with the Stroke Weight.But Stroke weight is applyed permanently for the selected frames  but i need to apply stroke wieght only for highlighting  purpose when it is selected. Or else can any one suggest me for any other Way of Highlight.

           Screen short and Source code are attached here please Advice me.

       

      ShowButton(IActiveContext* ac,LayerLocation location)

      {

        do {

        IDocument* document = ac->GetContextDocument();

        if (document == NULL)

        break;

        InterfacePtr<IPanelControlData> panelData(this, UseDefaultIID());

        if (!panelData)

        break;

       

        int listSelection = WidgetUtils::SelectedIndex(panelData, kClickerListBoxWidgetID);

        if (listSelection < 0)

        break;

            

        WideString sequencename;

        if (!GetSequenceName(sequencename))

        break;

        sequenceDataPtr sdp;

        for (sdp = fDocSequenceList; sdp != nil; sdp = sdp->next)

        if (sequencename == (WideString)sdp->name)

        break;

        if (sdp == nil)

        break;

            

        clickDataPtr cdp;

              if (cdp == nil)

        break; // Find the entry corresponding to the list selection

        for (cdp = sdp->firstClick; cdp != nil; cdp = cdp->next)

              {

        if (cdp->listBoxIndex == listSelection)

                  {

                      UIDRef containingRef=cdp->boxClicked;               

                      IDocument* doc = ac->GetContextDocument();

                      if (doc == NULL)

                          return;

                      IDataBase* docDB = ::GetDataBase(doc);

                      if (docDB == NULL)

                          return;

                      ISelectionManager* selectionManager = ac->GetContextSelection();

                  ASSERT(selectionManager);

             if (selectionManager == nil)

             break;

             selectionManager->DeselectAll(nil);

                      InterfacePtr<ILayoutSelectionSuite>layoutSelectionSuite(selectionManager, UseDefaultIID());

                      ASSERT(layoutSelectionSuite);

                      if (layoutSelectionSuite == nil)

                          break;

                      if (containingRef == nil)

                          break;

                      layoutSelectionSuite->SelectPageItems(containingRef, Selection::kAddTo,

                                                            Selection::kAlwaysCenterInView);

                      bool16 result = kTrue;

                      InterfacePtr<IStrokeAttributeSuite> strokeAttributeSuite(fCurrentSelection, UseDefaultIID());

                      if (!strokeAttributeSuite) {

                          result = kTrue;

                          break;

                      }

                      PMReal newStrokeWeight = 5;

                      strokeAttributeSuite->ApplyStrokeWeight(newStrokeWeight);

                      break;

                                       

                      }

                  }

              }

      } while (false);

       

      ScreenShort1:

           In this screen In Clicker panel when i selected one of the name from the list box and clicked on the show button my text frame is selected in the document with stroke weight exactly what i am expecting

      Screen Shot 2017-07-20 at 4.02.33 PM.png

       

      Screen short 2:

           If again i am selecting one of the name from click panel and clicked show button the stroke apply for the currently selected frame is correct but previously selected frames stroke weight is not removing its my problem.

      Screen Shot 2017-07-20 at 4.04.40 PM.png