cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Can addon behave like the normal buiding elements tools ?

julienK
Enthusiast

When using  walls, colums etc in AC  the tool stays active after you finish your input.

 

Is it possible to get this behaviour for an addon?

I have a palette with an icon that let me place a text element, but i have to reclick the icon for each new text element.

Is there a way to make this comand 'sticky' so i can reuse it multiple time ?

1 ACCEPTED SOLUTION

Solution

Thanks for the clarification. I misunderstood your question.

 

If I understand it correctly now, I think you would have to manage that manually by e.g. having a loop in your ButtonClicked event observer and stop the loop once the user cancels the input. For example the function APIIo_GetPointID returns APIERR_CANCEL when users cancel the input.


Does this address your issue? Otherwise could you provide the code of your ButtonClicked event observer?

Bernd Schwarzenbacher
Archicad Add-On Developer
Get (partially free) Add-Ons at www.bschwb.com/add-ons

View solution in original post

4 REPLIES 4

bschwb
Advocate

Hi!

Are you using an `IconButton`?
I think the behavior you want should work with an `IconPushCheck`.

Bernd Schwarzenbacher
Archicad Add-On Developer
Get (partially free) Add-Ons at www.bschwb.com/add-ons

I do use an iconButton on my palette, yes.

The issue is not to retain some parameter that works just fine, the issue is that I want the command linked to that button to stay active once the first iteration is finished.

 

In the palette I have  a buttonclicked event observer, what I want it the function lnked to the button to be called again once it completes.

Solution

Thanks for the clarification. I misunderstood your question.

 

If I understand it correctly now, I think you would have to manage that manually by e.g. having a loop in your ButtonClicked event observer and stop the loop once the user cancels the input. For example the function APIIo_GetPointID returns APIERR_CANCEL when users cancel the input.


Does this address your issue? Otherwise could you provide the code of your ButtonClicked event observer?

Bernd Schwarzenbacher
Archicad Add-On Developer
Get (partially free) Add-Ons at www.bschwb.com/add-ons

Sorry I forgot to come back to say I found the solution.

Like you suggested  i changed my function return type to GSErrCode and wrapped it in  a do-while loop.

 

	 GSErrCode Do_iterate() {
		 GSErrCode err;
		 do {
			 ACAPI_CallUndoableCommand("Iterated element",
				 [&]() -> GSErrCode {
					 err = Do_CreateText();
					 return NoError;
				 });
		 } while (err == NoError);
		 return err;
	 }

 

 

my Do_CreateText function calls ClickAPoint() from APICommon.c whick does return  APIERR_Cancel

 

 

Thanks for the help.

 

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!