I am opening an editor from a view on click of a treenode. Now, when editor loads and controls are displayed to the user, I want to display a warning message dialog to the user based on certain values present on the editor.
I tried by putting the warning dialog at the end of createPartControl method of the editor. Dialog appears on double cliking the treenode as per the required functionality. But, the problem is that when the dialog appears, the controls on the editor are not yet visible. It's only when I close the dialog the editor controls are shown.
I want it to happen the other way around. i.e. The editor controls to show up first and then the warning dialog should appear. What changes should I do to achieve this effect?
You may want to call that MessageDialog in an asynchronous way, to leave the Editor the opportunity to complete itself, as suggested in this message.
show your warning dialog in an asyncExec() runnable would ensure that the editor's initialization all happens in the correct sequence.
So, something like (not tested) this code might do the trick:
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
MessageDialog.openWarning(getSite().getShell(),"wrong","no)
}
});
}
Some other examples in this MapEditor class, where a MessageDialog is displayed through an asyncExec which waits for the result:
PlatformGIS.syncInDisplayThread
Related
I would like to hide the "Config structure" button in the header of the screen "Item derails: configuration" in the VA* transactions, for a certain item status.
I am debugging the Dynpro logic but it's quite difficult to find the right spot where I can implement my additional logic and what button it actually is (technically).
Any help and guidance is appreciated.
Thanks in advance.
Here is a way to locate the code which defines the buttons of the Application Toolbar in any Dynpro. You may then change the code to hide a button, etc.
The "Application Toolbar" is the line of buttons which appears at the top of the main screen area (what is shown in your screenshot), and it's selected by the ABAP statement SET PF-STATUS during the Process Before Output event of the Dynpro screen, right before the screen is displayed.
If you put the focus on the button (click without releasing and drag out of the button) and press the F1 key, you will see both the function code of the button and the GUI status it belongs to (screenshot for transaction code SE38):
Double-click the "Function" field to display the GUI Status:
You may then start the debugger (/h in the command field for instance) and use the feature "breakpoint at statement", to stop at every SET PF-STATUS. After the EXCLUDING word, you may exclude (hide) any function code you want (button, menu item or keyboard key; for information, here SYCR is not even defined in the GUI status, so it's ignored). As you can see, you may modify the code here:
For making this simply I have two forms a button on each to navigate between the two forms. Then on one I have a checkbox and label when the checkbox is checked it displays the label by using the following code in the form.load event:
Me.label1.DataBindings.Add("Visible", Me.checkbox1, "Checked")
The problem is if I were to leave the form with the checkbox and label and the checkbox is not checked and then I come back to the form with the checkbox and try and check it the label doesn't show up any suggestions or solutions.
Delete that line of code from the form load
Open your form in the designer, the one with the label and the checkbox on it
Click the checkbox
In the Properties grid expand (PropertyBinding) and open the drop down next to (none), click New at the bottom
Pick an initial value, and choose a name for the setting. Make it user scoped if you want to be able to save it and restore it next time the program opens
Now go to your label, properties, click the [...] next to (PropertyBinding) to see a list of all bindable properties, scroll to Visible and drop down to choose the same setting
Run the program.
Side note; when I did this I think I may have encountered a bug/feature of databinding (that I plan to research more) in that the behavior was only as expected if the bool starts out as true (so the control is visible) when the binding is set up. If the control is invisible, it never binds properly to see when the property has become true - so as a workaround (purely in this case where we're binding Visible), replace he call to InitializeComponent() with this, in the form's constructor:
if (!Properties.Settings.Default.FormatWithoutConfirmation)
{
Properties.Settings.Default.FormatWithoutConfirmation = true;
InitializeComponent();
Properties.Settings.Default.FormatWithoutConfirmation = false;
}
else
InitializeComponent();
In my application when it is iconized in the system tray, and through a ContextMenuStrip1 displays a context menu and when I click the icon I can choose what to display; the application, close it etc.
Now, when the mouse is over the icon I would like to show a tooltip (property that unfortunately does not have, but that have the individual menu items), it always shows me the name of the menu object: ContextMenuStrip1, even in its text property set something else.
Since at some times the app makes updates in background I would like to show under the icon a small progressbar as do some application. How is this possible in vb.net? (I'm using VB2012)
Thank you all.
I resolved you need to use the Text property of the notifyIcon object.
What I am cunrrently doing is while closing the editor in doSave method I check for a condition If it is satisfied I allow super.doSave() be called else I display a dialog box displaying the error message.
Now I want to instead ask user again if he want to save it again and if he says yes he could save the wrong file or say no to edit it but in either case editor should not close.
However currently after the error it closes.
If your editor part implements ISaveablePart2 Eclipse will call the method:
public int promptToSaveOnClose();
to prompt for saving when closing. You can respond with ISaveablePart2.CANCEL to cancel the close, ISaveablePart2.YES to continue the save (by calling doSave), ISaveablePart2.NO to skip the save, or ISaveablePart2.DEFAULT to use the normal behavior.
Good day (and happy New Year),
I'm a beginner VB.Net programmer using VS 2008.
I'm planning a new winform project whose main form should look more or less like this:
MAIN MENU
1. DoSomething1
2. DoSomething2
3. DoSomething3
...
Please choose: [TextBox]
The user can either choose from the Main Menu (by clicking an item) or enter the item number in the textbox. For example, if the user clicks DoSomething3 in the Main Menu (or alternatively enters 3 in the textbox), another form will be opened and hide the main form.
What would be the best way to implement it?
Specifically, I would like to know how I make so that choosing from the menu and entering a number in the textbox fire the same event.
Any help or hints will be appreciated.
This is the traditional user interface for a console mode program. It is quite inappropriate for a GUI app, the kind that Winforms let you build. The closest approximation is buttons for each menu item. So the user can just click one directly, rather than having to type a number. The keyboard still works too, pressing Tab to move through the buttons, Space to activate one.
Look around a bit at user interfaces of other programs you use. Note their use of a menu and a toolbar.
Context Menu and Event Handling in Visual Basic .NET
Edit:
Ok. I think I did not understand. May these links will help you:
Multiple Forms in VB.NET. Part 2 - Accessing Controls on Other Forms
You can use buttons to goto other forms: Look at this thread:
Link from one form to another (Thread)
it's been almost 2 yrs i did not use vb.net but i'll try to help u.
you can make something very simple.e.g.
Have three buttons on the main menu of the main form e.g.
Button 1
Button 2
Button 3
Add click events to all the tree buttons. Create a method for button1,button2,button3
e.g.
void SimulateButton1
{
SpecifiedForm.show();
}
void SimulateButton2
{
SpecifiedForm.show();
}
void SimulateButton3
{
SpecifiedForm.show();
}
Now for the main menu its ok, lets consider entering the Number manually
//get the number first
String Choice=txtChoiceTextBox.getText();
You can add a button next to the textbox with caption Choose Option
and then add an onclick event to this button
on clicking on the button, do the following
if (Choice="1")
{
SimulateButton1();
return;
}
if (Choice="2")
{
SimulateButton2();
return;
}
if (Choice="3")
{
SimulateButton2();
return;
}
For the first tree button it mentioned, it can not be a button but a menu item but the principle is the same
that's it, hope it helps