PopUp Form in Devex - winforms

I want to display a popup form when user clicks a button. But i don't want to create a new form and display it. Is there any tool in devex that could achieve this. Currently i am using Group Control to display instead of new popup form.
Please help me. Thanx in advance

You can use PopupControlContainer class and its PopupControlContainer.ShowPopup method:
private void simpleButton1_Click(object sender, EventArgs e)
{
popupControlContainer1.ShowPopup(Cursor.Position);
}
ps: Don't confuse between PopupControlContainer class and PopupContainerControl class.

You can use a popcontaineredit which looks like a dropdown. Make this so small that you can just see the Dropdown Button at the end. Modify the Button for your needs. Then use the PopupContainerControl. This is very similar to panel. You can easily customize it for your needs (add controls on it etc.). Then you have to connect popupedit and popcontrol. Click the edit and it will popup the popupcontrol. Let me know if you need further help.

Related

Codename One nested Sidemenu

I am trying to create a nested side menu for a CN1 application, similar to the one in the screenshot.
For the nested sidemenu to work, I image it has to stay open when the user presses a command of a dropdown list , so that he/ she can choose an option.
But the CN1 sidemenu appears to close every time and I couldn't find a workaround.
One approach I was trying was to add an action event to the "hamburger menu ", but this doesn't seem to work.
Button sideBtn = (Button)((BorderLayout)bar.getLayout()).getEast();
sideBtn.addActionListener(new ActionListener(){
#Override
public void actionPerformed(ActionEvent evt) {
Toolbar.setPermanentSideMenu(true);
};
Neither does adding Toolbar.setPermanentSideMenu(true) to any other button's action event.
Anther approach I have in mind is to add hidden buttons to the sidemenu and repaint the toolbar when the button is clicked, but this still does not keep the sidemenu open and seems to be not very direct.
Is there anything more straightforward? What would be the best approach?
Thanks in advance for any kind response.
The setPermanentSideMenu method is designed for tablets and not for what you are trying to do. Toggling it after the init(Object) method was invoked doesn't make sense and might break your app.
You didn't list how you added the button to the side menu but adding it using addComponentToSideMenu(Component) should work (notice I didn't use the version that accepts a Command).

C#: components cannot show on Windows Form

I have created an empty project. after that, I added new items is Windows Form and add some component such as button or textbox in Design View.
In main file, I use this code:
SimpleForm form = new SimpleForm(); // SimpleForm is my class
form.Show();
But, when I run, C# generate a form but I cannot see textbox nor button. I just see blank area where I put those components. As picture below, the white area is my button, but I don't know why this button cannot show. I think maybe some problem, and those components cannot draw on the form.
Please help me this error.
Thanks :)
If by "the main file" you mean your main method (the entry point) - try this code instead:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SimpleForm());
If not you really need to post more of your code to get a reasonable answer.

PasswordBox loses its content on navigation

I'm using a PasswordBox on a Page. Because of the implemented workflow the user can navigate to sub pages (NavigationWindow) and than return with GoBack() to the main page.
But when doing that, the password box is always empty! My job is to prevent that behaviour, but at the moment I have no clue how do achive that.
It would be great if you could help me out.
Thanks
It is a feature.
See: How to bind to a PasswordBox in MVVM
To enable the backward navigation the state of the page needs to be stored. And that is not secure.
I don't think his exact problem is a feature, but a bug of the navigation service.
In your code behind you have no easy way to distinguish between the navigation control blanking your password on navigation or the user blanking it by deleting it from the box.
So if you don't consider that, your password in your viewmodel will always be blank if you navigate to another page.
I used this hack to determine who called my password changed handler to update the view model:
private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
{
StackTrace stack = new StackTrace();
StackFrame[] stackframes = stack.GetFrames();
foreach (StackFrame stackFrame in stackframes)
if(stackFrame.GetMethod().Name == "Navigate")
return;
ViewModelPassword = PasswordBox.SecurePassword;
....
Take a look here too: http://www.wpfsharp.com/2011/04/08/wpf-navigationservice-blanks-passwordbox-password-which-breaks-the-mvvm-passwordhelper/

UI Design Concepts in WinForms

In one certain case I want to disable the tabpannel so that the controlls in the tab panel are disabled.
I want to disable the tab pannel but still I want ennable the controls in tab pannel.the need is User cannot switch over to the annother tabpannel in a certain senerio.
How can I do this requirement?.
by
dinesh
Use something besides a tab panel.
It is not standard behavior for a tab panel to have one tab "stuck" so that the user cannot move to the other tabs. You're going to throw users off if you do this.
What you are after sounds like a modal dialog. It sounds like you don't want the users to move away from a certain screen until they're doing entering some data or some such. The modal dialog is built for this purpose.
There is no direct way to disable Tab Page, only you can remove it. But in your case, you can't remove the Tab, So I think you need to put some code in the Tab_SelectionIndex change event. And when ever the Tab index comes, set it back to another one.
Try this code
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex == 1)
{
tabControl1.SelectedIndex = -1;
}
}
In addition to anuraj's answer, set the colour of the tab text to the disabled text colour state, so it is a visual cue it is "disabled".

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