|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Dallwitz
Joined: 13 Nov 2006 Posts: 16 Location: Canberra, Australia
|
Posted: Sun Dec 28, 2008 12:08 pm Post subject: Visual ClearWin example in Visual Studio 2008 |
|
|
Using Visual Studio 2008, I'm trying the example in the FTN95 Help under '.NET platform > Visual ClearWin > Getting started'.
The instructions start: 'In Microsoft Visual Studio, create a New, Blank Solution and Add a New Project. For the type of project, select Visual C# Projects and Windows Application. When you do this, a new blank form is displayed in a design view.'
The available options don't correspond exactly to this description, but using 'File > New > Project … > Visual C# > Windows > Windows Forms Application' I obtained a blank form in a design view.
The instructions continue: 'In the Properties of this project, under the General properties, select the Output Type to be a Class Library.'
I can't find anything resembling these options. Can anyone give me detailed instructions about where to find them? _________________ Mike Dallwitz |
|
Back to top |
|
|
Astelix
Joined: 17 Dec 2008 Posts: 13
|
Posted: Sun Dec 28, 2008 12:55 pm Post subject: |
|
|
If you have created the C#-Windows-Application you have to look at the solution explorer window. Right click the project name there and select "properties" from the context menu. The properties window opens. You can select output type on the first tab. |
|
Back to top |
|
|
Dallwitz
Joined: 13 Nov 2006 Posts: 16 Location: Canberra, Australia
|
Posted: Sun Jan 04, 2009 5:33 am Post subject: |
|
|
Thanks. I've now generated the example successfully. However, there are many discrepancies from the description in FTN95 Help, so here's the method that worked for me.
--------------------------------------------
In the Visual Studio main menu, select ‘File > New > Project…’. In the ‘New Project’ dialog, select ‘Project types: Visual C# > Windows’, ‘Templates: Windows Forms Application’, and ‘.NET Framework 2.0’; check ‘Create directory for solution’; set ‘Name: Resources1’ (default ‘WindowsFormsApplication1’), ‘Location: D:\ftn\tests\Visual Clearwin’, ‘Solution Name: Solution3’ (default ‘Resources1’); click ‘OK’. A solution ‘Solution3’ is created, containing a project ‘Resources1’. A new blank form is displayed in a design view.
Make sure that ‘Solution Explorer’, ‘Properties’, and ‘Toolbox’ windows are visible (via the ‘View’ menu). The ‘Solution Explorer’ window displays a tree comprising the solution, its projects, and the components of the projects.
The ‘Properties’ window shows properties of the item selected in ‘Solution Explorer’, or of an item selected in a design view. In most cases, all of the properties can be viewed and set in the ‘Properties’ window. However, the properties of solutions and projects are set in additional windows. To display these windows, right click on the solution or project in the ‘Solution Explorer’ window, and select ‘Properties’; alternatively, select the solution or project in the ‘Solution Explorer’ window, and click the ‘Property Pages’ button in the ‘Properties’ window. The ‘Property Pages’ of a solution, and of some projects, is a dialog with title ‘name Property Pages’. The ‘Property Pages’ of other projects is a tab in the main pane; this is called a ‘Project Designer’ in the Visual Studio help.
Display the ‘Project Designer’ for ‘Resources1’. In the ‘Application’ tab, set ‘Output Type: Class Library’. Close the ‘Project Designer’.
If this is your first use of ‘Visual ClearWin’, it’s necessary to add the ‘Visual ClearWin’ controls to the ‘Toolbox’ as follows. Right click on the ‘Toolbox’ and select ‘Add Tab’. Enter the name ‘Visual Clearwin’ for the tab. Right click on this tab, and select ‘Choose Items…’. In the resulting ‘Choose Toolbox Items’ dialog, select the tab for ‘.NET Framework Components’. Click ‘Browse…’, select ‘\Program Files\Silverfrost\FTN95\redist\Salford.VisualClearWin.dll’, and click ‘Open’. In the ‘Choose Toolbox Items’, all of the items in the Namespace ‘Salford.VisualClearWin’ are automatically selected. Click ‘OK’.
Now construct a form similar to that shown in FTN95 Help. To add a component to the form, select an item in the toolbox and drag a rectangle in the design view. Use the ‘Properties’ window for the form and for each component in order to create the visual attributes that you want. It is not necessary to view the code for the form. The input and output boxes on the form must use the ‘Visual ClearWin’ control ‘Double_Box’. ‘Value’ and ‘Result’ use the ‘Label’ control, and the ‘Square’ button uses the ‘Button’ control. In the properties for the button control, make sure that the ‘DialogResult’ property is set to ‘None’ (if the properties are ‘Categorized’, ‘DialogResult’ is under ‘Behaviour’).
In the References for the project, make sure that there is a reference to ‘Salford.VisualClearWin’.
(To be continued) _________________ Mike Dallwitz |
|
Back to top |
|
|
Dallwitz
Joined: 13 Nov 2006 Posts: 16 Location: Canberra, Australia
|
Posted: Sun Jan 04, 2009 5:46 am Post subject: |
|
|
(Continued) (For some reason, I couldn't get it into a single post.)
Create a second project to contain the Fortran main program. In the ‘Solution Explorer’ window, right click on the solution and select ‘Add > New Project…’. In the ‘Add New Project’ dialog, select ‘Project types: FTN95 Projects’ and ‘Templates: FTN95 Visual ClearWin Application’, ‘Name: Project1’ (default ‘VisualClearwinApplication1’; click ‘OK’. In the ‘Property Pages’ of this project, ensure that ‘Platform: .NET’ is set, and, in the ‘Linker Options’, that ‘Yes’ is selected against ‘Windows Application’.
In ‘Solution Explorer’ under ‘Project1 > Source Files’, rename ‘ClearwinFile1.f95’ to ‘main.f95’. Open this file, and modify it so that it becomes:
Code: | MODULE Form1
USE VC
TYPE(VCdialog)::dlg1
DOUBLE PRECISION x,y
CONTAINS
INTEGER FUNCTION Square()
y=x*x
Square=0
END FUNCTION Square
END MODULE Form1
PROGRAM Main
USE Form1
dlg1=vcCreateDialog@("Resources1.Form1")
CALL vcLinkDouble@(dlg1,"double_Box1",x)
CALL vcLinkDouble@(dlg1,"double_Box2",y)
CALL vcOnClick@(dlg1,"button1",Square)
CALL vcDisplayDialog@(dlg1) ! Note: ‘vc’ is omitted in the FTN95 Help.
END |
In the context menu for the ‘References’ for this project, select ‘Add Reference’; add references to ‘Salford.VisualClearWin’ and ‘Resources1’ (the C# project ); click ‘OK’.
Ensure that the C# form (‘Resources1’) is built before the Fortran main program (‘Project1’) by clicking on ‘Project Build Order…’ in the context menu for the solution (in the ‘Dependencies’ tab set ‘Project1’ ‘Depends on: Resources1’).
Redirect the class library (DLL) in the Visual C# project so that it is copied to the folder used by your Fortran executable. To do this, open the ‘Properties Pages’ for the C# project (‘Resources1’) and in the ‘Build’ tab set ‘Output Path: ..\Project1\Debug\NET\’ or its equivalent.
In the context menu for the solution, select ‘Set Startup Projects…’; select ‘Single startup project’ and ‘Project1’.
Build and run the solution. _________________ Mike Dallwitz |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|