Evaluate Control

Evaluate Control - Messages

#1 Posted: 1/28/2012 10:16:26 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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?
Ed
#2 Posted: 1/28/2012 10:40:24 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Use RequestForEvaluation function of the Control you've created to perform evaluation of the worksheet starting from your Region.

Best regards, Andrey Ivashov.
#3 Posted: 1/28/2012 3:34:06 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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











Ed
#4 Posted: 1/29/2012 9:27:21 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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.
Ed
#5 Posted: 1/29/2012 10:10:48 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Hello.

Wrote

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.


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).

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.

Best regards, Andrey Ivashov.
#6 Posted: 1/29/2012 1:25:06 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

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.




Ed
#7 Posted: 1/29/2012 3:42:32 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Ah, ok, you talk about changes history. Unfortunately there is no simple way to implement Undo/Redo support (this is the same mechanism) for Custom Regions. Will create one in a future release of SMath Studio.

Regards.
#8 Posted: 2/2/2012 7:27:39 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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?
Ed
#9 Posted: 2/2/2012 7:29:01 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

RePainter() changed to Invalidate() - the same method used in Windows Forms.

Regards.
1 users liked this post
Edward Ulle 2/2/2012 10:58:00 PM
#10 Posted: 2/4/2012 6:26:25 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

And finally a combo box



I'm thinking about radio buttons too. I'll get to work on that right away.
Ed
#11 Posted: 2/4/2012 9:01:27 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

I want to skinny it up a bit and match SMath text. What font and size does SMath use?
Ed
#12 Posted: 2/5/2012 12:24:32 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Preview of some more controls.


Ed
3 users liked this post
Andrey Ivashov 2/5/2012 12:45:00 AM, Fridel Selitsky 2/5/2012 1:20:00 AM, Radovan Omorjan 2/5/2012 10:40:00 AM
#13 Posted: 2/5/2012 10:22:12 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Wrote

What font and size does SMath use?


FontFamily.GenericMonospace

Regards.
#14 Posted: 2/5/2012 12:30:22 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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.
Ed
2 users liked this post
Andrey Ivashov 2/5/2012 4:52:00 PM, Davide Carpi 3/2/2012 9:31:00 AM
#15 Posted: 2/5/2012 4:52:18 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

It's great! Thank you!
#16 Posted: 2/11/2012 11:29:46 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

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.
Ed
#17 Posted: 2/11/2012 4:39:55 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Contact me using Skype (smath.andrew) regarding SVN things. I will help.

Regards.
#18 Posted: 3/2/2012 9:03:53 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

For developing regions, how can I get the page width. And can I adjust the page height with the new page delineater in 0.92? I have made some progress on a header footer. Slowly because my day job interfers. My plan was to have a header footer region. This is as far as I've gotten. Not much I admit.





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?
Ed
1 users liked this post
Davide Carpi 3/18/2012 11:46:00 AM
#19 Posted: 3/2/2012 10:51:15 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Hello.

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.
#20 Posted: 3/11/2012 6:45:34 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

When I create a new region Parent is Nothing.
Ed
  • New Posts New Posts
  • No New Posts No New Posts