How do GUI builders work? - gui-designer

I'm curious, how does a GUI builder/designer work? My guess ( for Java ), is that it actually creates a JFrame and overrides the events in some way. However, this is only a guess.
Can you offer some insight?

You are pretty much bang on ...
In Glade the fake-window that allows you to drag-and-drop components handles your mouse/keyboard events and makes the backend calls to put the GUI elements in place. These elements are then attached to handlers such as 'on click of button, goto the source element'
It is all pretty trivial when you think about it.
Looking at the glade source might give some insight into how that is done.
IIRC, Glade writes the XML and then renders that to the designer using libglade, rather than your d'n'ds actually creating the elements. Your events build XML files which contain the UI elements and internal designer handlers.
Good Luck

Related

eclipse RCP4 Add Toolbar to Parts

How to model a toolbar ONCE and render it in some Parts/Views (not in the default place which is the window!)? Using the model level (and maybe Addons?)
I have currently
Eclipse 2022.03-4.23
Application.e4xmi with that Toolbar but
Gets added dynamically using an Addon that listens to "PART_ADDED" event topic which
Leads to a NPE due to other event topic "UIEvents.Part.TOPIC_TOOLBAR" within a framework method in a class called LazyStackRenderer
So the guy before me had written an Addon to dynamically add the Toolbar to the parts. Maybe to make the buttons save/print per part or because the main layout has two stacks and only the parts stack is relevant.
Appreciate any help! I searched a lot but no success!
I solved it so far. The dynamically created MParts were not added as children to the container (in my case the PartStack) in the first place and also had to comment the adding of placeholder objects that carry the same information of the parts. This dynamic step was done as a reaction to the topic #UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) in some written Addon.
I am not a 100% sure that discarding the placeholders is safe but still this is the best trail I have ever reached.
I hope this would help others!
Thank you #greg-449

How to edit transformer as javascript script in Mirth (rather then as individual steps)?

How to edit transformer as javascript script in Mirth (3.10) (rather then as individual Mapper steps constrained by the building block UI)? I can see that the primary UI for each step is generating JS code and I'd like to play with that code directly (eg. have a single script that composites all of the JS Transformer logic). (Am totally new to using Mirth)
Eg. I want to set output message values as more complex values than those that can fit in a a single line of javascript available in the primary Transformer UI and be able to organize steps beyond continually clicking the "move step up/down" menu button.
The only thing I've seen so far as managing the Source Transformer on a more controlled level is exporting the XML (I'm assuming this is not how people are meant to interact/edit with the transformers).
I see the scripts tab in the main Channel UI, but IDK how to make that "connect" / act for the Source Transformer (scanned over the user manual, but was not able to figure this out yet).
Anyone with more experience know how to do this? Any links that could explain / show?
In a transformer, you can add a new step (right click in a blank space or with the menu in the left bar), then you can change the type of the new line to "JavaScript"
(screenshot here)
Then, the space in the bottom changes to a blank page where you can type your JavaScript code.

Show UserControl in Form VB6

I want to show the UserControl into the form, this means i need a single form to perform like multiple form See this image for details:
Can someone help me how to?, and one again, what's the type must i choose to use the usercontrol (Standard EXE, ActiveX EXE, or else).
NOTE: Please DON'T close this question, i just want to know. and thanks.
1- Close UserControls in your designer to made them available in toolbox.
2- Drag & Drop them on your main form, made them same size...
3- Use code like this for your operations:
Private Sub Operation1()
UserControl1.Visible = True
UserControl2.Visible = False
End Sub
Private Sub Operation2()
UserControl1.Visible = False
UserControl2.Visible = True
End Sub
[Choose UserControl type!]
The simplest way, albeit terribly inelegant is to add all the controls to the form and set their visible state as required. THis is normally considered to be somewhat of a kludge though.
The problem lies not with the user controls or programming environment but that the design does not follow a typical Windows UI 'flow'. You might want to redesign based on a more useable workflow.
It's possible that you're simply asking how to use UserControls in a VB project, if so then you should develop the UserControls in one project, make it (so that they get added to the toolbox), and then develop the form in another project using the new UserControls from the Toolbox. For debugging Usercontrols you will need to run two instances of VB, one with the Usercontrols project and the other with the form.

SWT needs to much lines of code

I wondering why swt is so inconvenient to use. We as programmers have to produce tons of unnecessary source code. Here an example.
Label label = new Label(parent, SWT.NONE);
label.setText("labelname");
The minimum would be like this:
createLabel(parent, "labelname");
I build up a convenients library and I would like to know if there is something similar or why SWT or JFace don't go this simple way. Is there any drawback in having some more constructors that cover 80% of the programming task.
Have a more detailed look what I have done.
SWT: More Convenients Please
I suggest trying Google Window Builder Pro. It is a plugin for Eclipse that allows for the graphical development of GUI's in SWT, Swing, RCP, JFace and others. GWB writes the code which specifies the GUI layout and all you must do is write code to handle events.
As far as I know there is no such generic library. The one instance which provides some basic factory support for swt control creation is JFace Form Widget. Also have a look at this org.eclipse.ui.forms.widgets.FormToolkit.
From your implementation it appears that you are assuming the GridLayout as the default layouting style. Apart from that a control may have many layout related data like, its indentation (horizontal and vertical), span etc. Which is not easy to cover with factory methods.
If you don't want to put in the extra effort of writing the code for layouting the widgets and all then have a look at the Visual editor at http://www.eclipse.org/archived/.
Also, eclipse itself is moving towards the the Model Driven Generation (http://www.eclipse.org/e4/). It won't be a wonder if we will see a Netbeans like UI designer for SWT (by the way i have written a version for our tool using eclipse modelling framework and GEF).
Still I would suggest you to write the mundane layouting code by hand because it will improve your SWT understanding.
Bytes are very cheap to produce, and I'd debate that SWT "is so inconvenient to use" - well if it's automatically producing it, how is that inconvenient ?
Our computers are so fast that we couldn't even perceive the difference... and time saved is huge.

How do I use an SWT Control to render the content of an SWT/JFace table?

I have a JFace TableViewer with an SWT Table, and I would like to custom render the content of some cells. I would like to use an SWT Control to render the cell content.
I would prefer to have only one instance of the Control doing the rendering, but if I have to instantiate one for each row, that would be acceptable.
Next, the solution MUST be compatible with the ContentProvider/LabelProvider approach (I am using EMF). This means that I cannot use the solution described in Sniplet 126 (http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets).
Next, I though about using custom drawing. But here the catch is, that I have to send individual drawing operations to the graphics context. I was trying to have the Control render the content for me by calling redraw() or print(GC) upon SWT.PaintItem, but that just lead to uncontrollable flickering.
At this point, my best guess is to use SWT.PaintItem to do the drawing. This will result in duplicate code, as I already have a Control that can render the content the way I'd like it. I'd like to prevent this redundancy.
Any help is appreciated!
Well, after banging my head against a wall several times I made some progress. Specifically, I found this formu entry:
http://www.eclipsezone.com/eclipse/forums/t115489.html
It actually offers two solutions: The first solution actually uses widgets (not recommended due to performance, but I knew that before). I will try this out, and may post here how it goes.
The second solution suggests using StyledCellLabelProvider. I looked into this before, but it isn't powerful enough for my purposes. At least that's what I think right now.