2022-09-11 03:55 AM - edited 2022-09-11 05:33 AM
hello. I am developing using API Development Kit 25.3002 (Windows).
I would like to send a DG_MSG_CHANGE message to the radio buttons in the palette I created.
The DGSendMessage function was described in the manual, so I tried to use it I'm having trouble finding an implementation.
I found the DGSendUserMessage function instead, but I don't know how to give the third argument DG::EventArg& msgData.
Is it correct to use DGSendUserMessage to send a message to the palette in the first place?
In addition, I tried to get the window handle with ACAPI_GetMainWindow or DGGetDialogWindow and execute the WindowsAPI SendMessage function.
It was no good.
Is there a way to send a message to the created palette?
Thank you very much.
Solved! Go to Solution.
2022-11-12 07:25 AM
If you get a pointer to a listbox in C++, then this works:
SingleSelListBox *lb;
lb->SelectItem(item);
DG::ItemSelectionChangeEventArg eventarg;
lb->onSelectionChanged.NotifyAll(*lb,eventarg);
2022-09-14 11:04 AM
Hi!
I also can't find the DGSendMessage function although it's documented. This is weird. But it has the same signature as the DialogHandlers itself. So you could just call the DialogHandler of the palette directly; that's actually something I've already used before:
DialogHandler (DG_MSG_CHANGE, dlgID, itemID, msgData);
msgData can be "anything" if you don't use it in the DialogHandler. Otherwise you can check the used values in the documentation of the Dialog messages.
Hope that helps,
Bernd
2022-09-16 12:25 PM
As bschwb says
Give up sending the message itself,
Although it is not DialogHandler, I achieved my goal by calling the target function directly.
Thank you for taking your precious time to reply.
However, it is described in the DialogManager item of the manual (e.g. RadioButton.html)
Messages like DG_MSG_CHANGE and DG_MSG_DOUBLECLICK are the mystery.
For example, in the case of RadioButton, when the button is pressed, instead of PaletteAPIControlCallBack RadioItemChanged is called.
Where can I receive DG_MSG_CHANGE when this radio button is operated?
This may be an immature question. very sorry.
2022-09-19 12:09 PM
If RadioItemChanged is called, then you are using the newer "C++" class style of UI handling for your palette.
From your previous question I wrongly assumed that you were using the old "C-style", Sorry!
I cite myself from a different answer to clarify further:
There are 2 "styles" of handling Dialogs and their items. The "older" C style (which is decently documented in the offline documentation.). This style uses Handlers and you need to register them. As a contrast there's the "newer" C++ style which is less documented unfortunately. Here you create Classes/Objects for your Dialogs, Items etc. Instead of Handlers you work more with Event Observers. It's a rough distinction but I hope it helps anyway.
So in your case I think you are using the newer C++ style. So the DG_MSG_CHANGE messages etc. are not really relevant. I would recommend you stay completely in the C++ Style and use the correct observer classes and events.
So instead of receiving DG_MSG_CHANGE, you work with the RadioItemChanged method. And instead of receiving DG_MSG_DOUBLECLICK you work with the RadioItemDoubleClicked method.
Feel free to ask further questions if this doesn't help.
Bernd
2022-09-20 11:24 AM
bschwb
Thank you for your reply.
I didn't know there was such a thing as the old "C-style"
I posted with too little information.
I'm sorry.
However, I was able to know that such a thing exists through this exchange, and I learned a lot.
The purpose itself was achieved by the first response I received.
As you said, I will continue to use the new "C++ style".
Thank you very much for your kind reply.
2022-11-12 07:25 AM
If you get a pointer to a listbox in C++, then this works:
SingleSelListBox *lb;
lb->SelectItem(item);
DG::ItemSelectionChangeEventArg eventarg;
lb->onSelectionChanged.NotifyAll(*lb,eventarg);
2022-11-12 01:32 PM
LABPP
I tried it with my own code and it certainly worked.
It's a function that's not even in the manual, so I'd be very grateful if you could let me know.
I would like to try this method as well.
Thank you.
2022-11-16 09:32 AM - edited 2022-11-16 09:34 AM
Hi, Satoshi!
In the documentation for API Archicad 17, there was still a full description of dialog classes and control elements in dialogs.
If necessary, I will send.
Some new changed properties have to be seen in .hpp files.
2022-11-16 01:16 PM
LABPP
I am very grateful for that.
Please by all means.
2022-11-16
03:05 PM
- last edited on
2022-11-20
06:03 PM
by
Laszlo Nagy
Satoshi, send me Your email to mail [at] labpp [dot] ru