The geretated enums for windows and controls should be customizable #982
Replies: 19 comments 5 replies
-
My inclination would be to add a class FirstPanel
{
enum
{
BUTTON = wxID_HIGHEST + 1,
EDIT_CTRL,
CHECKBOX
};
class SecondPanel
{
enum
{
BUTTON = wxID_HIGHEST + 4,
LISTBOX
};
class ThirdPanel
{
enum
{
BUTTON = wxID_HIGHEST + 6,
}; As long as you used a single project for all the forms, and void ButtonHandler(int btn_id)
{
switch (btn_id)
{
case FirstPanel::BUTTON:
doSomething();
break;
case SecondPanel::BUTTON:
doSomething();
break; The source code for the handler function would require an |
Beta Was this translation helpful? Give feedback.
-
Thank you @KeyWorksRW Excuse me, I think your approach has got a lack of vision. In case of a monolithic project it could work, but in case of projects which depends on other libraries or shared code, it is affected by the same probably issue. Regards |
Beta Was this translation helpful? Give feedback.
-
I'm planning on adding a per-form property that allows you to set the initial value, but I would like to also add methods that are less error-prone for someone's project, especially in a case where there are multiple people working on that project. The issue with manually adding the initial id, is that you cannot reliably predict the order that the enums will be generated. That means you absolutely must:
Both of those are risky for a long-running project where maintenance by someone less familiar with the code can be a problem. It also requires coordination between devs if there are multiple people working on the project. Letting the RAD tool create unique id values avoids both of those problems, but only if the entire UI is contained within a project. As you noted, that is not always going to be the case, hence the need for setting that initial value. The other thing I was thinking about adding is special handling of an id when a '=' char is part of the id. For example, say the user specified an id of static const int myid=100; That allows you to ensure that the id has an exact value, rather than relying on the initial enum id plus whatever offset due to where your id got generated in the enum list. All of this would give you four different approaches to an id's value:
|
Beta Was this translation helpful? Give feedback.
-
Once again thank you @KeyWorksRW, your attitude to listen to proposals is much remarkable. Indeed you are correct, it's up to the "project manager" handle such kind of coordination among developers, in order to keep a solution tidy and "problems free". Your proposal would be very welcome and appreciated, especially the idea to use constants instead of enums Nowadays, in my opinion, there is only a RAD tool able to handle large projects, it is "DialogBlocks" |
Beta Was this translation helpful? Give feedback.
-
By any chance do you have an existing reasonably large DialogBlocks project file that you could either point me to on the web or attach a zip file here? I've found and used active project files for the other RAD tools, but I never found a good reference version for DialogBlocks. That leaves me guessing as to how it's used, and since I don't use it myself, I never noticed the way they handled ids. I've been experimenting with their prefix/suffix, but I have yet to get it add those to any new ids. It probably makes sense if I add a custom editor as an option for the id property. When chosen, wxUE would display a dialog giving a variety of choices of how to create the id. I suspect most people don't even realize that the existing property control has an auto-complete for all wxWidgets ids -- adding that to a dialog would make it a lot easier to discover. You could then choose between stock id, enumerated id, fixed id (static const int), fixed value, a choice of prefixes/suffixes (i.e., support more than one prefix/suffix), etc. You'd still be able to simply edit it directly in the property box, but this would make it easier to discover all of the options that are actually available for ids. |
Beta Was this translation helpful? Give feedback.
-
Issue ##984 created for enhancing ids per this discussion. |
Beta Was this translation helpful? Give feedback.
-
The ID Editor is now in place and working. However, there are a few things about the ID Editor dialog that are potentially confusing. These will make more sense once the beta is available and you can actually interact with the dialog. I'm adding them to this discussion because except for 4, I don't currently have any ideas for resolving the potential confusion.
|
Beta Was this translation helpful? Give feedback.
-
Kind @KeyWorksRW Excuse me, but I didn't understand the way you have taken. I reckon for your RAD tool, it is necessary a kind of parameterization based on which the user can select how window controls IDs will be generated. Here is my idea ... Genetated code for: enums && Auto increment
Genetated code for: enums && Auto increment && custom starting ID
Genetated code for: enums && custom ID
Genetated code for: constants && Auto increment
Genetated code for: constants && Auto increment && custom starting ID
Genetated code for: constants && custom starting ID
|
Beta Was this translation helpful? Give feedback.
-
If it will be possible to obtain the code below in a single header, I think you did a great job.
or
|
Beta Was this translation helpful? Give feedback.
-
Beta 1.1.1 is now available and includes this change. |
Beta Was this translation helpful? Give feedback.
-
kind @KeyWorksRW, I couldn't wait to test this feature ... I have a clarification to ask, regarding the prefixes management. ... let's say, it's not a big deal, it's a behavior that must be known. |
Beta Was this translation helpful? Give feedback.
-
I'd be concerned about an automatic renaming changing the wrong thing, but adding the functionality to do this with more control over what is and is not changed would be useful. It also ties into another change I'd been thinking about which is a way to automatically add prefixes and suffixes to all custom IDs, but with the ability to limit that change to specific forms, or all the forms in a folder. I've created issue #1017 as a way to deal with both renaming and automatic naming. |
Beta Was this translation helpful? Give feedback.
-
The 7/11 daily build should contain a new menu command on the Tools menu that will let you edit multiple custom ids at once (removing or setting prefixes and suffixes). Modifications can be limited to a single form, all the forms in a folder or every form in the entire project or anything in between. I'm hoping that's not going to be overly confusing. I tried several iterations of the UI before coming up with the current one, but I'm still a bit concerned about someone using it for the first time to be overly confused about how it works. If you have the time and are comfortable grabbing any daily build from 7/11 on, I would be greatly appreciative of your feedback. |
Beta Was this translation helpful? Give feedback.
-
Thank you @KeyWorksRW I have tried it and I didn't find it confusing or other. The "OK" button should be removed and perhaps even the "Preview Changes" button could be removed; using list events, text controls events and combo events you should be able to update "Preview Changes" without a user interaction. |
Beta Was this translation helpful? Give feedback.
-
Thanks for checking this out! I like the grouping of the prefixes and suffixes vertically instead of horizontally, and will make that change. The reason for the button is that it allows you to make multiple changes to different collections of forms without having to open up the dialog box again. My thinking was that it would be really annoying if you had a dozen or so folders, and wanted to set a different prefix for all the forms in each folder. It would be annoying to have to re-open that dialog a dozen times. What I'm not sure is how likely that scenario would be. From what you've told me previously, you have a lot of custom ids in your project(s). Which would you prefer -- running the dialog once to make multiple different prefix/suffix changes in different groups, or run the dialog multiple times if needed? The reason for the Preview button is that the changes you make in the 4 text boxes don't show up unless you press enter. I didn't want to refresh that grid every time you typed a character (I suspect that would cause a lot of flicker if one was trying to edit the entire project with hundreds of custom ids). The preview button means you can tab or click and make all the prefix/suffix changes you want without the grid changing until you press the Preview button (or the Commit button if you don't care about previewing the changes). I have redesigned the layout of the dialog -- it should be in tonight's daily build. |
Beta Was this translation helpful? Give feedback.
-
Thank you
I understand your doubt, any way I'd prefer to reopen multiple times if needed, as it is very rare to adjust IDs one time for the entire project
Yes, you are right about it, I agree with you that buttun must be kept
I'll take a look |
Beta Was this translation helpful? Give feedback.
-
Kind @KeyWorksRW I think you did an excellent job. |
Beta Was this translation helpful? Give feedback.
-
This is the last critical item that's going into the 1.1.2 release.
Initially, wxWidgets 3.2.3 was going to be released on July 7th, but that's
been delayed. I'd like to pick that up if possible, but if it gets delayed
past this coming weekend then I'll post a release without it.
…On Tue, Jul 11, 2023 at 11:32 PM ROSSANO PARIS ***@***.***> wrote:
Kind @KeyWorksRW <https://github.com/KeyWorksRW> I think you did an
excellent job.
Indeed you can release that features as they are, I mean "Preview button"
and "Commit Change"
—
Reply to this email directly, view it on GitHub
<#982 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKGN3UZ7OEYDIJRQCJPT363XPZAIPANCNFSM6AAAAAAXQYS3PI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You are always welcome to open a discussion about anything to do with
wxUiEditor, whether it be layout, code generation, or anything else. While
I may not implement every suggestion you make, I will definitely consider
any suggestion.
…On Wed, Jul 12, 2023 at 6:48 AM ROSSANO PARIS ***@***.***> wrote:
It sound good, but please don't rush for me, perhaps it would make sense
waiting for the next wx release ...
A part this, I'd have ather suggestions regarding the application layout,
may I open another "discussion" about it ?
—
Reply to this email directly, view it on GitHub
<#982 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKGN3UZO4EJRAT2GWNHAXPTXP2TL5ANCNFSM6AAAAAAXQYS3PI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I try to explain my self.
We must consider the scenario described with the following sketch.
In this scenario my aim is to catch wxButton events which are defined on three different wxPanel, using a unique function defined in their parent class.
Actually this is not permitted as windows IDs are always declared in this way:
PANEL1
PANEL2
PANEL3
Considering to use a single function in order to catch events from those buttons is not achievable, as the control ID has got the same value for all three buttons.
Of course there are different way to work out this kind of issue, alas all of them require to write uselessly code.
Try to imagine instead of having three buttons we have tens of them.
Anyway the natural way to solve it is to define different IDs values instead of writing code which seems a work arounf and not a linear approach.
Best regards
Rossano
Beta Was this translation helpful? Give feedback.
All reactions