Weird interaction between copying region and cloning region for custom region

Weird interaction between copying region and cloning region for custom region - Сообщения

#1 Опубликовано: 25.09.2023 15:22:18
muiz

muiz

15 сообщений из 22 понравились пользователям.

Группа: User

Hello everyone

I want to ask if anyone knows the reasons and perhaps the solution to the weird interaction that I am currently experiencing. In the Maxima plugin that I am working on right now, a settings form is opened when the user double-clicks on the custom region. When the custom region is out of focus (the user clicks on other places in the worksheet), the form will automatically close. This works fine on the original and on cloned custom regions but not on copied custom regions.

Edit: The only thing I notice does not work in copied custom region is the custom event added during the init of the canvas. The event is OnFocusChanged as written in this post:

https://en.smath.com/forum/yaf_postst23693_Any-ways-to-implement-OnFocusChanged-method-for-RegionHolder-or-RegionEvaluable-class.aspx

I hope someone can clarify me the logic behind cloning and copying in SMath and perhaps help me solve this problem.

Thank you in advance.

Best regards,

Faiz
#2 Опубликовано: 26.09.2023 04:45:28
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Copy and cloning have the same effect to the user but are processed differently; since the former involves the system Clipboard it is performed through a full serialization/deserialization (ToXml/FromXml methods), whereas the latter can be made on the fly within the program memory itself (Clone method). You should check if everything is initialized correctly in both the paths (look also at the InitLayout method).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 26.09.2023 04:48:46
muiz

muiz

15 сообщений из 22 понравились пользователям.

Группа: User

Wrote

Copy and cloning have the same effect to the user but are processed differently; since the former involves the system Clipboard it is performed through a full serialization/deserialization (ToXml/FromXml methods), whereas the latter can be made on the fly within the program memory itself (Clone method). You should check if everything is initialized correctly in both the paths (look also at the InitLayout method).



I realized that copying does not initialize the custom region unlike cloning (since cloning returns new custom region). I think that is the cause of my problem since the addition of the event handler is perfomed during the initialization. Thank you for the explanation.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений