Skip to main content
Known Participant
December 28, 2011
Answered

Button and handling button click

  • December 28, 2011
  • 2 replies
  • 1610 views

Hi all,

I have on my panel few buttons. I have defined in .h file WidgetIDs for buttons, next I defined ActionIDs for actions(but Iam not sure if this is correct, if actions are used only for menu items...). In .fr file I have defined buttons itselves. Now I need advice, how to handle button clicks? Sould I create Controller and Observer, or is there any other way how to make this functionality?? Is there any document describing what Iam trying to do??

Thx a lot again

This topic has been closed for replies.
Correct answer Manan Joshi

What you could do is use the observer on the panel on which the buttons are placed. Inside the observer's "AutoAttach" method attach observer to these buttons on the protocol "IID_ITRISTATECONTROLDATA" and then you will get a call in the update whenever one of these button's are clicked.

I don't think you require to create action ID's to implement this.

Have a try using this way, it will work.

Manan Joshi

- Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

2 replies

Known Participant
December 30, 2011

Hi again,

yesterday I have everything woring, because I have simple dialog with few buttons, but now I had to change Dialog to panel. I would like to use regural buttons (ButtonWidget) and handle clicks on them. I know that I must implement some ButtonActionObserver, this class would implement CObserver and methods AutoAttach, AutoDetach and Update, after that I must call macro CREATE_PMINTERFACE(ButtonActionObserver, ButtonActionObserverImpl) I have problem with that Impl thing.. i understand, that this macro binds observer to its implementation, but iam little bit confused from that..

Could anyone show me short snippet how to make this working??

What should I place in .fr file and why, the same for .h file of my project..

Thanks all a lot :]

Community Expert
December 30, 2011

Hi,

What exactly is the problem, is it that you are not able to get things working on a panel or you are confused on the Observer implemetation?

Since this discussion has been marked as answered and this new query also touches new areas, i suggest to create a new discussion so that more attention is attracted to the discussion.

Manan Joshi

- Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

-Manan
Known Participant
December 30, 2011

Good Idea, but the topic, would be the same..

Well my problem is that, Iam not albe to create working observer for panel buttons. When I used dolly and generate dialog and added there some buttons everything was ok, but now...

I create IAPButtonActionObserver.cpp file:

class IAPButtonActionObserver : public CObserver

{ virual method here};

CREATE_PMINTERFACE(IAPButtonActionObserver, kIAPButtonActionObserverImpl)

implemented methods here...

now I must add into IAPID.h implementation ID, class ID am I correct??

next I need to add class  statement into IAP.fr, but Iam not sure, what it should look like I have this:

Class

          {

                    kIAPButtonActionObserverBoss,

                    ButtonWidgetBoss,

                    {

                              /**

                              Handles button press (and release), see IAPButtonActionObserver...

                              */

                              IID_IOBSERVER, kIAPButtonActionObserverImpl,

                    }

          },

I have feeling that I missed something...

Known Participant
December 28, 2011

I found Indesign solutions pdf file, so there could be some clues. But my question is stil valid

Manan JoshiCommunity ExpertCorrect answer
Community Expert
December 29, 2011

What you could do is use the observer on the panel on which the buttons are placed. Inside the observer's "AutoAttach" method attach observer to these buttons on the protocol "IID_ITRISTATECONTROLDATA" and then you will get a call in the update whenever one of these button's are clicked.

I don't think you require to create action ID's to implement this.

Have a try using this way, it will work.

Manan Joshi

- Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

-Manan
Known Participant
December 29, 2011

Thank you, it works great, but I have to changeIID_ITRISTATECONTROLDATA to IID_IBOOLEANCONTROLDATA, when i do that everything is working fine...

So Iam moving to another task, how to get selected content on doument, how to get its boundaries and if image is present, than get its filename...