Evaluate Control - Messages
I need your help. I am working on developing controls for SMath 0.90. For a control, say a button, it has a variable name associated with it. When created a default name is assigned, say "bButton1". The context menu brings up the properties of the control. The user changes the variable name of the control from "bButton1" to "myVar". When they exit the properties dialog the control needs to be evaluated and myVar needs to be added to store. I change the controls Term() to the New Term() with "myVar" in it. I need to trigger an Evaluate so "myVar" can get into store but without the user having to press the control. Is this possible?
Best regards, Andrey Ivashov.
That doesn't do it. And it makes the control jump to a new location. Without it the control stays put. The code below is executed by the context menu and gets the specific control. Loads the dialog box with its properties repaints the control if something the user put on the dialog changes its appearance and the last one (commented out) causes the control to jump down what appeared to be the height of the control. I'll keep experimenting with it to see what the cause might be. Try different CalculateType etc.
Public Sub ControlProperties(args As MenuButtonArgs)
Dim iX As Integer
Dim iY As Integer
Dim c As Control
Dim fProps As fControlsForm
iX = args.CurrentRegion.Location.X
iY = args.CurrentRegion.Location.Y
c = GetControl(iX, iY)
fProps = New fControlsForm(c)
fProps.ShowDialog()
c.RePainter()
'c.RequestForEvaluation(CalculateType.Ending, args.CurrentRegion, True)
End Sub
Some previews






First for a combo box I was thinking of linking it to a matrix. I need to get the matrix from "store" by Decision Preprocessing. I can not figure out how to get store from the Implementer. The only way is through Evaluate and trap a reference to store the first time.
Secondly, the control can change the value of variable but SMath doesn't recognize that its dirty and needs to be saved. In other words if I create a control and save the file, read it back in and toggle the control and exit it exits without saving.
Thanks.
WroteFirst for a combo box I was thinking of linking it to a matrix. I need to get the matrix from "store" by Decision Preprocessing. I can not figure out how to get store from the Implementer. The only way is through Evaluate and trap a reference to store the first time.
The thing is that "store" is available only when evaluation in progress, so you need to collect variables you interested in on Evaluate method raised. The collected variables you could save as some List/Array of the Control's instance and then retrieve it from "Implementer" (using Menu Context).
WroteSecondly, the control can change the value of variable but SMath doesn't recognize that its dirty and needs to be saved. In other words if I create a control and save the file, read it back in and toggle the control and exit it exits without saving.
Please, could you explain it more detailed? I'm not sure I understood you.
Best regards, Andrey Ivashov.
Quote
Quote
TheWizEd wrote:
Secondly, the control can change the value of variable but SMath doesn't recognize that its dirty and needs to be saved. In other words if I create a control and save the file, read it back in and toggle the control and exit it exits without saving.
Please, could you explain it more detailed? I'm not sure I understood you.
The control has a variable associated with it. For example bButton1 is 0 if the button is not depressed and 1 if it is. If I create an SMath file with a button in it and I save it. And let say the button is not depressed with I exit. When I open the file and press the button the value of bButton1 becomes 1 and if anything is tied to the value of bButton1 they will change. But if I immediatly exit, the file will close without saving. The file changed because the value of bButton1 changed but SMath doesn't seem to know that.


Regards.
There are some subtle changes to RegionEvaluable from 0.90 to 0.91. I've figured out most but can't figure out the replacement for RePainter().
For 0.90 I paint the control. When I click the control it would change appearance and the assigned variable would change value. Click again and the appearance would change back and the value change back.
For 0.91 when I click it, it changes appearance and the value changes. When I click again the appearance doesn't change but the value does. The appearance doesn't change until I click somewhere else on the SMath desktop. It seems SMath is not repainting the control any time I'm still in the region and clicking on it.
I did not use RePainter to change the appearance of the control. SMath seemed to handle that automatically. I use RePainter elsewhere and need to know its replacement method.
Any suggestions?
Regards.

I'm thinking about radio buttons too. I'll get to work on that right away.
I want to skinny it up a bit and match SMath text. What font and size does SMath use?

WroteWhat font and size does SMath use?
FontFamily.GenericMonospace
Regards.
I've finished the controls and posted to the SVN. Have a look and let me know if there are any problems. I'm not a professional programmer so go easy on my coding. As you noted the controls had to reside in a dll with the same name so I couldn't figure how to sub class so I just used switches to manage the controls.

One thing I noted is that the user could cut and paste a control with no way for my program to capture that and rename the control to a unique name, which is needed by the program. Maybe next release.
I'm not very good with this SVN thing. I made some improvements to the controls:
1) Highlighted the selected line in list and combobox.
2) Delete unused variable name from Store. e.g. replace lbListBox1 with x
3) If control not linked to Store don't expand combobox or select a blank row from listbox
But I can't overwrite the plugin files. And I don't see any way to delete files from SVN.
Any suggestions.
I'm planning on working on a header footer region that would print on each page of output (not to the desktop) using the iTextSharp library and your PDF example.
Regards.


The buttons on the bottom would enable you to insert the SMath version, page number, number of pages, date, filename, as a replaceble parameter much like the page setup currently in SMath. Also you could insert picture like TheWizEd avatar.
Which leads me to another question, I think I've asked before, how can I get the worksheet filename?
It is not possible to get the info you requested from the existing code. I will add a reference to the Worksheet to every Region (will be available as this.Parent), so you can retrieve all data you need (new version will be available on weekend).
Regards.
When I create a new region Parent is Nothing.
-
New Posts
-
No New Posts