Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Getting started with the latest ui_extension API (Read 3324 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Getting started with the latest ui_extension API

I'm really struggling with the new ui_extension API. I actually managed to create a panel with the previous version, but now I'm totally lost. Ok, the last time I did actually do a whole lot of copy&paste and find&replace, but it worked, and I learned alot from it.

What I'm trying to do at the moment, is merging foo_static_panel and foo_vis_vu_meter to make a VU meter panel. The problem, is that I can't find anything useful to look at. It's jsut not enough consistency between different ui extensions. Either they're too different (toolbars vs panels, single instance vs multiple instance), or too simple or too complicated. There is just no simple panel that actually do something, but at the same time not everything imaginable.

I realize I'm probably in over my head here, and I'm not really familiar enough with the terminology either, but I'm sure I could make things work if I just had a plain and simple panel to look at. Having said that, foo_static_panel is just too simple, as it doesn't do anything that I find useful, and the "static" part of the name just adds to my confusion, as that is also a reserved word.

The favour I would like to ask instead of a posting alot of questions, is if anyone could just add a single button to foo_static_panel and make it perform one simple action. Like changing the text "moo" to "moomoo" or something. Just to show me how the resource file is utilized in combination with the new new ui_extension API (I don't really need this kind of interaction to make a vu_meter panel, but I think it would help anyway).

Two specific questions:
1) Most of the things foo_vis_vu_meter does, it does using "g_wnd" as a parameter (a window handle?), defined at the start of the code. I really don't see the equivalent in foo_static_panel. Meaning I need the link between the vu_meter code and my panel or something (what should I use instead of g_wnd?).

2) Should this be a toolbar or a panel? Or is visualizations it's own category? I'm talking about in the code, not just where it is placed in e.g. the context menu.

Some random thoughts/plans:
-I would like my panel to support multiple instances for future use.
-Not support dock/undock, as it complicates things.


If you've read this far, thanks!  Last but not least, I just want to state that I don't want anyone to provide me with the finished product (vu_meter_panel). I just need to get the basic structure of a multiple instance panel, with simple functionality, established.

Getting started with the latest ui_extension API

Reply #1
A fairly simple, yet useful panel is the history toolbar in foo_history. The drawback is that it doesn't use a dialog template but a toolbar control.

Quote
1) Most of the things foo_vis_vu_meter does, it does using "g_wnd" as a parameter (a window handle?), defined at the start of the code. I really don't see the equivalent in foo_static_panel. Meaning I need the link between the vu_meter code and my panel or something (what should I use instead of g_wnd?).[a href="index.php?act=findpost&pid=269540"][{POST_SNAPBACK}][/a]
Firstly, I'd advise you to use the UI extension implementation helper, in the create_window method you'd have to call the function that creates the VU meter dialog. You have to remove the border and make the dialog a child dialog in the resource editor, look at dialog templates for config pages, if you need an example.

Quote
2) Should this be a toolbar or a panel? Or is visualizations it's own category? I'm talking about in the code, not just where it is placed in e.g. the context menu.[a href="index.php?act=findpost&pid=269540"][{POST_SNAPBACK}][/a]
Visualizations should be placed in the "Visualizations" category. As for the extension type, I'd make a visualization have both the TYPE_TOOLBAR and TYPE_PANEL flags, or only TYPE_PANEL if its height exceeds the normal toolbar height by a fair amount. The VU meter dialog template would not fit IMO; however if one would show only one of the bars without the labels below, then it would fit.

Quote
-I would like my panel to support multiple instances for future use.[a href="index.php?act=findpost&pid=269540"][{POST_SNAPBACK}][/a]
Slightly more complicated, as you'll have to multiplex the visualization service. To do so, remove the global HWND variable, and replace it with a list of handles of active windows. Then update the windows in this list from the visualization class using uPostMessage.

Quote
-Not support dock/undock, as it complicates things.[a href="index.php?act=findpost&pid=269540"][{POST_SNAPBACK}][/a]
Also not really needed IMO.

Getting started with the latest ui_extension API

Reply #2
Thanks so much for your answer. I wouldn't say I understand this now, but at least I think I'm getting closer to having a piece of code that will actually compile. Probably just to discover that it doesn't really work at all, as I'm struggling with how to create my window/dialog/toolbar/panel (as you probably understand, I don't really know what I'm doing, or what I'm looking for).

Anyway, at the moment I get the following error using your UI extension implementation helper:
Code: [Select]
error C2065: 'UET_TOOLBAR' : undeclared identifier

at this line
Code: [Select]
class toolbar_extension_history : public ui_extension_base_t< UET_TOOLBAR, UEM_MULTIPLE > {

Any idea?

Getting started with the latest ui_extension API

Reply #3
There is a newer version of said helper class in recent versions of the UI extension API; among other things the names of some flags have changed.