Archicad C++ API
About Archicad add-on development using the C++ API.

How to check unsaved changes?

Anonymous
Not applicable
I open some project in ArchiCAD. Modify it, but not save.
Than I open another project using my Add-On.

In this case I lost all my changes in first project.
How I can check unsaved changes in project? Or may be open a new project with checking unsaved changes automatically? Thanks
10 REPLIES 10
Karl Ottenstein
Moderator
Just for more information: did you open the new project using the automate function APIDo_OpenID?

Yeah, I don't see an event handler function in a quick search, nor any type of state test.

I searched for 'dirty', since a 'dirty flag' is a pretty standard term to tag a file that has been modified. No go. Searched for 'changed' and 'modified', and only came up with handlers for dialog items.

Ralph? 😉

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hi, Karl

Yes, I open the new project using the automate function APIDo_OpenID.
Ralph Wessel
Mentor
equilibrium wrote:
How I can check unsaved changes in project? Or may be open a new project with checking unsaved changes automatically
No, sorry. You could attempt to track the user editing elements. but that's no guarantee.
Ralph Wessel BArch
Anonymous
Not applicable
I understand, Ralph, thanks a lot!
It's inconveniently, but I will try to ask user check unsaved changes.
Anonymous
Not applicable
Ralph wrote:
No, sorry. You could attempt to track the user editing elements. but that's no guarantee.
Excuse me, Ralph. Can you advise functions for track the user editing elements and may be some another changes? Thanks
Ralph Wessel
Mentor
equilibrium wrote:
Ralph wrote:
No, sorry. You could attempt to track the user editing elements. but that's no guarantee.
Excuse me, Ralph. Can you advise functions for track the user editing elements and may be some another changes? Thanks
Take a look at ACAPI_Notify_InstallElementObserver
Ralph Wessel BArch
Anonymous
Not applicable
Thanks
Anonymous
Not applicable
Ralph wrote:
Take a look at ACAPI_Notify_InstallElementObserver
I'm use example from docs for API 12.

First, it's not compiled for API 12. For example, API_NotifyElementType does not have 'typeID' field. But, so it is not important as

Second, I could not to catch any events. I just try to show message box when any event occur, but nothing happen when I add new element, move, copy or delete.


May be I must register event types?

Thanks
Ralph Wessel
Mentor
equilibrium wrote:
May be I must register event types?
Yes, you do (element editing and element creation). It would pay to read the entire Notification Manager section to understand how this works. Note ACAPI_Notify_CatchNewElement to monitor the creation of new elements.
Ralph Wessel BArch