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.
Related
I'd like to create a custom drag and drop template so I can increase the design possibilities without losing the functionality. I can't find anything in their documentation.
I was hoping to create something like this, not sure if I'm missing something obvious but I can't find a drag and drop that allows for the different coloured background with columns too.
I could use a block of code but I can't edit the css styles so it wouldn't be responsive for mobile and also not very friendly for those who don't know html.
Rather old question, but to who it might be helpfull:
If you code your own template and upload it to Mailchimp you lose the 'drag & drop' system/UX interface with the different blocks. You are able to create repeatable blocks but then it works with a dropdown list. This is (in my humble opinion) not that user friendly and takes a while before you fully understand how to use the dropdown. I had to explain it to a client earlier today and took a while before they understood it, so I decided to write them a manual for it.
But the design you want to create should be possible to make with a standard MC template. In the 'design' tab you will find settings to control background colors etc.
Still not possible, answer from the Mailchimp support: "At the moment, it's not currently possible to code a drag and drop template completely--one of our drag and drop template layouts will need to be selected, but you can drop in Code blocks to get a little more control over the styling of certain sections."
Though, if it's any help, it is possible to fully custom code your own template, and then add in mailchimps special Template language to the template to open up sections as editable within the campaign builder--or even duplicate certain sections of content. It's not quite the same as the drag drop templates, but adds similar functionality. More info on working with template language can be found here: https://mailchimp.com/help/getting-started-with-mailchimps-template-language/
I know this is an old question, but while searching for this myself I stumbled upon a solution posted here.
Basically it is possible to code your own drag n' drop template, but the solution has not been documented.
Find one of the Mailchimp templates (either one of the basic templates or a custom template from the 'Themes' menu.
Use 'Inspect element' and copy the source code of the iFramed html-email.
Paste in your preferred HTML-editor and modify as intended
Create your own template from the 'Paste in code' mode
If you want custom modules to be added by default, edit using the menu 'Edit design' in the bottom of the screen.
Save and exit :)
I found part of the answer on another topic: [Is it possible to code drag&drop templates for mailchimp?
If you add the following code into your main content div or td it will enable the drag and drop block editor:
mc:container="body_container" mccontainer="body_container"
example:
<div mc:container="body_container" mccontainer="body_container"></div>
This code will add a block editor region to the preheader section:
mc:container="preheader_container" mccontainer="preheader_container"
For the header:
mc:container="header_container" mccontainer="header_container"
For the footer:
mc:container="footer_container" mccontainer="footer_container"
Note: It doesn't seem to matter what you call the mc:container. Creating a new container with a different name worked. Although using just mc:container tag seems to work at first by itself, the mccontainer (no colon) tag is required for it to save properly.
You can create your own drag and drop template you need to add the following into your html coded template where you want the 'drag and drop' feature to exist.
<div id="templateBody" mc:container="container_name" mccontainer="container_name" class="tpl-container">
<div mc:block="3502204" mc:blocktype="text" mcblock="3502204" mcblocktype="text" class="tpl-block"></div>
</div>
This can be repeated in your code multiple times for multiple insertions. I could not find documentation to indicate if the container name or block number needs to be unique, I did make it unique in my template.
I am implementing a gui using perl/tk.
I wish to hit OK button after filling values in entrybox on my first window. Now after hitting OK button another window will popup with some new entry fields. In the same way, if again hitting OK button it should open another new window till the finish button comes.
And there should be a previous button too to go to the previous window.
How can this be implemented?
Tk::NoteBook can be helpful here. It shows a progression through the windows with the tabs so the user can tell how far they are. Pages can be set to 'disabled' so the user can't switch to them without using your [Prev][Next] buttons (making sure that your code gets run on each page flip).
A quick example:
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::NoteBook;
my $mw=MainWindow->new();
my $nb=$mw->NoteBook->pack(-expand=>1,-fill=>'both');
my $page1=$nb->add('page1',-label=>'Start');
my $page2=$nb->add('page2',-label=>'Finish',-state=>'disabled');
$page1->Button(-text=>'Next',-command=>\&next_page)->pack;
$page2->Button(-text=>'Exit',-command=>sub{exit;})->pack;
MainLoop;
sub next_page() {
$nb->pageconfigure('page2',-state=>'normal');
$nb->raise('page2');
$nb->pageconfigure('page1',-state=>'disabled');
}
I'm assuming you know how to create windows with Tk and you are not expecting someone here to code it for you with that question.
That being said, you should create a class to do this with an instance of that class. The instance can hold any properties (or several values in a single property) and your Tk application can work with that instance to assign any new values and be able to read them back if you need to go back/forward in your process.
As for the Tk application, you can create a sub that uses your class instance and a step number as arguments, or you can create another class to control the right step in another property and trigger the right method according to the current step or any signal of "next" or "previous" buttons.
See this Tk tutorial, is very good. You can Google for more Tk examples.
See this Perl OOP tutorial to lean the basics about creating classes and object oriented programming in Perl. Again, you can Google for more on the subject.
Also, if you're feeling like learning a lot more and creating really nice and much more modern GUIs in Perl, I would highly recommend looking into Alien::wxWidgets, which is a CPAN library for the wxWidgets Project.
HTH
Francisco
user1468315 asked:
How can I set a entry field value to be empty on hitting clear button?
I believe something like this should do it.
$entry = $mw->Entry()->pack;
$button = $mw->Button(
-command => sub{$entry->delete(0, 'end');}
)->pack;
GWT's Editor framework is really handy and it can not only be used for editing POJOs but also for read-only display.
However I am not entirely sure what the best practice is for doing inline edits.
Let's assume I have a PersonProxy and I have one Presenter-View pair for displaying and editing the PersonProxy. This Presenter-View should by default display the PersonProxy in read-only mode and if the user presses on a edit button it should allow the user to edit the PersonProxy object.
The solution I came up with was to create two Editors (PersonEditEditor and PersonDisplayEditor) that both added via UiBinder to the View. The PersonEditEditor contains
ValueBoxEditorDecorators and the PersonDisplayEditor contains normal Labels.
Initially I display the PersonDisplayEditor and hide PersonEditEditor.
In the View I create two RequestFactoryEditorDriver for each Editor and make it accessable from the Presenter via the View interface. I also define a setState() method in the View interface.
When the Presenter is displayed for the first time I call PersonDisplayDriver.display() and setState(DISPLAYING).
When the user clicks on the Edit button I call PersonEditDriver.edit() and setState(EDITING) from my Presenter.
setState(EDITING) will hide the PersonDisplayEditor and make the PersonEditEditor visible.
I am not sure if this is the best approach. If not what's the recommended approach for doing inline edits? What's the best way to do unit-testing on the Editors?
If you can afford developing 2 distinct views, then go with it, it gives you the most flexibility.
What we did in our app, where we couldn't afford the cost of developing and maintaining two views, was to bake the two states down into our editors, e.g. a custom component that can be either a label or a text box (in most cases, we simply set the text box to read-only and applied some styling to hide the box borders).
To detect which mode we're in, because we use RequestFactoryEditorDriver (like you do), we have our editors implement HasRequestContext: receiving a null value here means the driver's display() method was used, so we're in read-only mode. An alternative would be to use an EditorVisitor along with some HasReadOnly interface (which BTW is exactly what RequestFactoryEditorDriver does to pass the RequestContext down to HasRequestContext editors).
Yes,Presenter-View pair should be. But Here two ways to achieve this feature if you like to go with:
1) Integrate Edit/View code design in one ui.xml i.e.Edit code in EDitHorizonatlPanel and View code in ViewHorizontalPanel.The panel has different id. By using id, show/hide panel with display method. if getView().setState() ==Displaying then show ViewHorizontalPanel and if getView().setState()==Editing then show EditHorizontalPanel.
2) Instead of using labels, Use textboxes only. set Enable property is false when you need it in view mode otherwise true
You have created two Presenter/view but I think if Edit/View function has similar code so no need to rewrite similar code again and again for view purpose.
If a big project has so many Edit/View function and you will create such type of multiple View/Presenter than your project size become so huge unnecessary.
I think that whatever I have suggest that might be not good approach but a way should be find out which help to avoid code replication.
Im new to GWT, this should be a simple question i hope.
Imagine that i made two Uibinders Modules or two independent widgets.(this a simplify example to expose my problem)
one is a set of buttons (ButtonPanel) and the other image to been show when i press a button from the previous panel(ImagePAnel) with a label to be the title of the image.
How can i reach the wiget the imagePanel to actuate when there are a handler click from the buttons in the (ButtonPanel)
Thanks for the help.
I recommend you to use MVP Pattern for Development and add all events in the Presenter.
Or Else you can use the following technique within the UIBinder's Java File
#UiHandler(value={"openButton"})
public void onOpenButtonClick(ClickEvent clickEvent){
//ADD THE BUTTON LOGIC HERE
}
Just Create an Object of the Images & the ImagePanel to be loaded and add it on button click using this.
I can't say I understand exactly what you are trying to accomplish but in general the best way for different components in a GUI application to communicate is to use the eventbus pattern. There's one global Eventbus object in the application that lets components subscribe to a specified type of event that are fired from any place in your application. This way you avoid spaghetti code and your components are loosely coupled.
http://code.google.com/webtoolkit/articles/mvp-architecture.html#events
I typically create a third component that is the container for the Button and Image components you defined. This component sets itself as a callback for the two and contains logic to integrate the two.
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