1 Pages (10 items)
Writing on SMath canvas using plugin codes - Messages
#1 Posted: 8/4/2023 4:55:33 AM
Hello everyone,
I would like to ask if anyone knows examples or ways to write SMath command on SMath canvas itself via plugin. I want to implement a feature where the user can click a button (from a plugin form), and then some SMath command is written on the canvas. However, I'm not sure which class is responsible for this action.
Best regards,
Faiz
I would like to ask if anyone knows examples or ways to write SMath command on SMath canvas itself via plugin. I want to implement a feature where the user can click a button (from a plugin form), and then some SMath command is written on the canvas. However, I'm not sure which class is responsible for this action.
Best regards,
Faiz
#2 Posted: 8/4/2023 6:41:01 AM
#3 Posted: 8/4/2023 10:38:06 AM
AFAIK, you can't command the canvas from over the canvas itself.
Plug your demand the region above the canvas, display result(s) over the canvas.
Highlight the graph of the X,Y ... +, dot, o
Plug your demand the region above the canvas, display result(s) over the canvas.
Highlight the graph of the X,Y ... +, dot, o
#4 Posted: 8/4/2023 10:53:31 AM
I am looking for is something like the toolbox, where you can click on the button (item) in the toolbox and the function/text is written on the canvas automatically. But instead of doing this via the toolbox, I want to do this using a windows form that I created within the plugin that I am working on. I am not sure if this can be access via the SMath.Core or it is only available for the toolbox.
Regards,
Faiz
Regards,
Faiz
#5 Posted: 8/4/2023 11:06:50 AM
#6 Posted: 8/4/2023 11:12:38 AM
#7 Posted: 8/4/2023 11:29:56 AM
Wrote... which plugin is this? ...
Ups. It's not a plugin, it is in SMath.UI.Accessories.dll.
Best regards.
Alvaro.
#8 Posted: 8/4/2023 12:12:17 PM
Greetings,
For starters, you cannot use SMath.Manager.IPluginToolboxGroups (i.e., the Toolbar) because it only supports a action that will be inserted into the worksheet. The question becomes: how am I able to interact with the worksheet? Please reference this thread: https://en.smath.com/forum/yaf_postst23224_Plugin-Development--GUI---SMath-Interface.aspx
If you are creating your own region, you would want to utilize IPluginCustomRegion.
With regards to your intent, it appears as though you may want to utilize IPluginMenuExtender; you can choose if you want it in the File, View, Tools, Help, or Context Menu (ie., a button click)
The following code is a quick example in VB.NET, on how you can create a button that you can click, and it can perform an action akin to the toolbar (i.e., insert a region at the current cursor location)
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
For starters, you cannot use SMath.Manager.IPluginToolboxGroups (i.e., the Toolbar) because it only supports a action that will be inserted into the worksheet. The question becomes: how am I able to interact with the worksheet? Please reference this thread: https://en.smath.com/forum/yaf_postst23224_Plugin-Development--GUI---SMath-Interface.aspx
If you are creating your own region, you would want to utilize IPluginCustomRegion.
With regards to your intent, it appears as though you may want to utilize IPluginMenuExtender; you can choose if you want it in the File, View, Tools, Help, or Context Menu (ie., a button click)
The following code is a quick example in VB.NET, on how you can create a button that you can click, and it can perform an action akin to the toolbar (i.e., insert a region at the current cursor location)
Public Function GetMenuItem(sessionProfile As SessionProfile) As MenuButton() Implements IPluginMenuExtender.GetMenuItem
...
Dim btnMenu_01b_tools8 = New MenuButton("Minus Plus (∓)", AddressOf Me.OnClick_InsertMinusPlus)
btnMenu_01b_tools8.Behavior = MenuButtonBehavior.AlwaysEnabled
btnMenu_01b_tools8.ShortcutKey = InputKeys.Control Or InputKeys.Subtract ' https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=windowsdesktop-7.0
...
Return (New MenuButton() {btnMenu_01c, btnMenu_01d, btnMenu_01g, btnMenu_01h, btnMenu_01_tools})
End Function
Public Sub OnClick_InsertMinusPlus(_args As MenuButtonArgs)
Try
If IsNothing(_args.CurrentRegion) Then
Dim Lourdes As SMath.Controls.MathRegion = New SMath.Controls.MathRegion(_args.SessionProfile)
Dim expr = New List(Of SMath.Manager.Term) 'As SMath.Manager.Term() ' = {} '
expr.Add(New SMath.Manager.Term("#", SMath.Manager.TermType.Operand, 0))
expr.Add(New SMath.Manager.Term("∓", SMath.Manager.TermType.Operator, 1))
Lourdes.Terms = expr.ToArray
Dim Avignon As SMath.Controls.RegionsEnumerator = New SMath.Controls.RegionsEnumerator(New List(Of SMath.Controls.RegionBase)({Lourdes}), 0)
_args.Worksheet.CreateRegions(Avignon, 0, 0, , )
Else
_args.CurrentRegion.OnCommandSend("∓"
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
On that note, you can copy and paste my full code (VB.NET) from this forum thread (NOTE: you will need to expand the "SPOILER" tags to see/access the code)
https://en.smath.com/forum/yaf_postsm79990_SMath-Keyboard-Shortcuts.aspx#post79990
https://en.smath.com/forum/yaf_postsm79990_SMath-Keyboard-Shortcuts.aspx#post79990
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#9 Posted: 8/5/2023 8:00:19 AM
WroteI would like to ask if anyone knows examples or ways to write SMath command on SMath canvas itself via plugin.
No need for plugin, it comes from native Studio as well Solver 30405.
Collect all the plotting arguments plot:={
Put that collect on the left of the plot, at same level.
Now, you have full command of the canvas.
Formatted Label will do as well.
Perfect example from Alvaro latest Timosenko.
#10 Posted: 8/6/2023 8:15:02 AM
WroteFormatted Label will do as well.
Bad luck ... Formatted Label not included Solver 30405
It survives from Studio versions.
1 Pages (10 items)
-
New Posts
-
No New Posts