AdvancedHMI Software
General Category => Additional Components => Topic started by: Godra on September 01, 2019, 01:04:36 AM
-
Thanks to the original project by Guillaume CHOUTEAU, which can be found here:
https://www.codeproject.com/Articles/27411/C-Avionic-Instrument-Controls
- Download and extract the attached 7z file (2 new folders will be created: "Resources" and "AvionicsInstrumentControls").
- Add images from the "Resources" folder as existing items to the AdvancedHMIControls project resources.
- Create a new folder inside the AdvancedHMIControls project's "PurchasedControls" folder, name it "AvionicsInstrumentControls" and add to it as existing items all the controls found in the same folder you downloaded.
- Rebuild the solution and these new controls should show in the ToolBox.
Besides for the InstrumentControl, which is a base control, all other controls are AHMI controls.
You could prevent this base control from showing in the Toolbox by adding "MustInherit" after the "Public" word.
If you try to provide values manually then remember this, in case your value is a string:
* AttitudeIndicatorInstrumentControl - PitchAngle and RollAngle are declared as Double so use CDbl(yourvalue)
* AirSpeedIndicatorInstrumentControl - AirSpeed is declared as Integer so use CInt(yourvalue)
* AltimeterInstrumentControl - Altitude is declared as Integer so use CInt(yourvalue)
* HeadingIndicatorInstrumentControl - Heading is declared as Integer so use CInt(yourvalue)
* TurnCoordinatorInstrumentControl - TurnQuality and TurnRate are declared as Single so use CSng(yourvalue)
* VerticalSpeedIndicatorInstrumentControl - VerticalSpeed is declared as Integer so use CInt(yourvalue)
These controls were also discussed in this topic: https://www.advancedhmi.com/forum/index.php?topic=2488.0
-
Hi Godra,
May i know where is this "project resources"? I can only see a Resources folder under the AdvanceHMI project.
"Add images from the "Resources" folder as existing items to the AdvancedHMIControls project resources."
If i add all the images into the folder i mentioned, i will get a lot of errors after rebuild.
-
See the attached picture.
You right-click the AdvancedHMIControls project, click Properties and then select Resources.
The Resources window will probably show "Strings" so you need to change it to "Images" by clicking the small arrow next to it.
Then click the small arrow next to "Add Resource" and choose "Add Existing File" to browse to the files you downloaded.
-
I think i've don't correctly now but there is one more issue with the GetComComponent as in pisture. How do i solve this.
-
What version of AdvancedHMI are you using?
Can you try using the latest beta version?
Eventually, you might try adding this function to your Utilities file inside the AdvancedHMIDrivers/Common folder (hopefully without any errors):
'*********************************************************************
'* Used to set the ComComponent property in design mode
'* If one doesn't exist, add a CLX driver
'*********************************************************************
Public Shared Function GetComComponent(ByVal container As ComponentModel.IContainer) As MfgControl.AdvancedHMI.Drivers.IComComponent
If container Is Nothing Then Return Nothing
Dim Result As MfgControl.AdvancedHMI.Drivers.IComComponent = Nothing
'********************************************************
'* Search for AdvancedHMIDrivers.IComComponent component in parent form
'* If one exists, set the client of this component to it
'********************************************************
Dim ItemIndex As Integer
Dim ContainerComponentCount As Integer = container.Components.Count
While Result Is Nothing And ItemIndex < ContainerComponentCount
'If Me.Site.Container.Components(ItemIndex).GetType.GetInterface("IComComponent") IsNot Nothing Then
If AdvancedHMIDrivers.Utilities.IsImplemented((container.Components(ItemIndex).GetType), GetType(MfgControl.AdvancedHMI.Drivers.IComComponent)) Then
Result = CType(container.Components(ItemIndex), MfgControl.AdvancedHMI.Drivers.IComComponent)
End If
ItemIndex += 1
End While
'************************************************
'* If no comm component was found, then add one and
'* point the ComComponent property to it
'*********************************************
If Result Is Nothing Then
Result = New AdvancedHMIDrivers.EthernetIPforCLXCom(container)
End If
Return Result
End Function
Just copy the above code and paste it in the Utilities file.
-
I downloaded the latest version 399ybeta33 but i can't create a folder inside the Purchased Control folder.
It says "The system cannot find the path specified"
So i added a sub folder inside the Controls folder. I rename the new folder as AvionicsInstrumentControls and now i have no error. All controls i can drag from the toolbox now.
-
That sounds like all your issues are resolved currently.
-
yes, so far so good. Thanks Godra.