Forums › Forums › SIMPOL Programming › Best Practices when modifying supplied .sml
- This topic has 15 replies, 2 voices, and was last updated 11 years, 10 months ago by Michael.
- AuthorPosts
- June 7, 2012 at 6:12 pm #34JD KromkowskiParticipant
Thanks for giving me, the .sma that go with uisyshelp library. As you know, I want to modify the datepicker and the timepicker. Changing the underlying .sma s is easy enough (doing it correctly is another question). So if I am in the uisyshep Project – Projects\Libs and I change the sma in question and then I Rebuild All. Do I then have to put the new .sml into the lib directory (in place of the old uisyshelp.sml) and then go to appframework Project and rebuild the applicationframework.sml? If you start trying to chase down where did each sml get all of its functions from by looking at the Projects, it gets pretty clear that there is a lot of spaghetti. For example, in the appframework project, the gettime function comes from the formlib.sml, but in the formlib project the gettime function is coming either from the uisyshelp.sml or from the databaseforms.sml . (How does the program know which gettime function to use? Except of course that if you look at the databaseforms projects you’ll see that the gettime function came from uisyshelp.sml But then do I have to rebuild all of these so that they also use my modified gettime function ( and gettimeform function)?
June 11, 2012 at 9:34 am #1951MichaelKeymasterOn 07/06/2012 21:12, John D Kromkowski wrote:
> Thanks for giving me, the .sma that go with uisyshelp library.
>
> As you know, I want to modify the datepicker and the timepicker.
>
> Changing the underlying .sma s is easy enough (doing it correctly is another question).
>
> So if I am in the uisyshep Project – Projects\Libs and I change the sma in question and then I Rebuild All.
>
> Do I then have to put the new .sml into the lib directory (in place of the old uisyshelp.sml) and then go to appframework
> Project and rebuild the applicationframework.sml?
>
> If you start trying to chase down where did each sml get all of its functions from by looking at the Projects, it gets pretty
> clear that there is a lot of spaghetti.
>
> For example, in the appframework project, the gettime function comes from the formlib.sml, but in the formlib project the
> gettime function is coming either from the uisyshelp.sml or from the databaseforms.sml . (How does the program know which
> gettime function to use?
>
> Except of course that if you look at the databaseforms projects you'll see that the gettime function came from uisyshelp.sml
>
> But then do I have to rebuild all of these so that they also use my modified gettime function ( and gettimeform function)?
>
>
>Hi John,
Since these functions are not actually used by the system (they are end-user functions but they are in libraries that are used by
other libraries), it is probably best to create your own library, and place in that library the functions that you want to use in
your project. It is not really a good idea to modify the supplied libraries unless you want to submit a modification or bug fix
for general use. We supply the source code for bug tracking and for providing the basis for building a variant, but that variant
should be in its own library as part of your package.Ciao, Neil
June 13, 2012 at 1:49 pm #1952JD KromkowskiParticipantOn 6/11/2012 5:34 AM, Neil Robinson wrote:
> On 07/06/2012 21:12, John D Kromkowski wrote:
> Hi John, Since these functions are not actually used by the system
> (they are end-user functions but they are in libraries that are used
> by other libraries), it is probably best to create your own library,
> and place in that library the functions that you want to use in your
> project. It is not really a good idea to modify the supplied libraries
> unless you want to submit a modification or bug fix for general use.
> We supply the source code for bug tracking and for providing the basis
> for building a variant, but that variant should be in its own library
> as part of your package. Ciao, Neil
Well, I don't know about anybody else but I just don't like the
timepicker as it currently exists. I don't need seconds and unless you
are in the military, using a 24 hour clock, doesn't make a lot of sense
for an office.I'm working my way through changing it, but the only way to test it
seems to be to modify the supplied library, unless I create my own sml,
but I've sort of afraid of how in the weeds I could get myself.As to the calendar form, I just want in the first instance a better
color used to ID the current date, it is really hard to see now.June 15, 2012 at 6:46 am #1953MichaelKeymasterOn 13/06/2012 14:49, John D Kromkowski wrote:
> On 6/11/2012 5:34 AM, Neil Robinson wrote:
>> On 07/06/2012 21:12, John D Kromkowski wrote: Hi John, Since these functions are not actually used by the system (they are
>> end-user functions but they are in libraries that are used by other libraries), it is probably best to create your own
>> library, and place in that library the functions that you want to use in your project. It is not really a good idea to modify
>> the supplied libraries unless you want to submit a modification or bug fix for general use. We supply the source code for bug
>> tracking and for providing the basis for building a variant, but that variant should be in its own library as part of your
>> package. Ciao, Neil
> Well, I don't know about anybody else but I just don't like the timepicker as it currently exists. I don't need seconds and
> unless you are in the military, using a 24 hour clock, doesn't make a lot of sense for an office.That may be true in the US, but in a lot of countries they use the 24-hour clock as standard. As for the seconds issue, just add
an option as a boolean. In fact, I have just changed and added two options, one for showing seconds, and one for the am/pm clock.
I will email you the changes.> I'm working my way through changing it, but the only way to test it seems to be to modify the supplied library, unless I create
> my own sml, but I've sort of afraid of how in the weeds I could get myself.
>
> As to the calendar form, I just want in the first instance a better color used to ID the current date, it is really hard to see
> now.That could also be modified by just adding some color options that are passed in.
Ciao, Neil
June 19, 2012 at 10:24 pm #1954JD KromkowskiParticipantOn 6/15/2012 2:46 AM, Neil Robinson wrote:
> On 13/06/2012 14:49, John D Kromkowski wrote:
>> On 6/11/2012 5:34 AM, Neil Robinson wrote:
>>> On 07/06/2012 21:12, John D Kromkowski wrote: Hi John, Since these functions are not actually used by the system (they are
>>> end-user functions but they are in libraries that are used by other libraries), it is probably best to create your own
>>> library, and place in that library the functions that you want to use in your project. It is not really a good idea to modify
>>> the supplied libraries unless you want to submit a modification or bug fix for general use. We supply the source code for bug
>>> tracking and for providing the basis for building a variant, but that variant should be in its own library as part of your
>>> package. Ciao, Neil
>> Well, I don't know about anybody else but I just don't like the timepicker as it currently exists. I don't need seconds and
>> unless you are in the military, using a 24 hour clock, doesn't make a lot of sense for an office.
> That may be true in the US, but in a lot of countries they use the 24-hour clock as standard. As for the seconds issue, just add
> an option as a boolean. In fact, I have just changed and added two options, one for showing seconds, and one for the am/pm clock.
> I will email you the changes.I was out of office. I've seen the email and will take a look.
The problem is not so much how to make the necessary change in the
timepicker.sma (or the datepicker.sma), it what to do next. I
initially rebuilt the uisyshelp project which naturally changed the
..sml but then I started getting worried about changing supplied
libraries and what the might mean.Also the supplied libraries are in two places:
C:\Program Files\SIMPOL\lib
and in each of the individual projects, e.g.
C:\Program Files\SIMPOL\Projects\Libs\uisyshelp\uisyshelp
So it started to get confusing to me what (i.e. which dir) I was
supposed to "include". Do I include the "lib" dir or do include the
individual project dir?All of this thinking made start wondering at what point does one make
their own lib. There are a whole lot of functions in a whole lot of
smas which make up a whole lot of supplied libraries(smls) and there is
there overlap where the same functions are part of two different smls.> I'm working my way through changing it, but the only way to test it seems to be to modify the supplied library, unless I create
> my own sml, but I've sort of afraid of how in the weeds I could get myself.
>
> As to the calendar form, I just want in the first instance a better color used to ID the current date, it is really hard to see
> now.
> That could also be modified by just adding some color options that are passed in.
Yeah, it was easy enough to change the calendarform.smaJust change the constant TODAYBTNCOLOR.
But then what? Rebuild the Uisyshelp project, well that sets one
potentially down a certain path of spaghetti.I'd think that in theory, one would add those constants in the calendar
form as properties of the datepickerinfo type.And the 12/24 and am/pm and IncludeSeconds would be part of a
timepickerinfo type (which right now doesn't even exist. Its kind of
inconstistant to have a datepicker.sma and calendarform.sma but not a
timepicker.sma and timeselectform.sma. This is niggling of course.So bottom line, what do I do with the changes you sent me? put in
uisyshelp project and recompile/rebuild?>
> Ciao, Neil
>
>June 20, 2012 at 8:55 pm #1955MichaelKeymasterOn 19/06/2012 23:24, John D Kromkowski wrote:
> On 6/15/2012 2:46 AM, Neil Robinson wrote:
>> On 13/06/2012 14:49, John D Kromkowski wrote:
>>> On 6/11/2012 5:34 AM, Neil Robinson wrote:
>>>> On 07/06/2012 21:12, John D Kromkowski wrote: Hi John, Since these functions are not actually used by the system (they
>>>> are end-user functions but they are in libraries that are used by other libraries), it is probably best to create your
>>>> own library, and place in that library the functions that you want to use in your project. It is not really a good idea
>>>> to modify the supplied libraries unless you want to submit a modification or bug fix for general use. We supply the
>>>> source code for bug tracking and for providing the basis for building a variant, but that variant should be in its own
>>>> library as part of your package. Ciao, Neil
>>> Well, I don't know about anybody else but I just don't like the timepicker as it currently exists. I don't need seconds
>>> and unless you are in the military, using a 24 hour clock, doesn't make a lot of sense for an office.
>> That may be true in the US, but in a lot of countries they use the 24-hour clock as standard. As for the seconds issue, just
>> add an option as a boolean. In fact, I have just changed and added two options, one for showing seconds, and one for the
>> am/pm clock. I will email you the changes.
>
> I was out of office. I've seen the email and will take a look.
>
> The problem is not so much how to make the necessary change in the timepicker.sma (or the datepicker.sma), it what to do next.
> I initially rebuilt the uisyshelp project which naturally changed the ..sml but then I started getting worried about
> changing supplied libraries and what the might mean.That is probably the best reason not to modify these libraries. The uisyshelp.sml is used way up the chain, in databaseforms.sml,
which is used by formlib.sml, and that in turn by appframework.sml. There are other libraries that also use uisyshelp.sml,
including mrulib.sml, gaugelib.sml.The way I build all of these automatically, is to use the IDE. Open an empty IDE, go to the Tools menu and from there select
Project Dependencies. Then in the top box enter the path to the projectslibs folder and hit Return (Enter). That will then check
all projects to see if they need rebuilding. Then when it finishes, you can right click on the top node and pick "Rebuild if
needed" and it will automatically rebuild all the projects in the right order. This technique can also be used for your own more
complicated projects, that might include your own libraries.> Also the supplied libraries are in two places:
>
> C:\Program Files\SIMPOL\lib
>
> and in each of the individual projects, e.g.That is because you should normally include the libraries from the lib directory (one central location for them all) rather than
having to look around for them. Each of those projects has a secondary build target that is the lib directory.> C:\Program Files\SIMPOL\Projects\Libs\uisyshelp\uisyshelp
>
> So it started to get confusing to me what (i.e. which dir) I was supposed to "include". Do I include the "lib" dir or do
> include the individual project dir?
>
> All of this thinking made start wondering at what point does one make their own lib. There are a whole lot of functions in a
> whole lot of smas which make up a whole lot of supplied libraries(smls) and there is there overlap where the same functions
> are part of two different smls.You shouldn't find an exported function that is in more than one supplied library. It is true that libraries include other
libraries, but that is dealt with by the IDE during the build process. It only includes one copy of each library.>> I'm working my way through changing it, but the only way to test it seems to be to modify the supplied library, unless I
>> create my own sml, but I've sort of afraid of how in the weeds I could get myself.
>>
>> As to the calendar form, I just want in the first instance a better color used to ID the current date, it is really hard to
>> see now. That could also be modified by just adding some color options that are passed in.
> Yeah, it was easy enough to change the calendarform.smaBetter would be to change the datepicker() function to take some color information that is then applied before it is shown.
> Just change the constant TODAYBTNCOLOR.
>
> But then what? Rebuild the Uisyshelp project, well that sets one potentially down a certain path of spaghetti.
>
> I'd think that in theory, one would add those constants in the calendar form as properties of the datepickerinfo type.
>
> And the 12/24 and am/pm and IncludeSeconds would be part of a timepickerinfo type (which right now doesn't even exist. Its
> kind of inconstistant to have a datepicker.sma and calendarform.sma but not a timepicker.sma and timeselectform.sma. This is
> niggling of course.
>
> So bottom line, what do I do with the changes you sent me? put in uisyshelp project and recompile/rebuild?You can make the changes to uisyshelp by copying the new files in, then rebuild. After, open an empty IDE and use the
Tools->Project Dependencies to rebuild whichever projects are required in the ProjectsLibs directory.Ciao, Neil
June 21, 2012 at 5:32 pm #1956JD KromkowskiParticipantbtnface =@ systemcolors.colors[COLOR_BTNFACE]
in tcombos.sma now throws an error 21?
I can't seem to see why.
June 21, 2012 at 5:35 pm #1957JD KromkowskiParticipantOn 6/21/2012 1:32 PM, John D Kromkowski wrote:
> btnface =@ systemcolors.colors[COLOR_BTNFACE]
>
> in tcombos.sma now throws an error 21?
>
> I can't seem to see why.have figured it out.
I commented out, thinking it was unnecessary, this line from tcombos.sma
include "uisyshelphdr.sma"
when I put it back in, things work. I still don't get why though since
uisyshelpdr.sma is included with uisyshelp.sma.June 22, 2012 at 2:38 pm #1958JD KromkowskiParticipantAm trying to use those changes you provided, but in this function below,
from the toolbar.smafunction selectrecord(appwindow appw, string operation, boolean
silent=.false)I get an error 21 on this line shown
else if operation == "selectcurrent"
r =@ appw.form.selectcurrent(error=e)
//ERROR here// if e == iERR_SBL_EOF or e == iERR_NORMALENDOFDATAI don't understand why. This is happening when the program should be
opening up the initial form. I haven't changed anything except to use
the uisyshelp you provided.This happens when the form is initially trying to open for the first time.
The value of e is 0 and I can see that the record r is selected ok. So I
don't understand.JDK
June 22, 2012 at 4:13 pm #1959JD KromkowskiParticipantIf I replace this line with
//selectrecord(appw, "selectcurrent", silent=.true)
appw.form.selectcurrent()
things work, so it is not my forms (which by the way function perfectly
fine in Personal).JDK
On 6/22/2012 10:38 AM, John D Kromkowski wrote:
> Am trying to use those changes you provided, but in this function
> below, from the toolbar.sma
>
> function selectrecord(appwindow appw, string operation, boolean
> silent=.false)
>
> I get an error 21 on this line shown
>
> else if operation == "selectcurrent"
> r =@ appw.form.selectcurrent(error=e)
> //ERROR here// if e == iERR_SBL_EOF or e == iERR_NORMALENDOFDATA
>
>
> I don't understand why. This is happening when the program should be
> opening up the initial form. I haven't changed anything except to use
> the uisyshelp you provided.
>
> This happens when the form is initially trying to open for the first
> time.
>
> The value of e is 0 and I can see that the record r is selected ok. So
> I don't understand.
>
> JDKJune 22, 2012 at 4:45 pm #1961JD KromkowskiParticipantSorry to be a pest, but it is pretty clear that the problem is not
localized to just the
operation "selectcurrent", but all of the operations in selectrecord()
don't seem to work.They all seem to fall down at the error check
if e == …
I can run the sbair application, and mine is pretty much a copy from it,
so I really can figure outBut if I comment out this stuff for each of the operations
//if e == iERR_SBL_EOF or e == iERR_NORMALENDOFDATA and reccount > 0
//wxmessagedialog(appw.w, "End of table", w.app.title, "ok",
"information")
// appw.sb.settext("End of table")
// appw.fastselection=.false
// delay = 2000000
// !beginthread(clearstatusbar, appw.sb, delay)
//else if e != 0 and reccount > 0
//wxmessagedialog(appw.w, "Error number " + .tostr(e, 10),
appw.app.title, "ok", "error")
// appw.sb.settext("Error number " + .tostr(e, 10))
// delay = 4000000
// !beginthread(clearstatusbar, appw.sb, delay)
//end ifThe program runs fine.
On 6/22/2012 12:13 PM, John D Kromkowski wrote:
>
> If I replace this line with
>
> //selectrecord(appw, "selectcurrent", silent=.true)
>
> appw.form.selectcurrent()
>
> things work, so it is not my forms (which by the way function
> perfectly fine in Personal).
>
> JDK
>
>
>
>
>
>
> On 6/22/2012 10:38 AM, John D Kromkowski wrote:
>> Am trying to use those changes you provided, but in this function
>> below, from the toolbar.sma
>>
>> function selectrecord(appwindow appw, string operation, boolean
>> silent=.false)
>>
>> I get an error 21 on this line shown
>>
>> else if operation == "selectcurrent"
>> r =@ appw.form.selectcurrent(error=e)
>> //ERROR here// if e == iERR_SBL_EOF or e == iERR_NORMALENDOFDATA
>>
>>
>> I don't understand why. This is happening when the program should be
>> opening up the initial form. I haven't changed anything except to use
>> the uisyshelp you provided.
>>
>> This happens when the form is initially trying to open for the first
>> time.
>>
>> The value of e is 0 and I can see that the record r is selected ok.
>> So I don't understand.
>>
>> JDK
>June 22, 2012 at 5:17 pm #1960MichaelKeymasterOn 22/06/2012 15:38, John D Kromkowski wrote:
> Am trying to use those changes you provided, but in this function below, from the toolbar.sma
>
> function selectrecord(appwindow appw, string operation, boolean silent=.false)
>
> I get an error 21 on this line shown
>
> else if operation == "selectcurrent" r =@ appw.form.selectcurrent(error=e) //ERROR here// if e == iERR_SBL_EOF or e ==
> iERR_NORMALENDOFDATA
>
>
> I don't understand why. This is happening when the program should be opening up the initial form. I haven't changed anything
> except to use the uisyshelp you provided.
>
> This happens when the form is initially trying to open for the first time.
>
> The value of e is 0 and I can see that the record r is selected ok. So I don't understand.
>
> JDKJohn,
Error 21 is the most common error in SIMPOL. It basically means that either something has been misspelt or hasn't been included.
From the looks of things, you also commented out errors.sma. It is definitely not a good idea to comment out includes in a
standard library project. The errors.sma provides a list of constant definitions that are used during compilation so that instead
of putting numeric values into your code you can provide an error name that equates to the error value.Ciao, Neil
June 23, 2012 at 12:51 am #1963JD KromkowskiParticipantOn 6/22/2012 1:17 PM, Neil Robinson wrote:
> On 22/06/2012 15:38, John D Kromkowski wrote:
I didn't comment out "errors.sma".That include is part of myapp.sma, just like it is in the sbair.sma.
And while debug if hover over, iERR_SBL_EOF and IERR_NORMALENDOFDATA I
can see that they are assigned to the appropriate constant values as
assigned in the errors.sma.Ok, so I look closer at the sbair project. Does the order of the
includes matter?Because I see in sbair in is
include "errors.sma"
include "tbcombos.sma"
include "toolbar.sma"
include "mainmenu.sma"but in my app I had
include "mainmenu.sma"
include "ComboD.sma"
// my version of a listpickerinclude "PreForm.sma"
//basically the function preform(appwindow appw) and the event handlers
for each form, eg
//function Emp_onnewrecord(dataform1 me, appwindow appw), etcinclude "tbcombos.sma"
include "toolbar.sma"
include "errors.sma"When I switched the order of the includes to put errors.sma first,
problem went a way. Is this a bug or just something I should have know
about?>> Am trying to use those changes you provided, but in this function below, from the toolbar.sma
>>
>> function selectrecord(appwindow appw, string operation, boolean silent=.false)
>>
>> I get an error 21 on this line shown
>>
>> else if operation == "selectcurrent" r =@ appw.form.selectcurrent(error=e) //ERROR here// if e == iERR_SBL_EOF or e ==
>> iERR_NORMALENDOFDATA
>>
>>
>> I don't understand why. This is happening when the program should be opening up the initial form. I haven't changed anything
>> except to use the uisyshelp you provided.
>>
>> This happens when the form is initially trying to open for the first time.
>>
>> The value of e is 0 and I can see that the record r is selected ok. So I don't understand.
>>
>> JDK
>
> John,
>
> Error 21 is the most common error in SIMPOL. It basically means that either something has been misspelt or hasn't been included.
> From the looks of things, you also commented out errors.sma. It is definitely not a good idea to comment out includes in a
> standard library project. The errors.sma provides a list of constant definitions that are used during compilation so that instead
> of putting numeric values into your code you can provide an error name that equates to the error value.
>
> Ciao, NeilJune 25, 2012 at 10:24 am #1964MichaelKeymasterOn 23/06/2012 01:51, John D Kromkowski wrote:
> include "tbcombos.sma" include "toolbar.sma" include "errors.sma"
>
> When I switched the order of the includes to put errors.sma first, problem went a way. Is this a bug or just something I
> should have know about?Not a bug, but something you need to be aware of. The compiler is a single pass complier, so it processes the include files in the
order it hits them. That is why constants used throughout the project need to be at the front of the include list.Ciao, Neil
June 25, 2012 at 6:30 pm #1965JD KromkowskiParticipantOn 6/25/2012 6:24 AM, Neil Robinson wrote:
> On 23/06/2012 01:51, John D Kromkowski wrote:
>> include "tbcombos.sma" include "toolbar.sma" include "errors.sma"
>>
>> When I switched the order of the includes to put errors.sma first, problem went a way. Is this a bug or just something I
>> should have know about?
> Not a bug, but something you need to be aware of. The compiler is a single pass complier, so it processes the include files in the
> order it hits them. That is why constants used throughout the project need to be at the front of the include list.
>
> Ciao, Neil
Ok. Is this in the documentation that I missed? On related note:Could (Should) the
include "uisyshelphdr.sma"
statement which is part of tcombos.sma, just be put in the primary.sma?
And if you link to the uisyshelp.sml (under "settings"), why do you even
need to include uisyshelpdr.sma - AuthorPosts
- You must be logged in to reply to this topic.