Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline TheWizEd  
#1 Posted : 28 January 2012 17:16:26(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Andrey Ivashov  
#2 Posted : 28 January 2012 17:40:24(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Use RequestForEvaluation function of the Control you've created to perform evaluation of the worksheet starting from your Region.

Best regards, Andrey Ivashov.
Offline TheWizEd  
#3 Posted : 28 January 2012 22:34:06(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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.

Code:

    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











Edited by user 28 January 2012 22:50:05(UTC)  | Reason: Not specified

Ed
Offline TheWizEd  
#4 Posted : 29 January 2012 16:27:21(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
Offline Andrey Ivashov  
#5 Posted : 29 January 2012 17:10:48(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Hello.

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

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.

Best regards, Andrey Ivashov.
Offline TheWizEd  
#6 Posted : 29 January 2012 20:25:06(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
Offline Andrey Ivashov  
#7 Posted : 29 January 2012 22:42:32(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
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.
Offline TheWizEd  
#8 Posted : 03 February 2012 02:27:39(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
Offline Andrey Ivashov  
#9 Posted : 03 February 2012 02:29:01(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
RePainter() changed to Invalidate() - the same method used in Windows Forms.

Regards.
thanks 1 user thanked Andrey Ivashov for this useful post.
on 03/02/2012(UTC)
Offline TheWizEd  
#10 Posted : 05 February 2012 01:26:25(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
And finally a combo box



I'm thinking about radio buttons too. I'll get to work on that right away.
Ed
Offline TheWizEd  
#11 Posted : 05 February 2012 04:01:27(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Andrey,

I want to skinny it up a bit and match SMath text. What font and size does SMath use?
Ed
Offline TheWizEd  
#12 Posted : 05 February 2012 07:24:32(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Preview of some more controls.


Ed
thanks 3 users thanked TheWizEd for this useful post.
on 05/02/2012(UTC),  on 05/02/2012(UTC),  on 05/02/2012(UTC)
Offline Andrey Ivashov  
#13 Posted : 05 February 2012 17:22:12(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
TheWizEd wrote:
What font and size does SMath use?

FontFamily.GenericMonospace

Regards.
Offline TheWizEd  
#14 Posted : 05 February 2012 19:30:22(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
thanks 2 users thanked TheWizEd for this useful post.
on 05/02/2012(UTC),  on 02/03/2012(UTC)
Offline Andrey Ivashov  
#15 Posted : 05 February 2012 23:52:18(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
It's great! Thank you!
Offline TheWizEd  
#16 Posted : 11 February 2012 18:29:46(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
Offline Andrey Ivashov  
#17 Posted : 11 February 2012 23:39:55(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Contact me using Skype (smath.andrew) regarding SVN things. I will help.

Regards.
Offline TheWizEd  
#18 Posted : 02 March 2012 16:03:53(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
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
thanks 1 user thanked TheWizEd for this useful post.
on 18/03/2012(UTC)
Offline Andrey Ivashov  
#19 Posted : 03 March 2012 05:51:15(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
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.
Offline TheWizEd  
#20 Posted : 12 March 2012 01:45:34(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Andrey,

When I create a new region Parent is Nothing.
Ed
Users browsing this topic
Guest
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.