Load an ExtJS form - extjs

I have a Simple Extjs form1 with several textfields and a button.
When i click on the button on form1,a form2 is Popped open.
The problem i am facing is, i cannot get the values from the form2 into form1, unless form2 is instantiated.
Is there anyway i can load/instantiate the form2 before form1 so that i can get the values from the form2,using Ext.getcmp('id') into form1?
Being a novice in Extjs, i hope my question is Not vague.

You can pass the inputs from form 1 into form 2 as a config property. Then this data will be available during the initComponent method call in form 2, when the form is being created. During initComponent, simply make the fields visible/hidden based on the data that was passed in.

Related

How to dismiss current form in codenameone?

Hi i'm new to codenameone and now i stuck with two issues those are
How to dismiss current form in codenameone?
It means that in my sample i've three screens and when i click on button in Form1 it navigates to the Form2 like that Form2 to Form3 also. now when i click back button on Form3/Form2 i want to dismiss current form. so for this i've tried "showBack() method" but its not working.
So could anyone help me for this? and
How to show Calendar in Current form?
I want to show Calendar in current form but i've tried multiple samples but in all samples when i click on button they taking to another screen(i.e. Another Form). so how to resolve this also?
These are my questions if anyone has idea please help me..
Sorry for my poor English..
Thanks in advance..
Form.showBack() is almost the same as Form.show(). It uses the back transition instead of forward one.
For your case, you have to call showBack() on the form that should be displayed.
Example:
Form1 is currently visible
Form2.showBack() is executed
Form 2 will be shown with a back transition
For question 2: form.add(new Calendar(new Date().getTime()));

Lightswitch modal window

I've got standard CreateNewEntity screen. Entity can contain list of entities of some other type. By default there is an add button that opens modal window when user wants to add another entity into collection. However, default modal window was lacking some of the needed functionality so I've done a bit of research. Turns out that default modal screens cannot be modified. So, I found a nice custom modal window helper class. The problem is that I can't seem to be able to access modal window fields in order to enforce needed logic. There are two dropdown lists that are associated. Change in one will result in limiting the other dropdown list options. I'm stuck at this particular part:
var proxy = this.FindControl("DodavanjeParcele");
proxy.ControlAvailable += (s, e) =>
{
var ctrl = e.Control as System.Windows.Controls.Control;
//how to obtain access to ctrl fields?
};
"DodavanjeParcele" is custom modal window. Before this, modal window is instantiated and initialized. It pops up after button click and functions as expected. The only thing missing are above-mentioned rules. I need to set change event handlers for modal window fields in order to define rules. As seen above I tried to cast IProxy as a standard Windows control. This is where I got stuck. I can't seem to find a way to access control fields and set event handlers. Any thoughts?
If I understand you correctly, I'm not sure why you need to search through controls or cast anything.
Control1 is an entity which creates an AutoComplete Box (dropdown list). That selection is copied into a local property in the Control1_Changed method. That property is used as a parameter in a filter query to create Control2.
C#:
private void Control1_Changed()
{
this.MyLocalProperty = this.Control1.SelectedItem;
}
VB.NET:
Private Sub Control1_Changed()
Me.MyLocalProperty = Me.Control1.SelectedItem
End Sub
Just make sure you have Auto Execute Query checked in Control2's Properties and the second control should update and filter when Control1 changes the query parameter.
The code in my screen shots all takes place inside of Yann's Modal Helper so there is nothing special you need to do.

How to open a form from a Dialog (modal form) and make it accesible even if didn't close the dialog

I have a form (form1) that I open as modal. In that form there is a button where, when the user presses it, it opens a new form (form2).
I have the problem that form1 is modal and form2 is in the background, and I cannot do anything until I close form1. How can I do stuff in form2 without closing form1?
I need form1 to be modal, I cannot change that. I tried to set the parent of form2 when calling it:
form2.Parent = form1
form2.Show()
But it gave me an error:
"Form cannot be added to the Controls collection that has a valid MDI
parent. Parameter name: value"
So I tried this:
form1.IsMdiContainer = true
But this just puts form2 inside form1. I also tried hiding form1 and then showing it again when form2 is closed, but it fails.
Platform: Windows Forms using VB.NET.
The problem I was having was that it was setting the parent of form2 as the mainform, so I deleted that part and now form2 opens on top of form1.
Another solution that also works is to open form2 as modal. Of course it will act different, but that depends on what you want.

WPF trigger code behind button to display second form

I am a WPF novice.
I have created a form containing a combo box with which to choose a multi-field key value(populated from an XML data file).
I have also created a second WPF form which is available to display all field values from the record associated with the multi-field key value chosen from the first form.
I need to be able to click a button which will cause the second form to be displayed, with all fields filled in which are associated with the chosen key field values.
How do I go about writing such an event trigger using C#?
couple of steps (this is not really MVVM, BTW) ...
first, add a click handler to your button
second, in the click handler code, instantiate your new form
third, set the data context, etc for the new form
forth, show the new form by calling .Show()
in your xaml add a click handler to the button in question....
<Button Click="myClickHandler"/>
in visual studio, you can right click the text in the click="" and choose to navigate to the handler and visual studio will generate the code for it for you.
in your click handler, in code behind, do something like this....
public void myClickHandler(object sender,EventArgs)
{
MySecondForm form = new MySecondForm();
form.DataContext = theDataContextIWantToSet;
form.Show();
}

Move one form to another winforms - C#

I have 2 winforms Form 1 and Form 2. I have button1 in form1, when i click on button1 from form1 i display form2.
Form2 ins = new Form2();
ins.MdiParent = this.MdiParent;
this.Hide();
ins.ShowDialog();
I hide the form1 to display form2 when button1 is clicked. This creates a flicking effect and i need to remove this flicking. How do i open/redirect to another form (i am supposed to show only one form at a time and am not supposed to show any top menu like (if i use MDIParent form). Just one active form.
Thanks,
Karthick
It sounds a bit like you're trying to create a web-style UI where the user steps from one "page" (represented by a Form) to another.
Rather than implementing a UI like this with separate forms, you're better off doing it with UserControls hosted on a single parent form.
Have a read of this MSDN article, which includes a download with sample code. It's a great walkthrough for designing that kind of user interface:
IUIs and Web-Style Navigation in Windows Forms, Part 1
IUIs and Web-Style Navigation in Windows Forms, Part 2
Edit
If you're intent on showing two separate forms, is there any reason you need to show the second one modally? Can you not simply show it and then hide the original?
form2.Show();
form1.Hide();
... or do you have yet another form that both form1 and form2 are "modal" to?
To transfer from one page (form1) to another (form2)
suppose form1 contain a button named "SAVE"
we have to write the following code in click event of the "SAVE" button
form2 f2=new form2();
f2.Show();
I think there is a property on winforms if you would like to show it on the task bar or not.
I can clarify your doubt about how to redirect from one form1 to form2
for example:
place a link in form1 and then write following code in it
form2 ins=new form2();
ins.show();
Instead of hide use close option.
Form1 formObject = new Form1();
formObject.Close();
or simply
this.Close();

Resources