How to create Modal and Modeless forms in borland c++ builder - c++builder

I have an assignment to enhance an already existing tool written in Borland c++, I am new to programming and c++ builder. The task is to integrate message box which pops up, in to the main form itself,which I have successfully done by adding a new form to the project and calling it in place of message box.
I have made my new form modal so that control is blocked,till user selects an option.
Now I have added another form named graph to the project to show a graph and I want the control to go to the graph when user clicks a button in the new form.
Is there a way to make two children modeless and block only the parent form(modal).In short I want to access both the new forms I have added to my project and I don't want to access my main form,till I make all selections in these two forms.Kindly help!

Rather than using ShowModal(), you could set the parent Form's Enabled property to false, use Show() to show both forms, and then set the parent Form's Enabled property back to true when both forms have been closed.

You could move the functions you don't want to run automatically during create from the OnCreate() method. You may move them to e.g. OnClick(). I faced a similar situation where a Show()
method was running during program create. I implemented the OnActivate() method and called the Show() method from there, instead from OnCreate().

Related

Adding a button that invokes an application in WIT's

Is it possible to add a button to a work item type (WIT) which upon clicked would execute a C# application? I would like to pass in field values of the WIT as arguments to my custom C# code.
I happened across extension Action Button Control but I believe its functionality does not include what I am after. It is displayed in the picture below.
Is there an extension that performs what i'm after?

Always on top like task manager

I am working on a project but I faced a problem in making a form stay always on top like task manager in delphi
I used this code but didn't work
SetWindowPos(Form1.Handle, HWND_TOPMOST, 0,0,0,0, SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);
Modern task manager uses internal private Windows functionality for its stay on top behaviour. The system does not make this available to user windows. The functionality that task manager uses simply isn't available to you.
Related question: Is Task Manager a special kind of 'Always on Top' window for windows 10?
Just use the Object Inspector at design time to set the form's FormStyle property to fsStayOnTop.
The code from the original post might work on a main form, but will not work on a secondary form. fsStayOnTop is only part of the solution for a secondary form. Below is an easy solution for making a secondary form stay on top while the main form is obscured by other applications - without resorting to showmodal or form creation hacks.
Put this in the "Form B" OnCreate event:
FormStyle:= fsStayOnTop;
but that alone won't do the trick...
Drag a TApplicationEvents onto your "Form B"
In the OnDeactivate event for ApplicationEvents1, add the following:
SetForegroundWindow(Handle);
I keep an eye on a small status window while my main form is crunching data out of site. Works beautifully!

How to implement Submit and Cancel buttons in IWizard implementation

How do we implement the OK/Submit button if the user chose his preferences and he is ready to start working on his new project? Furthermore - Cancel button - gracefully exit from the wizard and return to New Project dialog box without creating the project.
The IWizard interface (Microsoft.VisualStudio.TemplateWizard namespace) doesn't give you full control of the project creation. It allows you to do some things at specific phases of the project creation. It is cancelable throwing a WizardCancelledException. See also this explanation and also:
Pitfalls of cancelling a VSIX project template in an IWizard
If you want full control you can use the old COM-based IDTWizard interface (EnvDTE namespace) instead, which provides a single Execute method where you can show a form (cancelable) and add the project/files using EnvDTE.Solution.AddFromTempleate, EnvDTE.ProjectItems.AddFromTemplate, etc. See my post:
Project templates wizards (IWizard vs IDTWizard)

making a wizard interface in delphi 7

I'm using delphi 7 and I'm trying to make a wizard interface. I don't know if there is an easier way to make a wizard, so I was thinking of making separate forms for each step of the wizard, and when the user clicks "Next" the active form closes and the next one opens.
Here's a screen-shot of two successive forms:
I've made a procedure that take 2 forms as parameters: the form that will be closed and the next form of the wizard
class Procedure Tspad.nextForm(showForm, closeForm: TForm);
begin
closeForm.Close;
showForm.Showmodal;
end;
When I click the "Next" Button the folowing code is executed:
Tspad.nextForm(echipContractForm, clientContractForm);
When i run the program, and i press the "Next" button, the next form apeares but the curent one dosen't close.
How can i make this work, or is there another more efficient way to create a wizard?
One very common way to make a wizard is to use a page control. Each distinct page of the wizard is a different page/tabsheet in the page control. I believe that this is effectively how Windows implements wizards.
Naturally you want to hide all the tabs. Do this by setting TabVisible to False for each tabsheet. When you wish to move forwards and backwards through the wizard, e.g. when the user clicks the next or previous buttons, effect this by setting ActivePage or ActivePageIndex depending on your preference.
A good practise for the division of content being displayed on a single form is the use of Frames.
A Frame is a lot like a form, except it has no Window of its own, but rather sits inside a host Form.
When combined with (as David Heffernan has suggested) a TPageControl or even a TNotebook (which is pretty-much exactly the same as TPageControl, only it doesn't have Tabs to begin with), you end up with an easily-maintainable Wizard.
JVCL has a good control to make a wizard in a very simple and effective way (TJvWizard). See http://jvcl.delphi-jedi.org/
You can give a try to these :
Balmsoft Wizard released under LGPL.
Delphi Wizard Framework by SO member Steven R. Kamradt.
You can test some components that can help you with this task (internally using tPageControl or TNotebook). See this link.
Regards.
You may also consider TMS TAdvSmoothStepControl (not free !).
Another solution, but only 'external' to your program, is to use Inno Setup to make a Wizard, even for 'non installation setup' purposes.
In fact with Inno Setup you can make a lot of thinks ( modify .ini file and registry, start/stop programs...) that can be usefull for a wizard without 'installing' a program.

For BlackBerry, how can my java program select a specific menu item in another BlackBerry program?

How can I simulate a menu item selection for an exact menu item like for example, "New Note" ?
If you want to create a new memo then simply use the Invoke class and supply it with a MemoArguments object. Note that you can do this for other core BB applications beyond the memo application.
Invoke.invokeApplication(Invoke.APP_TYPE_MEMOPAD, new MemoArguments(MemoArguments.ARG_NEW));
If you want to actually click on a menu item in another application then you could try using the EventInjector class, although I don't know how well that will work for you. If it's a third party application that you want to control you probably won't have a lot of success.

Resources