Skip to content

New Form in New Window

Forums Forums SIMPOL Programming New Form in New Window

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

    I’m testing with SBME the concept of opening second window with second form. (Instead of swapping form in same app window.) I keep getting an error 3. Is there no way to do this without going to PPCS. (I can of course I suppose do this with wxforms and send over the data I need.) I am able to do it personal, by opening datasource and table in new windows, first. And then I open the forms. A main form which alot of detail blocks and a second form which only has the table related to the detail. So then if I add or modify or delete data in one file the, select current (up arrow) it refreshes the data in the detail block. I just can’t quite wrap my head around doing it programatically.

    #2083
    JD Kromkowski
    Participant

    On 01/29/13 5:24 PM, kromkowski wrote:
    > I'm testing with SBME the concept of opening second window with second
    > form. (Instead of swapping form in same app window.) I keep getting an
    > error 3. Is there no way to do this without going to PPCS. (I can of
    > course I suppose do this with wxforms and send over the data I need.)
    >
    > I am able to do it personal, by opening datasource and table in new
    > windows, first. And then I open the forms. A main form which alot of
    > detail blocks and a second form which only has the table related to the
    > detail.
    >
    > So then if I add or modify or delete data in one file the, select
    > current (up arrow) it refreshes the data in the detail block.
    >
    > I just can't quite wrap my head around doing it programatically.

    Is what is happening in Personal that I have more than one application
    framework running?

    I can see now that I can open quite a few tables in new windows and then
    forms in new windows. And so long as I open the form with the detail
    blocks last I don't get an error three problem at all.

    #2084
    JD Kromkowski
    Participant

    Here a stab at this, just to try the concept out. I can do this with a
    wxform but I'd like to use a dataform. It falls down at the
    opendataform(), I am thinking it is in the datasources and tables params
    but I'm really not sure.

    function AddTime(wxmenuitem me, type(application) app)
    integer error, width,height, dispwidth, dispheight
    error = 0
    string errortext; errortext = ""
    appwindow appw
    appw =@ getappwindowfromwindow(getmenuitemwindow(me))
    wxwindow wTime
    wTime =@ wxwindow.new(100, 100, innerwidth=1,
    innerheight=1,captiontext="Test")
    wTime.setstate(.false)
    wTime.onvisibilitychange.function =@ quitW
    dataform1 fTime
    string dirsep, cd, formfilename
    dirsep = getdirectorysepchar()
    cd = getcurrentdirectory()
    formfilename = cd + dirsep + "TimeAddMod.sxf"
    fTime =@ opendataform1(formfilename,
    50,
    50,
    1677215,
    "T|F",
    ".",
    "999999.00",
    "dd/mm/yyyy",
    "hh:mm am",
    app.displayformats.defdatetime,
    app.SBLlocale.datelocale,
    app.SBLlocale.numlocale,
    app.datasources.search(TIME),
    appw.gettablesarray(),
    error,errortext,
    wTime)
    width = fTime.currentpage.width
    height = fTime.currentpage.height
    fTime.setcontainer(wTime)
    wTime.setstate(.true)
    wxprocess(.inf)
    end function

    function quitW(wxwindow w)
    wxbreak()
    end function

    On 01/29/13 5:34 PM, kromkowski wrote:
    > On 01/29/13 5:24 PM, kromkowski wrote:
    >> I'm testing with SBME the concept of opening second window with second
    >> form. (Instead of swapping form in same app window.) I keep getting an
    >> error 3. Is there no way to do this without going to PPCS. (I can of
    >> course I suppose do this with wxforms and send over the data I need.)
    >>
    >> I am able to do it personal, by opening datasource and table in new
    >> windows, first. And then I open the forms. A main form which alot of
    >> detail blocks and a second form which only has the table related to the
    >> detail.
    >>
    >> So then if I add or modify or delete data in one file the, select
    >> current (up arrow) it refreshes the data in the detail block.
    >>
    >> I just can't quite wrap my head around doing it programatically.
    >
    > Is what is happening in Personal that I have more than one application
    > framework running?
    >
    > I can see now that I can open quite a few tables in new windows and then
    > forms in new windows. And so long as I open the form with the detail
    > blocks last I don't get an error three problem at all.

    #2085
    Michael
    Keymaster

    On 30/01/2013 19:40, kromkowski wrote:
    > Here a stab at this, just to try the concept out. I can do this with a
    > wxform but I'd like to use a dataform. It falls down at the
    > opendataform(), I am thinking it is in the datasources and tables params
    > but I'm really not sure.
    >
    >
    > formfilename = cd + dirsep + "TimeAddMod.sxf"
    > fTime =@ opendataform1(formfilename,
    > 50,
    > 50,
    > 1677215,
    > "T|F",
    > ".",
    > "999999.00",
    > "dd/mm/yyyy",
    > "hh:mm am",
    > app.displayformats.defdatetime,
    > app.SBLlocale.datelocale,
    > app.SBLlocale.numlocale,
    > app.datasources.search(TIME),
    > appw.gettablesarray(),
    > error,errortext,
    > wTime)
    > width = fTime.currentpage.width
    > height = fTime.currentpage.height
    > fTime.setcontainer(wTime)
    > wTime.setstate(.true)
    > wxprocess(.inf)
    > end function

    Hi John,

    You can do this much easier than that, by using appw.openformdirect(). It will gather up the datasources, tables array, etc. for
    you. Also, have a look at that code and you will see how to call opendataform1() yourself. If you are using the appframework, you
    are better off calling openformdirect(), since it will also activate a bunch of housekeeping in appwindow.

    Ciao, Neil

    #2086
    JD Kromkowski
    Participant

    appw.openformdirect() was my first instinct. But here is what happens:

    It replaces the initial form with my new form (for a flash of a second)
    and then opens a window as intended with the new form, leaving the
    original appw without a form.

    See attach shot.

    So in addition to being wrong there is a funky side effect that menu in
    the now empty window controls the form in the side window.

    JDK

    On 01/31/13 7:30 AM, Neil Robinson wrote:
    > On 30/01/2013 19:40, kromkowski wrote:
    >> Here a stab at this, just to try the concept out. I can do this with a
    >> wxform but I'd like to use a dataform. It falls down at the
    >> opendataform(), I am thinking it is in the datasources and tables params
    >> but I'm really not sure.
    >>
    >>
    >> formfilename = cd + dirsep + "TimeAddMod.sxf"
    >> fTime =@ opendataform1(formfilename,
    >> 50,
    >> 50,
    >> 1677215,
    >> "T|F",
    >> ".",
    >> "999999.00",
    >> "dd/mm/yyyy",
    >> "hh:mm am",
    >> app.displayformats.defdatetime,
    >> app.SBLlocale.datelocale,
    >> app.SBLlocale.numlocale,
    >> app.datasources.search(TIME),
    >> appw.gettablesarray(),
    >> error,errortext,
    >> wTime)
    >> width = fTime.currentpage.width
    >> height = fTime.currentpage.height
    >> fTime.setcontainer(wTime)
    >> wTime.setstate(.true)
    >> wxprocess(.inf)
    >> end function
    >
    > Hi John,
    >
    > You can do this much easier than that, by using appw.openformdirect(). It will gather up the datasources, tables array, etc. for
    > you. Also, have a look at that code and you will see how to call opendataform1() yourself. If you are using the appframework, you
    > are better off calling openformdirect(), since it will also activate a bunch of housekeeping in appwindow.
    >
    > Ciao, Neil
    >

    #2087
    JD Kromkowski
    Participant

    if app !@= .nul
    appw =@ app.windows.getfirst()
    appwTime =@ app.windows.tail.setnext()

    Am I on right track, that in the beginning, I should create the
    additional windows, I'll need for later?

    can I access it directly like this

    app.windows!appwTime

    JDK

    On 01/31/13 1:03 PM, kromkowski wrote:
    > appw.openformdirect() was my first instinct. But here is what happens:
    >
    > It replaces the initial form with my new form (for a flash of a second)
    > and then opens a window as intended with the new form, leaving the
    > original appw without a form.
    >
    > See attach shot.
    >
    > So in addition to being wrong there is a funky side effect that menu in
    > the now empty window controls the form in the side window.
    >
    > JDK
    >
    >
    >
    >
    >
    > On 01/31/13 7:30 AM, Neil Robinson wrote:
    >> On 30/01/2013 19:40, kromkowski wrote:
    >>> Here a stab at this, just to try the concept out. I can do this with a
    >>> wxform but I'd like to use a dataform. It falls down at the
    >>> opendataform(), I am thinking it is in the datasources and tables params
    >>> but I'm really not sure.
    >>>
    >>>
    >>> formfilename = cd + dirsep + "TimeAddMod.sxf"
    >>> fTime =@ opendataform1(formfilename,
    >>> 50,
    >>> 50,
    >>> 1677215,
    >>> "T|F",
    >>> ".",
    >>> "999999.00",
    >>> "dd/mm/yyyy",
    >>> "hh:mm am",
    >>> app.displayformats.defdatetime,
    >>> app.SBLlocale.datelocale,
    >>> app.SBLlocale.numlocale,
    >>> app.datasources.search(TIME),
    >>> appw.gettablesarray(),
    >>> error,errortext,
    >>> wTime)
    >>> width = fTime.currentpage.width
    >>> height = fTime.currentpage.height
    >>> fTime.setcontainer(wTime)
    >>> wTime.setstate(.true)
    >>> wxprocess(.inf)
    >>> end function
    >>
    >> Hi John,
    >>
    >> You can do this much easier than that, by using appw.openformdirect().
    >> It will gather up the datasources, tables array, etc. for
    >> you. Also, have a look at that code and you will see how to call
    >> opendataform1() yourself. If you are using the appframework, you
    >> are better off calling openformdirect(), since it will also activate a
    >> bunch of housekeeping in appwindow.
    >>
    >> Ciao, Neil
    >>
    >

    #2088
    JD Kromkowski
    Participant

    if app !@= .nul
    appw =@ app.windows.getfirst()
    appwTime =@ appwindow.new()

    wrong app.windows.insert(appwTime,appw)

    So how to I add another window to the application?

    On 01/31/13 1:50 PM, kromkowski wrote:
    > if app !@= .nul
    > appw =@ app.windows.getfirst()
    > appwTime =@ app.windows.tail.setnext()
    >
    > Am I on right track, that in the beginning, I should create the
    > additional windows, I'll need for later?
    >
    > can I access it directly like this
    >
    > app.windows!appwTime
    >
    > JDK

    #2089
    JD Kromkowski
    Participant

    appwTime =@ appwindow.new(app,.false)

    On 01/31/13 2:03 PM, kromkowski wrote:
    > if app !@= .nul
    > appw =@ app.windows.getfirst()
    > appwTime =@ appwindow.new()
    >
    > wrong app.windows.insert(appwTime,appw)
    >
    > So how to I add another window to the application?
    >
    >
    > On 01/31/13 1:50 PM, kromkowski wrote:
    >> if app !@= .nul
    >> appw =@ app.windows.getfirst()
    >> appwTime =@ app.windows.tail.setnext()
    >>
    >> Am I on right track, that in the beginning, I should create the
    >> additional windows, I'll need for later?
    >>
    >> can I access it directly like this
    >>
    >> app.windows!appwTime
    >>
    >> JDK

    #2090
    JD Kromkowski
    Participant

    so in

    function Myapplication.new(etc)

    appw =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)

    // I create more appwindows to use later
    appwTime =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)
    appwDates =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)

    while I see how I can get the first appwindows

    e.g. in main()

    appw =@ app.windows.getfirst()

    and I can see how I could getlast(), I don't see how I can getnext().

    nor can I seem to be able to use ! to access.

    so in main() I cannot for example, do this

    app.windows.appwTime!openformdirect()

    JDK

    On 01/31/13 2:15 PM, kromkowski wrote:
    > appwTime =@ appwindow.new(app,.false)
    >
    >
    >
    > On 01/31/13 2:03 PM, kromkowski wrote:
    >> if app !@= .nul
    >> appw =@ app.windows.getfirst()
    >> appwTime =@ appwindow.new()
    >>
    >> wrong app.windows.insert(appwTime,appw)
    >>
    >> So how to I add another window to the application?
    >>
    >>
    >> On 01/31/13 1:50 PM, kromkowski wrote:
    >>> if app !@= .nul
    >>> appw =@ app.windows.getfirst()
    >>> appwTime =@ app.windows.tail.setnext()
    >>>
    >>> Am I on right track, that in the beginning, I should create the
    >>> additional windows, I'll need for later?
    >>>
    >>> can I access it directly like this
    >>>
    >>> app.windows!appwTime
    >>>
    >>> JDK
    >

    #2092
    Michael
    Keymaster

    On 01/02/2013 17:29, kromkowski wrote:
    > so in
    >
    > function Myapplication.new(etc)
    >
    > appw =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)
    >
    > // I create more appwindows to use later
    > appwTime =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)
    > appwDates =@ appwindow.new(me, visible=.false, mb=mb, tb=tb, sb=sb)
    >
    > while I see how I can get the first appwindows
    >
    > e.g. in main()
    >
    > appw =@ app.windows.getfirst()
    >
    > and I can see how I could getlast(), I don't see how I can getnext().
    >
    > nor can I seem to be able to use ! to access.
    >
    > so in main() I cannot for example, do this
    >
    > app.windows.appwTime!openformdirect()
    >
    > JDK

    Hi John,

    You are on the right track. Here is a code snippet for you:

    appw =@ app.windows.getfirst()
    while appw !@= .nul
    // … whatever you want to do here
    appw =@ appw.appnode.getnext()
    end while appw =@= app.windows.getfirst()

    I think if you are always going to have these three windows, I would be tempted to add references to them to my own application
    object that is derived from the standard application object. Then I could just use:

    app.appwMain
    app.appwTime
    app.appwDates

    That assumes these are full blown windows and forms of course. If you are talking about dates and times in some restricted way,
    then you would probably be better off using dialogs as needed.

    Ciao, Neil

    #2096
    JD Kromkowski
    Participant

    Thank you.

    Using appnode is not so intuitive. (I'm not actually even sure what
    appnode is?

    And why is it that, I can't use ! (what do you call the using the !?)

    app.windows!appwTime

    > Hi John,
    >
    > You are on the right track. Here is a code snippet for you:
    >
    > appw =@ app.windows.getfirst()
    > while appw !@= .nul
    > // … whatever you want to do here
    > appw =@ appw.appnode.getnext()
    > end while appw =@= app.windows.getfirst()
    >
    >
    > I think if you are always going to have these three windows, I would be tempted to add references to them to my own application
    > object that is derived from the standard application object. Then I could just use:
    >
    > app.appwMain
    > app.appwTime
    > app.appwDates
    >
    > That assumes these are full blown windows and forms of course. If you are talking about dates and times in some restricted way,
    > then you would probably be better off using dialogs as needed.
    >
    > Ciao, Neil
    >

    #2097
    Michael
    Keymaster

    On 05/02/2013 01:39, kromkowski wrote:
    > Thank you.
    >
    > Using appnode is not so intuitive. (I'm not actually even sure what
    > appnode is?

    appnode is a dlistnode. The windows property is a dring.

    > And why is it that, I can't use ! (what do you call the using the !?)

    Basically because it assumes that the member operator for a dring is implemented, which it isn't, and even if it were, it would be
    difficult to do what you expect, since the dlistnode contains merely a type(*) key property, and the entire object that it
    contains is assigned to that property. It has no way of knowing what property of any target object should be the one used fo
    resolving the string passed to the !() function.

    > app.windows!appwTime

    Sure, it would be more elegant, but it would require some significant re-engineering to achieve. Considering how many drings and
    dlistnodes are found in dataform1 and co, this would be a potentially significant engineering exercise.

    Ciao, Neil

    >
    >
    >
    >> Hi John,
    >>
    >> You are on the right track. Here is a code snippet for you:
    >>
    >> appw =@ app.windows.getfirst()
    >> while appw !@= .nul
    >> // … whatever you want to do here
    >> appw =@ appw.appnode.getnext()
    >> end while appw =@= app.windows.getfirst()
    >>
    >>
    >> I think if you are always going to have these three windows, I would be tempted to add references to them to my own application
    >> object that is derived from the standard application object. Then I could just use:
    >>
    >> app.appwMain
    >> app.appwTime
    >> app.appwDates
    >>
    >> That assumes these are full blown windows and forms of course. If you are talking about dates and times in some restricted way,
    >> then you would probably be better off using dialogs as needed.
    >>
    >> Ciao, Neil
    >>
    >

    #2099
    JD Kromkowski
    Participant

    no need to re-engineer anything.

    So I am able to open new forms in new windows. I had to write my own
    openformdirect() function. However, handling their menus and icon bar
    is a bit more tricky. I do have it mostly working now, except I cannot
    figure out how to make the form receptive to changes.

    I can seem to be able to get a cursor in any field. Even though a
    form.blank() will create what looks like a blank form/record. I can put
    my cursor in to type anything.

    As I am typing I am thinking something like

    form.tbMyFirstField.setfocus()

    ?

    JDK

    #2111
    Michael
    Keymaster

    On 15/02/2013 21:05, kromkowski wrote:
    > no need to re-engineer anything.
    >
    > So I am able to open new forms in new windows. I had to write my own
    > openformdirect() function. However, handling their menus and icon bar
    > is a bit more tricky. I do have it mostly working now, except I cannot
    > figure out how to make the form receptive to changes.
    >
    > I can seem to be able to get a cursor in any field. Even though a
    > form.blank() will create what looks like a blank form/record. I can put
    > my cursor in to type anything.
    >
    > As I am typing I am thinking something like
    >
    > form.tbMyFirstField.setfocus()
    >
    > ?
    >
    > JDK
    >

    I am unclear why you aren't just using the same functions from the appframework for this window as well. Just hook up the menu and
    toolbar events from the new menu and toolbar objects to the same functions.

    Ciao. Neil

    #2115
    JD Kromkowski
    Participant

    On 02/18/13 1:52 PM, Neil Robinson wrote:
    > I am unclear why you aren't just using the same functions from the appframework for this window as well. Just hook up the menu and
    > toolbar events from the new menu and toolbar objects to the same functions.
    >
    > Ciao. Neil

    Well, because it doesn't or didn't work.

    Maybe if there was an application framework example with multiple
    windows, I'd see it.

    The first problem is that I was trying to avoid Error 3 (In building a
    test program, I want to start first by building this as an SBME
    application because I want to work out kinks with SBME before I go to
    PPCS because there are aspects of PPCS that I don't fully get.)

    My main form has a primary table and then uses many secondary tables in
    detail blocks.

    In order to avoid the error 3, I have to pass the app which has all of
    the open tables I need. If I open them again, I will get error 3.

    If you look at

    app =@ Myapplication.new(mb,tb,sb,"","")

    you are passing intial menubar and toolbar
    before you even create an initial appw.

    Here is the way I am thinking about it.

    I have an app it has the datasources and tables I'll need

    the app then has all of the appw s I will need

    each appw.w has its own forms, mb, tb, sb

    Maybe I will just start over.

    If I just have one window and change the forms there is not problem at
    all. I can pretty much replicate my office management program.

    It is when I start trying to have multiple windows each with their own
    form and own mbs,tbs, etc. that things start getting complicated for me.

    JDK

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