Skip to content

opendataform1 and ppcstype

Forums Forums SIMPOL Programming opendataform1 and ppcstype

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #188
    JD Kromkowski
    Participant

    Consider the following function to load a form. //Loads the Main Form function SimpleForm(integer error) dataform1 f string filename; filename = “C:SIMPOLFormsPayrollForm1.sxf” string errtext; errtext = “” f =@ opendataform1(filename, error=error, errortext=errtext) end function f If I go to Personal and open the datasource for this form as ppcstype1 and then open form. Then modify form and save it as “PayrollForm2.sxf”. I now have a form that accessess the TABLE as a ppcstype1. However, the above code won’t work unless I have simpolserver.smp running with the proper .cfg file first. Right now, I’d have to do that manually. What would the code look like to run simpolserver.smp from within this function. In Superbase, I could either do CALL “C:SIMPOLbinsmprun32.exe C:SIMPOLUtilitiessimpolserversimpolserver.smp jdk.cfg” or I could do a shellexecute and pass the command line as rncmd$ What do I do in SIMPOL?

    #1663
    Michael
    Keymaster

    JDK wrote:
    > Consider the following function to load a form.
    >
    > //Loads the Main Form function SimpleForm(integer error) dataform1 f
    > string filename; filename = "C:SIMPOLFormsPayrollForm1.sxf"
    > string errtext; errtext = "" f =@ opendataform1(filename,
    > error=error, errortext=errtext)
    >
    > end function f
    >
    >
    > If I go to Personal and open the datasource for this form as
    > ppcstype1 and then open form. Then modify form and save it as
    > "PayrollForm2.sxf".
    >
    > I now have a form that accessess the TABLE as a ppcstype1.
    >
    > However, the above code won't work unless I have simpolserver.smp
    > running with the proper .cfg file first.
    >
    > Right now, I'd have to do that manually.
    >
    > What would the code look like to run simpolserver.smp from within
    > this function.
    >
    > In Superbase, I could either do
    >
    > CALL "C:SIMPOLbinsmprun32.exe
    > C:SIMPOLUtilitiessimpolserversimpolserver.smp jdk.cfg"
    >
    > or I could do a shellexecute and pass the command line as rncmd$
    >
    > What do I do in SIMPOL?

    I think the more important thing to consider, is do you want to have
    that code inside the application? The server would normally be running
    on a completely separate machine, so trying to run it locally if you
    can't find it isn't necessarily going to help. Especially if this code
    is on every user's machine. Even using PPCS with Superbase, you would
    have had a completely separate instance of Superbase acting as the
    server somewhere. PPCS is essentially a client/server protocol for
    accessing ISAM databases.

    To run an external command check out !execute().

    Ciao, Neil

    #1768
    JD Kromkowski
    Participant

    Let's say I want to run SBAIR (or something like it) on a network. Won't I
    need to have simpolserver running on each workstation?

    I guess I confused about how this would work.

    network

    Workstation A
    Workstation B
    Workstation C

    In order to "share" the data, are you suggesting that I only need to have
    simpolserver running on one of the machines? I don't see how that works.

    In SB2, in order to a have a multiuser desktop application, I need to have
    the lan installed which creates a ini unique to each machine that gets
    everything pointed to the correct superbase.net file AND I have to make
    sure to open the data as SHAREd, not exclusive. That happens on every
    machine.

    I have not gotten so far to try to run what I have written in SIMPOL on
    multiple machines, although I have gone as far as opening up multiple
    instance of it on the same machine which seems to work fine, so a change
    to data in instance 1 shows up on instance 2. no problems.

    I can already forsee issues (not insurmountable) with mapping the correct
    name of the drives.

    I don't think there is actual documentation on how to do this, is there?

    JDK

    Neil Robinson wrote:

    > I think the more important thing to consider, is do you want to have
    > that code inside the application? The server would normally be running
    > on a completely separate machine, so trying to run it locally if you
    > can't find it isn't necessarily going to help. Especially if this code
    > is on every user's machine. Even using PPCS with Superbase, you would
    > have had a completely separate instance of Superbase acting as the
    > server somewhere. PPCS is essentially a client/server protocol for
    > accessing ISAM databases.

    > To run an external command check out !execute().

    > Ciao, Neil

    #1427
    Michael
    Keymaster

    JDK wrote:
    > Let's say I want to run SBAIR (or something like it) on a network.
    > Won't I need to have simpolserver running on each workstation?

    No. You have one copy of simpolserver running somewhere. It could be in
    your local area network, it could be on the other side of the Internet.

    > I guess I confused about how this would work.
    >
    > network
    >
    > Workstation A
    > Workstation B
    > Workstation C
    >
    > In order to "share" the data, are you suggesting that I only need to
    > have simpolserver running on one of the machines? I don't see how
    > that works.

    You don't actually need it running on *any* of the client workstations.
    The server can run on any machine that the others can see using UDP/IP.
    Once it is running, it opens the database files exclusively. To access
    the tables that you have shared, you just put in the IP address and port
    number of the server.

    For instance, let's say you have a peer-to-peer network, with no central
    machine at all. But to make things easier, let's assume that one of the
    client workstations is considered to be the server. On that machine you
    run simpolserver. Let's assume that is machine A. Let us also assume you
    are running a typical internal Class C network with private addresses in
    the range; 192.168.0.1-192.168.0.254. Assume for a minute that the
    server workstation is on 192.168.0.2, and the others are on 192.168.0.3
    and 192.168.0.4.

    In the startup code for the application, everybody will be connecting to
    192.168.0.2:4000 for example (assuming you are running the server on
    that port).
    To make it more mobile, you can store that information in an INI file
    somewhere and retrieve it when you start the program. Or you can pass it
    on the command line.

    > In SB2, in order to a have a multiuser desktop application, I need to
    > have the lan installed which creates a ini unique to each machine
    > that gets everything pointed to the correct superbase.net file AND I
    > have to make sure to open the data as SHAREd, not exclusive. That
    > happens on every machine.

    That is because you are not talking about a client/server protocol. That
    is a cooperative networking method that makes use of DOS 3.3 byte range
    locks to lock bits of a network control file (that is why you have
    FOO.SB! files). Each client has to check in the specific section of the
    network control file for the record it wants to lock, to see if it is
    available. It won't report that the record is locked if it can't lock
    the related bits in the file. Each client does this cooperatively. With
    simpolserver, the server does all of that. It worries about whether the
    record is locked, and by whom. The client asks the server to lock the
    record, and to unlock it. To deal with the issue of a client going down,
    or on the Internet a user just not completing a process, PPCS also has
    the concept of a lock timeout. This is how long the server will leave a
    record in a specific table locked, before freeing it. Each lock timeout
    can be established separately.

    > I have not gotten so far to try to run what I have written in SIMPOL
    > on multiple machines, although I have gone as far as opening up
    > multiple instance of it on the same machine which seems to work fine,
    > so a change to data in instance 1 shows up on instance 2. no
    > problems.
    >
    > I can already forsee issues (not insurmountable) with mapping the
    > correct name of the drives.

    Just put the code on each machine. They don't need a drive mapping.

    > I don't think there is actual documentation on how to do this, is
    > there?

    This will be the subject of a forthcoming chapter in the Quick Start Guide.

    For people who have used PPCS before, it is no different than it was.

    Ciao, Neil

    #1769
    JD Kromkowski
    Participant

    > This will be the subject of a forthcoming chapter in the Quick Start Guide.

    Well I look forward to this.

    I can understand when you say you'd just put in "192.168.0.2:4000" (e.g.)
    as the location when opening a datasource as a ppcstype in Personal (i.e.
    instead of "127.0.0.1:4000"). Under those circumstances I can see (in
    theory) how it might work.

    But the problem is that in the code I use I don't even "put in"
    127.0.0.1:4000 to open a form as multi-user. I am just using code akin to:

    //Loads the Main Form
    function SimpleForm(integer error)
    dataform1 f
    string filename;
    filename = "C:SIMPOLFormsMyPpcstypeForm.sxf"
    string errtext; errtext = ""
    f =@ opendataform1(filename, error=error, errortext=errtext)

    end function f

    And in creating MyPpcstypeForm.sxf I don't even "put in" a location
    (neither 127.0.0.1:4000 nor 192.168.0.2:4000)

    Here is how I've been creating the form.

    1. I first create MySbmeForm.sxf. Then I close down Personal.

    2. I then run simpolserver with a cfg that properly lists the table use in
    MySbmeForm.sxf.

    3. I then restart Personal and open MySbmeForm.sxf. I choose Modify Form.
    I then save the form as "MyPpcstypeForm.sxf".

    4. So now I have a multi-userform. My function SimpleForm() will only
    work if simpolserver is running and I can open more than one instance of
    the form on the Machine that has simpolserver running as one would expect.

    But if I go to another machine on the network, I can't open that
    MyPpcstypeForm.sxf.

    a. Do I need to have more than one copy of MyPpcstypeForm.sxf? (one for
    each machine?)
    b. I still can't figure out how the second machine would know the port
    was 198.168.0.2:4000. Since that was never identified during any part of
    the process.

    In fact, if inspect the form, I see:

    <datasource>
    <sourcetype>ppcstype1</sourcetype>
    <source>127.0.0.1:4000</source>
    <sdf1table master="y">MYTABLE1</sdf1table>
    </datasource>

    Do I have to go in and manually change that to

    <datasource>
    <sourcetype>ppcstype1</sourcetype>
    <source>198.168.0.2:4000</source>
    <sdf1table master="y">MYTABLE1</sdf1table>
    </datasource>

    #1771
    JD Kromkowski
    Participant

    Ok, things are moving in a direction I understand.

    Two more questions:

    1. Why store locations in an INI? Why not in a Table? This is more a
    philosophical question of programming?

    2. Can two machines use the same form. By that I mean the same file. Or
    do you have to have copies on each machine. Is the actual .sfx being used
    (on a continuous basis) or is it really just being read once in order to
    create the form in a memory space. My thought is that it is the later
    since I've run multiple instances of my program on the same machine both
    referring to the single .sfx file. I suppose that this is the reason you'd
    want to run code in the program to create the form rather than using
    opendataform1(), because in the later case you would have to keep track of
    how drives are mapped unless you had copies of the .sfx on each machine.

    #1398
    Michael
    Keymaster

    JDK wrote:
    > In fact, if inspect the form, I see:
    >
    > <datasource> <sourcetype>ppcstype1</sourcetype>
    > <source>127.0.0.1:4000</source> <sdf1table
    > master="y">MYTABLE1</sdf1table> </datasource>
    >
    > Do I have to go in and manually change that to
    >
    > <datasource> <sourcetype>ppcstype1</sourcetype>
    > <source>198.168.0.2:4000</source> <sdf1table
    > master="y">MYTABLE1</sdf1table> </datasource>

    That is one way. Another, if you are writing your own code, is to leave
    the form setup to use the SBME datasource, and open the tables first
    using PPCS (the way it is done in the addressbook example). As for the
    IP address and port number, the server needs to be located on a machine
    with a known IP address. If you have multiple client machines, they
    still all only need to access the IP address of the server (127.0.0.1 is
    a local loopback address and always points to your own machine). You can
    also store the IP address and port number in an ini file and load it at
    start. Or pass it on the command line, etc. See the library conflib.sml
    (source project is there as well).

    Ciao, Neil

    #1772
    JD Kromkowski
    Participant

    Ok, so I have been able to open up the same tables now on two separate
    machines, using Personal as the test front end.

    I suppose there must be a programmatic way to find out the ip address
    where the server is running, rather than manually using a cmd console and
    ipconfig and then using pencil,paper, sneakernet configuration method!

    Opening the table using Person in record view worked fine for the test but
    I started getting crashes when trying form views (I think this means you
    need to have a form on each machine) but even trying to use Personal to
    create forms in the multi-user configuration led to shutdowns. Here again
    I can't tell if there is bug or if I am trying to do things that were
    never intended.

    I think though I can see the light at the end of a tunnel. Certainly look
    forward to seeing how detailblocks (multiline) will be implemented. The
    data aware grid to me is a rather clunky looking substitute but I have it
    working pretty well now that I've been able to just put the forms into a
    wxdialog.

    (P.S., I still think it would make way more sense for each window to have
    its own wxprocess, Eg

    w1.wxprocess()
    w2.wxprocess()

    I suppose using threading could be a way to do this.

    While I can appreciate your application framework. I'd have to say that
    the way I am approaching the problem(as a non-programmer) is, at least to
    my way of thinking, quite a bit more parsimonious.

    #1571
    Michael
    Keymaster

    JDK wrote:
    > Ok, things are moving in a direction I understand.
    >
    > Two more questions:
    >
    > 1. Why store locations in an INI? Why not in a Table? This is more
    > a philosophical question of programming?

    If you store it in a table, it would have to in a local directory, since
    if it were an *.sbm, and two people tried to open it at once, it would
    fail for one of them. An ini file is just text, and can be read by more
    than one at a time.

    > 2. Can two machines use the same form. By that I mean the same
    > file. Or do you have to have copies on each machine. Is the actual
    > .sfx being used (on a continuous basis) or is it really just being
    > read once in order to create the form in a memory space. My thought
    > is that it is the later since I've run multiple instances of my
    > program on the same machine both referring to the single .sfx file. I
    > suppose that this is the reason you'd want to run code in the program
    > to create the form rather than using opendataform1(), because in the
    > later case you would have to keep track of how drives are mapped
    > unless you had copies of the .sfx on each machine.

    The sfx file is just loaded into memory. Multiple machines can use the
    same sfx file. If you are using opendataform1(), as long as you pass it
    the array of tables and all the tables required by the form are in the
    array, then it won't try to open any from the information in the form.
    Just the way it works in Superbase.

    Ciao, Neil

    #1406
    Michael
    Keymaster

    JDK wrote:
    > Ok, so I have been able to open up the same tables now on two
    > separate machines, using Personal as the test front end.

    Good.

    > I suppose there must be a programmatic way to find out the ip address
    > where the server is running, rather than manually using a cmd
    > console and ipconfig and then using pencil,paper, sneakernet
    > configuration method!

    Normally, you would place the server on a machine with a known IP
    address. The best way would be to give that machine a fixed IP address,
    rather than use DHCP. Just give it an address outside the DHCP range
    (this usually includes around 25-50 addresses from the full range of a
    class C address 192.168.x.1-192.168.x.254 – the 0 and 255 addresses
    should not be used, they have special meaning). The ipconfig route is
    fine if you are using DHCP, but if the address could change, it is
    better to fix it to a specific one in that range for the server machine.

    > Opening the table using Person in record view worked fine for the
    > test but I started getting crashes when trying form views (I think
    > this means you need to have a form on each machine) but even trying
    > to use Personal to create forms in the multi-user configuration led
    > to shutdowns. Here again I can't tell if there is bug or if I am
    > trying to do things that were never intended.

    It depends. There could still be undiscovered bugs in some of the form
    code. I test it as well as possible, but invariably someone will use
    some constellation that I haven't tried yet, and it may fail. Generally
    speaking, if the tables are opened first, and then the forms (in the
    same window) they will use the existing open tables.

    > I think though I can see the light at the end of a tunnel. Certainly
    > look forward to seeing how detailblocks (multiline) will be
    > implemented. The data aware grid to me is a rather clunky looking
    > substitute but I have it working pretty well now that I've been able
    > to just put the forms into a wxdialog.

    Detail blocks are what I am working on at the moment. They should be
    more powerful than the grid control, they will certainly be more
    flexible. I would really like to see people discuss what they want from
    detail blocks, since this is a rare opportunity to revisit them. I am
    certainly trying to address a number of shortcomings that I perceived in
    them in the past.

    > (P.S., I still think it would make way more sense for each window to
    > have its own wxprocess, Eg

    We originally considered that, but it is unnecessary. There is only one
    wxprocess() statement required for all windows. However, for modal
    dialogs, you do have a separate wxdialog.processmodal() method.

    > w1.wxprocess() w2.wxprocess()
    >
    > I suppose using threading could be a way to do this.

    I don't see why you think it matters. Personal only uses one wxprocess()
    in a run loop (like in the samples), no matter how many windows are open.

    > While I can appreciate your application framework. I'd have to say
    > that the way I am approaching the problem(as a non-programmer) is, at
    > least to my way of thinking, quite a bit more parsimonious.

    Undoubtedly. The framework was designed to also handle any number of
    windows, each with its own form. It also uses multiple threads, by using
    the defer() mechanism. That mechanism is essential if you want to avoid
    losing data during data-entry, since the user pressing Ctrl+S to save a
    record would lose the data in the current field if they just entered it.
    The onlostfocus event of the control won't fire before the Save() takes
    place, so the content of the control wouldn't be assigned to the
    underlying field until afterwards.

    Ciao, Neil

    #1774
    JD Kromkowski
    Participant

    You've suggested the following:

    1. Open the datasource and tables to be used
    2. Open the form

    In SBL this is pretty easy:

    OPEN FILE SHARE "D:SB4WDATAMyTable.SBF"
    OPEN FORM "D:SB4WFORMSMyForm.SBV"

    This is probably very easy but I want to make sure that I understand how
    this would work in the most simple of terms. How would you modify below
    to accomplish this. Where,

    datasource is "C:SIMPOLDataMyData.sbm"
    tables used are "MyTable1" and "MyTable2"
    and form is "C:SIMPOLFormsMyForm.sxf"

    function main()
    dataform1 f;
    wxwindow w;
    wxmenubar mb;
    wxtoolbar tb
    integer iErrnum;iErrnum = 0
    w =@ wxwindow.new(10,10,990,638,captiontext="Caption ",error=iErrnum)
    f =@ SimpleForm(iErrnum)
    if w =@= .nul
    string sResult
    sResult = "Error number: " + .tostr(iErrnum, 10)
    + " opening main window{d}{a}"
    else
    w.onvisibilitychange.function =@ quit
    //mb =@ CreateMainMenu(f)
    //mb.setwindow(w)
    //tb =@ CreateToolBar(f)
    //tb.setwindow(w)
    f.selectfirst()
    f.setcontainer(w)
    wxprocess(.inf)
    end if
    end function

    function SimpleForm(integer error)
    dataform1 f
    string filename
    filename = "C:SIMPOLFormsMyForm.sxf"
    string errtext
    errtext = ""
    f =@ opendataform1(filename, error=error, errortext=errtext)

    end function f

    #1391
    Michael
    Keymaster

    JDK wrote:
    > You've suggested the following:
    >
    > 1. Open the datasource and tables to be used
    > 2. Open the form
    >
    > In SBL this is pretty easy:
    >
    > OPEN FILE SHARE "D:SB4WDATAMyTable.SBF"
    > OPEN FORM "D:SB4WFORMSMyForm.SBV"
    >
    > This is probably very easy but I want to make sure that I understand
    > how this would work in the most simple of terms. How would you
    > modify below to accomplish this. Where,
    >
    > datasource is "C:SIMPOLDataMyData.sbm" tables used are
    > "MyTable1" and "MyTable2" and form is "C:SIMPOLFormsMyForm.sxf"
    >
    > datasource is "C:SIMPOLDataMyData.sbm"
    > tables used are "MyTable1" and "MyTable2"
    > and form is "C:SIMPOLFormsMyForm.sxf"
    >
    > function main()
    > dataform1 f;
    > wxwindow w;
    > wxmenubar mb;
    > wxtoolbar tb
    > integer iErrnum;iErrnum = 0
    > w =@ wxwindow.new(10,10,990,638,captiontext="Caption ",error=iErrnum)
    > f =@ SimpleForm(iErrnum)
    > if w =@= .nul
    > string sResult
    > sResult = "Error number: " + .tostr(iErrnum, 10)
    > + " opening main window{d}{a}"
    > else
    > w.onvisibilitychange.function =@ quit
    > //mb =@ CreateMainMenu(f)
    > //mb.setwindow(w)
    > //tb =@ CreateToolBar(f)
    > //tb.setwindow(w)
    > f.selectfirst()
    > f.setcontainer(w)
    > wxprocess(.inf)
    > end if
    > end function
    >
    > function SimpleForm(integer error)
    > dataform1 f
    > string filename
    > filename = "C:SIMPOLFormsMyForm.sxf"
    > string errtext
    > errtext = ""
    > f =@ opendataform1(filename, error=error, errortext=errtext)
    >
    > end function f

    It depends on whether you are using ppcs or not. The code is slightly
    different. Also, although the Superbase code looks easy, it actually
    isn't, since there is no checking for failure in what you wrote. Also,
    since nothing is global in SIMPOL, you have to pass the information in.

    Assuming you are using the appframework.sml library, it would be easiest
    like this using the application and appwindow objects:

    constant PPCSRETRY 500000
    constant PPCSTIMEOUT 6000000
    constant PPCSTARGET "localhost:4000"
    constant SBMTARGET "C:SIMPOLDataMyData.sbm"
    constant sAPPMSGTITLE "My Application Message"

    function main()
    application app
    appwindow appw
    integer e
    type(db1table) t
    boolean ok
    wxbitmap icon
    datasourceinfo src
    wxmenubar mb
    wxtoolbar tb
    wxstatusbar sb

    ok = .false
    e = 0
    mb =@ createmenu(); // however you do it
    tb =@ createtoolbar(); // if you want,etc.
    sb =@ wxstatusbar.new(error=e)

    app =@ application.new(appiconfile="", iconimagetype="",
    inifilename="", apptitle=sAPPTITLE)
    //app.onexitrequest.function =@ exit
    app.running = .true

    e = 0
    appw =@ appwindow.new(app, visible=.false, mb=mb, tb=tb, sb=sb,
    error=e)
    if appw !@= .nul
    // This is from one of my own programs, you may choose
    // to do this differently
    //initmainmenu(appw.mb, app)
    //appw.onmanagemenu.function =@ managemenu
    //inittoolbar(appw.tb, appw)
    //appw.onmanagetoolbar.function =@ managetoolbar

    // Uncomment the version you need, either PPCS or SBME
    src =@ app.opendatasource("ppcstype1", PPCSTARGET, appw,
    retry=PPCSRETRY, timeout=PPCSTIMEOUT, error=e)
    // src =@ app.opendatasource("sbme1", SBMTARGET, appw, error=e)
    if src =@= .nul
    wxmessagedialog(appw.w, "Error connecting to the data source
    at " + PPCSTARGET, sAPPMSGTITLE, "ok", "error")
    else
    t =@ appw.opendatatable(src, "mytable1", src.username,
    src.password, src.retry, src.timeout, error=e)
    if t =@= .nul
    wxmessagedialog(appw.w, "Error opening the 'mytable1' table",
    sAPPMSGTITLE, "ok", "error")
    else
    t =@ appw.opendatatable(src, "mytable2", src.username,
    src.password, src.retry, src.timeout, error=e)
    if t =@= .nul
    wxmessagedialog(appw.w, "Error opening the 'mytable2' table",
    sAPPMSGTITLE, "ok", "error")
    else
    // If this fails the error will automatically be
    // reported in a dialog
    appw.openformdirect("C:SIMPOLFormsMyForm.sxf",
    sAPPMSGTITLE)
    if appw.form !@= .nul
    // The rest…
    end if
    end if
    end if
    end if
    end if
    end function


    Ciao, Neil

    #1776
    JD Kromkowski
    Participant

    Well, I really wanted to see it at a level above or below (depending on
    your perspective) resorting to using the appframework. This is why I
    simplified the code way down. (Yes, even taking out error checking
    aspects.) I want to see how you do it using formlib.sml and basic SIMPOL.

    So other than adding CONSTANTS, I want to see how you'd modify
    function SimpleForm() to accomplish what is straightforward in SBL.
    For example, I see this line in the sbair program:

    src =@ me.opendatasource("sbme1", "flight.sbm", appw, error=e)

    but there is no way for me to really see what is actually happening when
    opendatasource() is called.

    The same is true for
    t =@ appw.opendatatable(src, "FLIGHT", error=e)

    So, I going to press you again:

    In SBL:
    >> OPEN FILE SHARE ,0"D:SB4WOFFICECASE"
    >> OPEN FORM "D:SB4WFORMSMyForm.SBV"

    In SIMPOL, how would you modify function SimpleForm()?

    constant PPCSRETRY 500000
    constant PPCSTIMEOUT 6000000
    constant PPCSTARGET "localhost:4000"
    constant SBMTARGET "C:SIMPOLDataMyData.sbm"
    constant TABLE1 "MyTable1"
    constant TABLE2 "MyTable2"
    // both tables reside in MyData.sbm
    constant FORM1 "C:SIMPOLFormsMyForm.sxf"

    function main()
    dataform1 f;
    wxwindow w;
    wxmenubar mb;
    wxtoolbar tb
    integer iErrnum;iErrnum = 0
    w =@ wxwindow.new(10,10,990,638,captiontext="Caption ",error=iErrnum)
    f =@ SimpleForm(iErrnum)
    if w =@= .nul
    string sResult
    sResult = "Error number: " + .tostr(iErrnum, 10)
    + " opening main window{d}{a}"
    else
    w.onvisibilitychange.function =@ quit
    //mb =@ CreateMainMenu(f)
    //mb.setwindow(w)
    //tb =@ CreateToolBar(f)
    //tb.setwindow(w)
    f.selectfirst()
    f.setcontainer(w)
    wxprocess(.inf)
    end if
    end function

    function SimpleForm(integer error)
    dataform1 f
    string filename
    filename = "C:SIMPOLFormsMyForm.sxf"
    string errtext
    errtext = ""
    f =@ opendataform1(filename, error=error, errortext=errtext)
    end function f

    NR: > It depends on whether you are using ppcs or not. The code is slightly
    > different. Also, although the Superbase code looks easy, it actually
    > isn't, since there is no checking for failure in what you wrote. Also,
    > since nothing is global in SIMPOL, you have to pass the information in.

    JDK: I left out error checking for failure for simplicity's sake. But
    that would hardly make it that much more complicated if I added an IF …
    EXISTS line. And the no globals is really a red herring, I am perfectly
    able to pass whatever I need to pass.

    JDK

    #1581
    Michael
    Keymaster

    JDK wrote:
    > Well, I really wanted to see it at a level above or below (depending
    > on your perspective) resorting to using the appframework. This is why
    > I simplified the code way down. (Yes, even taking out error checking
    > aspects.) I want to see how you do it using formlib.sml and basic
    > SIMPOL.

    It is much more complicated, because in spite of what you thought when I
    said there are no globals, I wasn't talking about your globals, I was
    talking about the internal support in Superbase for globals. Every
    database file you open in Superbase is global in scope with respect to
    the programming language and the field names are treated as globally
    visible identifiers. That makes it very easy to do those two lines in
    Superbase. The appframework.sml attempts to return much of that
    simplicity. The fact is, to open a data-aware form in SIMPOL using
    previously opened databases requires you to create a specific data
    structure for each data source, and place them in a ring, and a data
    structure for each table, placing those in an array. You then pass both
    to the opendataform1() function.

    > So other than adding CONSTANTS, I want to see how you'd modify
    > function SimpleForm() to accomplish what is straightforward in SBL.
    > For example, I see this line in the sbair program:
    >
    > src =@ me.opendatasource("sbme1", "flight.sbm", appw, error=e)
    >
    > but there is no way for me to really see what is actually happening
    > when opendatasource() is called.

    Actually, there is. It is in the source of the appframework library,
    which was included with the most recent release. It is in the
    application.sma file.

    > The same is true for t =@ appw.opendatatable(src, "FLIGHT", error=e)

    The source for that is also in the appframework project. Look in the
    appframework.sma in the area that implements the appwindow type.

    > NR: > It depends on whether you are using ppcs or not. The code is
    > slightly different. Also, although the Superbase code looks easy, it
    > actually isn't, since there is no checking for failure in what you
    > wrote. Also, since nothing is global in SIMPOL, you have to pass
    > the information in.
    >
    > JDK: I left out error checking for failure for simplicity's sake.
    > But that would hardly make it that much more complicated if I added
    > an IF … EXISTS line. And the no globals is really a red herring, I
    > am perfectly able to pass whatever I need to pass.

    As I implied above, the globals are not yours, but Superbase's. When you
    call OPEN FORM "…" in Superbase, it already has access to all the
    information it needs about all the open tables, their fields, indexes,
    etc. This is not the case in SIMPOL, but it is part of what the
    appframework provides.

    Ciao, Neil

    #1777
    JD Kromkowski
    Participant

    Ok. This particular problem solved. I forget or didn't remember that the
    sma-s that make up the application lib were there.

    Once I removed the include to the application framework library (sml) and
    then added an include to the directories where the sma s were and then an
    include line for the application.sma,I could debug step by step and see
    the whole thing working. Infinitely more useful that way, in my opinion,
    than just hooking up the application framework sml but having the source
    hidden.

    On one hand, I have maintained for 15 years that I am not a programmer but
    a lawyer. On the other hand, I have been fooling around with the stuff
    (as well as other languages) for over 15 years. So you I think that I not
    totally a dingbat.

    Your application framework while robust, thoughtful and capable of
    handling a wide variety of generic situations is quite frankly way too
    complicated for a novice programmer. I can follow it fine, (15+ years or a
    blind squirrel finding a nut) but it really doesn't have to be so
    complicated. So there is a question of your audience to consider.

    A. No real knowledge of programming.

    B. Some basic knowledge and understanding of programming but who are
    primary in different fields but who are adventurous enough to want to have
    a go at creating their own applications.

    C. Programmers.

    I suppose I fall somewhere between B and C

    With respect to group A, of course one could create a wizard that would
    just push stuff into the right places (what form are you using?, what
    table?, do you want a menu?, what push buttons do you want on your form?,
    etc.) without the end user even understanding what is going on, but you
    aren't anywhere near building such a thing, it seems to me. On the other
    hand, it also seems to me that you built the application framework with
    perhaps a wizard in mind down the road.

    With respect to group B, I really think that the application framework too
    complicated. I've been working on something far more simple which requires
    an ability the create datasource(s) and table(s). This is pretty
    straightforward in personal or by importing (still buggy though). And the
    ability to create forms using the form designer. Also pretty
    straightforward.

    Instead of throwing around the application, I throw around the dataform1.
    Because, it after all it has all of the information necessary in it. If
    there were anybody in this forum I'd upload the idea. But as there have
    been only 7 downloads of v1.22, you can appreciate my concern about where
    this is headed.

    With respect to group C, well they don't need your application framework,
    although if they are programmers they probably don't want to invent the
    wheel and will shameless crib from it.

    My thoughts and thank you again for the responses.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.