Can't insert a notebook page - OS2

This is a discussion on Can't insert a notebook page - OS2 ; I'm trying to insert a notebook page and I always get an error code: The code is very simple. I need to know how to find out why I get an error. The docs mention two reasons: - Invalid pageID ...

+ Reply to Thread
Results 1 to 16 of 16

Thread: Can't insert a notebook page

  1. Can't insert a notebook page

    I'm trying to insert a notebook page and I always get an error code:
    The code is very simple. I need to know how to find out why I get an
    error. The docs mention two reasons:

    - Invalid pageID (not the case since I'm using BKA_FIRST and the
    pageID is ignored)
    - Not enough space was available to allocate the page data (here I'm
    not sure what it means)

    What is the page data?, do I need it?, how do I reserve that space and
    when?

    Finally, is there a way to go deeper to try to find the reason for
    this kind of errors?. I can only check the return code but clearly
    that's not enough.

    Thanks very much

    Leonardo Pino


  2. Re: Can't insert a notebook page

    lpino wrote:
    > I'm trying to insert a notebook page and I always get an error code:
    > The code is very simple.
    >

    So what is the "simple" code?
    What is the return code from the message?

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)

  3. Re: Can't insert a notebook page

    lpino schrieb:
    > I'm trying to insert a notebook page and I always get an error code:
    > The code is very simple. I need to know how to find out why I get an
    > error. The docs mention two reasons:
    >
    > - Invalid pageID (not the case since I'm using BKA_FIRST and the
    > pageID is ignored)
    > - Not enough space was available to allocate the page data (here I'm
    > not sure what it means)
    >
    > What is the page data?, do I need it?, how do I reserve that space and
    > when?
    >
    > Finally, is there a way to go deeper to try to find the reason for
    > this kind of errors?. I can only check the return code but clearly
    > that's not enough.
    >
    > Thanks very much
    >
    > Leonardo Pino
    >

    Post your code here.

    Lars


  4. Re: Can't insert a notebook page

    lpino schrieb:
    > I'm trying to insert a notebook page and I always get an error code:
    > The code is very simple. I need to know how to find out why I get an
    > error. The docs mention two reasons:
    >
    > - Invalid pageID (not the case since I'm using BKA_FIRST and the
    > pageID is ignored)
    > - Not enough space was available to allocate the page data (here I'm
    > not sure what it means)
    >
    > What is the page data?, do I need it?, how do I reserve that space and
    > when?
    >
    > Finally, is there a way to go deeper to try to find the reason for
    > this kind of errors?. I can only check the return code but clearly
    > that's not enough.
    >
    > Thanks very much
    >
    > Leonardo Pino
    >

    Maybe you are accidentally swapping low and high USHORT for the 2.
    parameter, should be:

    WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    BKA_STATUSTEXTON,BKA_FIRST));

    Also, you might want to experiment with the flags for the notebook
    itself (BKS_...)

  5. Re: Can't insert a notebook page

    andrea.lecumberri@gmail.com wrote:

    > On 29 jul, 16:20, Lars Erdmann wrote:
    >> lpino schrieb:
    >>
    >> > I'm trying to insert a notebook page and I always get an error code:
    >> > The code is very simple. I need to know how to find out why I get an
    >> > error. The docs mention two reasons:

    >>
    >> > - Invalid pageID (not the case since I'm using BKA_FIRST and the
    >> > pageID is ignored)
    >> > - Not enough space was available to allocate the page data (here I'm
    >> > not sure what it means)

    >>
    >> > What is the page data?, do I need it?, how do I reserve that space and
    >> > when?

    >>
    >> > Finally, is there a way to go deeper to try to find the reason for
    >> > this kind of errors?. I can only check the return code but clearly
    >> > that's not enough.

    >>
    >> > Thanks very much

    >>
    >> > Leonardo Pino

    >>
    >> Maybe you are accidentally swapping low and high USHORT for the 2.
    >> parameter, should be:
    >>
    >> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    >> BKA_STATUSTEXTON,BKA_FIRST));
    >>
    >> Also, you might want to experiment with the flags for the notebook
    >> itself (BKS_...)

    >
    > This code is part of the SWT port. There is no code to show. There are
    > a bunch of APIs that are called via JNI. The WinSendMessage works
    > very well for every other call (so far). In the case of the
    > BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    > that are causing problems.
    >
    > I call a WinCreateWindow with the following styles:
    > WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP
    >
    > Then I send the message BKM_INSERTPAGE with the following flags:
    > BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST
    >
    > any ideas?


    You need to include the code that creates the page you are inserting as well
    as the pointers to that [age and the status of the create call. Insert Page
    is very picky about the format of the pages it will accept and the status
    codes are close to useless, best I recall.

    --
    Will Honea
    whonea@yahoo.com

  6. Re: Can't insert a notebook page

    On 30 jul, 01:01, Will Honea wrote:
    > andrea.lecumbe...@gmail.com wrote:
    > > On 29 jul, 16:20, Lars Erdmann wrote:
    > >> lpino schrieb:

    >
    > >> > I'm trying to insert a notebook page and I always get an error code:
    > >> > The code is very simple. I need to know how to find out why I get an
    > >> > error. The docs mention two reasons:

    >
    > >> > - Invalid pageID (not the case since I'm using BKA_FIRST and the
    > >> > pageID is ignored)
    > >> > - Not enough space was available to allocate the page data (here I'm
    > >> > not sure what it means)

    >
    > >> > What is the page data?, do I need it?, how do I reserve that space and
    > >> > when?

    >
    > >> > Finally, is there a way to go deeper to try to find the reason for
    > >> > this kind of errors?. I can only check the return code but clearly
    > >> > that's not enough.

    >
    > >> > Thanks very much

    >
    > >> > Leonardo Pino

    >
    > >> Maybe you are accidentally swapping low and high USHORT for the 2.
    > >> parameter, should be:

    >
    > >> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    > >> BKA_STATUSTEXTON,BKA_FIRST));

    >
    > >> Also, you might want to experiment with the flags for the notebook
    > >> itself (BKS_...)

    >
    > > This code is part of the SWT port. There is no code to show. There are
    > > a bunch of APIs that are called via JNI. The WinSendMessage works
    > > very well for every other call (so far). In the case of the
    > > BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    > > that are causing problems.

    >
    > > I call a WinCreateWindow with the following styles:
    > > WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP

    >
    > > Then I send the message BKM_INSERTPAGE with the following flags:
    > > BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST

    >
    > > any ideas?

    >
    > You need to include the code that creates the page you are inserting as well
    > as the pointers to that [age and the status of the create call. Insert Page
    > is very picky about the format of the pages it will accept and the status
    > codes are close to useless, best I recall.
    >
    > --
    > Will Honea
    > who...@yahoo.com


    Ok, here goes the code and some logging:

    - The call that creates the Notebook window is (remember this are Java
    wrappers for API calls) :

    handle = OS.WinCreateWindow (
    parent.handle,
    windowClass (),
    windowTitle (),
    widgetStyle (),
    0, parent.getHeight (), 0, 0,
    parent.handle,
    // to mimic the Windows behavior
    OS.HWND_BOTTOM, //OS.HWND_TOP,
    0,
    0,
    0
    );

    This operations works just fine an I get the following values in the
    log:
    [java] Control.createHandle(): Window has been created:
    [java] hwnd = 800000bf
    [java] hwnd.parent = hwnd.owner = 800000be
    [java] class = #40
    [java] style = b0020840

    In the function I'm implementing before I create the page I count the
    existing pages with the following call:

    int count = OS.WinSendMsg (handle, OS.BKM_QUERYPAGECOUNT, 0,
    OS.BKA_END);

    and returns fine.

    Finally I call the insert page code with:

    if (OS.WinSendMsg (handle, OS.BKM_INSERTPAGE, 0,
    OS.MPFROM2SHORT((short)(OS.BKA_AUTOPAGESIZE|OS.BKA _STATUSTEXTON|
    OS.BKA_MAJOR), (short)OS.BKA_FIRST)) == 0)

    But this call never returns a value different than zero, no matter
    what combination of styles I use

    I use the following styles when I create the notebook:

    OS.WS_VISIBLE | OS.BKS_TABBEDDIALOG | OS.BKS_MAJORTABTOP

    Well that's it. That's all I do,, any ideas??

    Leonardo Pino






  7. Re: Can't insert a notebook page

    On Tue, 31 Jul 2007 12:24:28 UTC, lpino wrote:

    > - The call that creates the Notebook window is (remember this are Java
    > wrappers for API calls) :


    Are you sure, that these wrappers are correct ? A a start, I'd check
    the numeric values of all those OS.BKM_xxx and OS.BKA_xxx constants
    against PMSTDDLG.H from the OS/2 tookit.


    --
    Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]
    http://www.s-t.de
    Please remove all characters left of the "R" in my email address


  8. Re: Can't insert a notebook page

    On 31 jul, 08:56, "Ruediger Ihle" wrote:
    > On Tue, 31 Jul 2007 12:24:28 UTC, lpino wrote:
    > > - The call that creates the Notebook window is (remember this are Java
    > > wrappers for API calls) :

    >
    > Are you sure, that these wrappers are correct ? A a start, I'd check
    > the numeric values of all those OS.BKM_xxx and OS.BKA_xxx constants
    > against PMSTDDLG.H from the OS/2 tookit.
    >
    > --
    > Ruediger "Rudi" Ihle [S&T Systemtechnik GmbH, Germany]http://www.s-t.de
    > Please remove all characters left of the "R" in my email address


    Yep, I'm pretty sure. In fact I have many other controls already
    working and I have checked the values of the constants and they are
    just like in the H file. I even injected the just the values in those
    calls and still no luck. If I could only get more information on the
    rc....

    Thanks

    Leonardo Pino


  9. Re: Can't insert a notebook page

    On Tue, 31 Jul 2007 15:26:42 UTC, lpino wrote:

    > If I could only get more information on the rc....


    WinGetLastError() before the call to clear out any previous error,
    then WinGetLastError() after the call to get the current error.


    --
    == == almost usable email address: rws AT e-vertise.com == ==
    __________________________________________________ _________________
    |
    | Remote Workplace Server v0.80
    Rich Walsh | interact with the WPS from any program
    Ft Myers, FL | http://e-vertise.com/rws/rws080.zip
    __________________________________________________ _________________

  10. Re: Can't insert a notebook page

    lpino schrieb:
    > On 30 jul, 01:01, Will Honea wrote:
    >> andrea.lecumbe...@gmail.com wrote:
    >>> On 29 jul, 16:20, Lars Erdmann wrote:
    >>>> lpino schrieb:
    >>>>> I'm trying to insert a notebook page and I always get an error code:
    >>>>> The code is very simple. I need to know how to find out why I get an
    >>>>> error. The docs mention two reasons:
    >>>>> - Invalid pageID (not the case since I'm using BKA_FIRST and the
    >>>>> pageID is ignored)
    >>>>> - Not enough space was available to allocate the page data (here I'm
    >>>>> not sure what it means)
    >>>>> What is the page data?, do I need it?, how do I reserve that space and
    >>>>> when?
    >>>>> Finally, is there a way to go deeper to try to find the reason for
    >>>>> this kind of errors?. I can only check the return code but clearly
    >>>>> that's not enough.
    >>>>> Thanks very much
    >>>>> Leonardo Pino
    >>>> Maybe you are accidentally swapping low and high USHORT for the 2.
    >>>> parameter, should be:
    >>>> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    >>>> BKA_STATUSTEXTON,BKA_FIRST));
    >>>> Also, you might want to experiment with the flags for the notebook
    >>>> itself (BKS_...)
    >>> This code is part of the SWT port. There is no code to show. There are
    >>> a bunch of APIs that are called via JNI. The WinSendMessage works
    >>> very well for every other call (so far). In the case of the
    >>> BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    >>> that are causing problems.
    >>> I call a WinCreateWindow with the following styles:
    >>> WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP
    >>> Then I send the message BKM_INSERTPAGE with the following flags:
    >>> BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST
    >>> any ideas?

    >> You need to include the code that creates the page you are inserting as well
    >> as the pointers to that [age and the status of the create call. Insert Page
    >> is very picky about the format of the pages it will accept and the status
    >> codes are close to useless, best I recall.
    >>
    >> --
    >> Will Honea
    >> who...@yahoo.com

    >
    > Ok, here goes the code and some logging:
    >
    > - The call that creates the Notebook window is (remember this are Java
    > wrappers for API calls) :
    >
    > handle = OS.WinCreateWindow (
    > parent.handle,
    > windowClass (),
    > windowTitle (),
    > widgetStyle (),
    > 0, parent.getHeight (), 0, 0,
    > parent.handle,
    > // to mimic the Windows behavior
    > OS.HWND_BOTTOM, //OS.HWND_TOP,
    > 0,
    > 0,
    > 0
    > );
    >
    > This operations works just fine an I get the following values in the
    > log:
    > [java] Control.createHandle(): Window has been created:
    > [java] hwnd = 800000bf
    > [java] hwnd.parent = hwnd.owner = 800000be
    > [java] class = #40
    > [java] style = b0020840



    a.) are you sure that "handle" points indeed to a Notebook window
    (WC_NOTEBOOK) ? What does windowClass() return (should return WC_NOTEBOOK) ?
    b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    and y = parent.getHeight() in relation to the parent (that is: outside
    of the parent's dimensions as y = parent.getHeight()). Is this really
    intended ?
    c.) a window title for the notebook control itself is odd
    (windowTitle()). Specify NULL for the title.
    d.) a window ID of 0 seems to be wrong to me
    e.) Since you are using BKS_TABBEDDIALOG I guess you will also have to
    use one of the following to specify the "layering":
    #define BKS_BACKPAGESTR 0x00000004 /* Top right */
    #define BKS_BACKPAGESTL 0x00000008 /* Top left */
    As you can see, none of these are 0 therefore there is no default ...
    See also "Presentation Manager Programming Guide and Ref"->Notebook Controls

    Lars


    >
    > In the function I'm implementing before I create the page I count the
    > existing pages with the following call:
    >
    > int count = OS.WinSendMsg (handle, OS.BKM_QUERYPAGECOUNT, 0,
    > OS.BKA_END);
    >
    > and returns fine.
    >
    > Finally I call the insert page code with:
    >
    > if (OS.WinSendMsg (handle, OS.BKM_INSERTPAGE, 0,
    > OS.MPFROM2SHORT((short)(OS.BKA_AUTOPAGESIZE|OS.BKA _STATUSTEXTON|
    > OS.BKA_MAJOR), (short)OS.BKA_FIRST)) == 0)
    >
    > But this call never returns a value different than zero, no matter
    > what combination of styles I use
    >
    > I use the following styles when I create the notebook:
    >
    > OS.WS_VISIBLE | OS.BKS_TABBEDDIALOG | OS.BKS_MAJORTABTOP
    >
    > Well that's it. That's all I do,, any ideas??
    >
    > Leonardo Pino
    >
    >
    >
    >
    >


  11. Re: Can't insert a notebook page

    On 31 jul, 13:21, "Rich Walsh" wrote:
    > On Tue, 31 Jul 2007 15:26:42 UTC, lpino wrote:
    > > If I could only get more information on the rc....

    >
    > WinGetLastError() before the call to clear out any previous error,
    > then WinGetLastError() after the call to get the current error.


    Didn't work I just got 0

    Leonardo Pino


  12. Re: Can't insert a notebook page

    Lars Erdmann wrote:

    > lpino schrieb:
    >
    >> On 30 jul, 01:01, Will Honea wrote:
    >>
    >>> andrea.lecumbe...@gmail.com wrote:
    >>>
    >>>> On 29 jul, 16:20, Lars Erdmann wrote:
    >>>>
    >>>>> lpino schrieb:
    >>>>>
    >>>>>> I'm trying to insert a notebook page and I always get an error code:
    >>>>>> The code is very simple. I need to know how to find out why I get an
    >>>>>> error. The docs mention two reasons:
    >>>>>> - Invalid pageID (not the case since I'm using BKA_FIRST and the
    >>>>>> pageID is ignored)
    >>>>>> - Not enough space was available to allocate the page data (here I'm
    >>>>>> not sure what it means)
    >>>>>> What is the page data?, do I need it?, how do I reserve that space
    >>>>>> and
    >>>>>> when?
    >>>>>> Finally, is there a way to go deeper to try to find the reason for
    >>>>>> this kind of errors?. I can only check the return code but clearly
    >>>>>> that's not enough.
    >>>>>> Thanks very much
    >>>>>> Leonardo Pino
    >>>>>
    >>>>> Maybe you are accidentally swapping low and high USHORT for the 2.
    >>>>> parameter, should be:
    >>>>> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    >>>>> BKA_STATUSTEXTON,BKA_FIRST));
    >>>>> Also, you might want to experiment with the flags for the notebook
    >>>>> itself (BKS_...)
    >>>>
    >>>> This code is part of the SWT port. There is no code to show. There are
    >>>> a bunch of APIs that are called via JNI. The WinSendMessage works
    >>>> very well for every other call (so far). In the case of the
    >>>> BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    >>>> that are causing problems.
    >>>> I call a WinCreateWindow with the following styles:
    >>>> WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP
    >>>> Then I send the message BKM_INSERTPAGE with the following flags:
    >>>> BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST
    >>>> any ideas?
    >>>
    >>> You need to include the code that creates the page you are inserting
    >>> as well
    >>> as the pointers to that [age and the status of the create call.
    >>> Insert Page
    >>> is very picky about the format of the pages it will accept and the
    >>> status
    >>> codes are close to useless, best I recall.
    >>>
    >>> --
    >>> Will Honea
    >>> who...@yahoo.com

    >>
    >>
    >> Ok, here goes the code and some logging:
    >>
    >> - The call that creates the Notebook window is (remember this are Java
    >> wrappers for API calls) :
    >>
    >> handle = OS.WinCreateWindow (
    >> parent.handle,
    >> windowClass (),
    >> windowTitle (),
    >> widgetStyle (),
    >> 0, parent.getHeight (), 0, 0,
    >> parent.handle,
    >> // to mimic the Windows behavior
    >> OS.HWND_BOTTOM, //OS.HWND_TOP,
    >> 0,
    >> 0,
    >> 0
    >> );
    >>
    >> This operations works just fine an I get the following values in the
    >> log:
    >> [java] Control.createHandle(): Window has been created:
    >> [java] hwnd = 800000bf
    >> [java] hwnd.parent = hwnd.owner = 800000be
    >> [java] class = #40
    >> [java] style = b0020840

    >
    >
    >
    > a.) are you sure that "handle" points indeed to a Notebook window
    > (WC_NOTEBOOK) ? What does windowClass() return (should return
    > WC_NOTEBOOK) ?
    > b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    > and y = parent.getHeight() in relation to the parent (that is: outside
    > of the parent's dimensions as y = parent.getHeight()). Is this really
    > intended ?
    > c.) a window title for the notebook control itself is odd
    > (windowTitle()). Specify NULL for the title.
    > d.) a window ID of 0 seems to be wrong to me
    > e.) Since you are using BKS_TABBEDDIALOG I guess you will also have to
    > use one of the following to specify the "layering":
    > #define BKS_BACKPAGESTR 0x00000004 /* Top right */
    > #define BKS_BACKPAGESTL 0x00000008 /* Top left */
    > As you can see, none of these are 0 therefore there is no default ...
    > See also "Presentation Manager Programming Guide and Ref"->Notebook
    > Controls
    >
    > Lars
    >
    >
    >>
    >> In the function I'm implementing before I create the page I count the
    >> existing pages with the following call:
    >>
    >> int count = OS.WinSendMsg (handle, OS.BKM_QUERYPAGECOUNT, 0,
    >> OS.BKA_END);
    >>
    >> and returns fine.
    >>
    >> Finally I call the insert page code with:
    >>
    >> if (OS.WinSendMsg (handle, OS.BKM_INSERTPAGE, 0,
    >> OS.MPFROM2SHORT((short)(OS.BKA_AUTOPAGESIZE|OS.BKA _STATUSTEXTON|
    >> OS.BKA_MAJOR), (short)OS.BKA_FIRST)) == 0)
    >>
    >> But this call never returns a value different than zero, no matter
    >> what combination of styles I use
    >>
    >> I use the following styles when I create the notebook:
    >>
    >> OS.WS_VISIBLE | OS.BKS_TABBEDDIALOG | OS.BKS_MAJORTABTOP
    >>
    >> Well that's it. That's all I do,, any ideas??
    >>
    >> Leonardo Pino
    >>


    The little I've played with notebooks, I found them very confusing.
    EDM/2 had a couple of articles that helped some. Can anyone point me to
    some good, working, sample code? Thanks.


  13. Re: Can't insert a notebook page

    On 1 ago, 17:55, Lars Erdmann wrote:
    > lpino schrieb:
    >
    >
    >
    > > On 30 jul, 01:01, Will Honea wrote:
    > >> andrea.lecumbe...@gmail.com wrote:
    > >>> On 29 jul, 16:20, Lars Erdmann wrote:
    > >>>> lpino schrieb:
    > >>>>> I'm trying to insert a notebook page and I always get an error code:
    > >>>>> The code is very simple. I need to know how to find out why I get an
    > >>>>> error. The docs mention two reasons:
    > >>>>> - Invalid pageID (not the case since I'm using BKA_FIRST and the
    > >>>>> pageID is ignored)
    > >>>>> - Not enough space was available to allocate the page data (here I'm
    > >>>>> not sure what it means)
    > >>>>> What is the page data?, do I need it?, how do I reserve that space and
    > >>>>> when?
    > >>>>> Finally, is there a way to go deeper to try to find the reason for
    > >>>>> this kind of errors?. I can only check the return code but clearly
    > >>>>> that's not enough.
    > >>>>> Thanks very much
    > >>>>> Leonardo Pino
    > >>>> Maybe you are accidentally swapping low and high USHORT for the 2.
    > >>>> parameter, should be:
    > >>>> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    > >>>> BKA_STATUSTEXTON,BKA_FIRST));
    > >>>> Also, you might want to experiment with the flags for the notebook
    > >>>> itself (BKS_...)
    > >>> This code is part of the SWT port. There is no code to show. There are
    > >>> a bunch of APIs that are called via JNI. The WinSendMessage works
    > >>> very well for every other call (so far). In the case of the
    > >>> BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    > >>> that are causing problems.
    > >>> I call a WinCreateWindow with the following styles:
    > >>> WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP
    > >>> Then I send the message BKM_INSERTPAGE with the following flags:
    > >>> BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST
    > >>> any ideas?
    > >> You need to include the code that creates the page you are inserting as well
    > >> as the pointers to that [age and the status of the create call. Insert Page
    > >> is very picky about the format of the pages it will accept and the status
    > >> codes are close to useless, best I recall.

    >
    > >> --
    > >> Will Honea
    > >> who...@yahoo.com

    >
    > > Ok, here goes the code and some logging:

    >
    > > - The call that creates the Notebook window is (remember this are Java
    > > wrappers for API calls) :

    >
    > > handle = OS.WinCreateWindow (
    > > parent.handle,
    > > windowClass (),
    > > windowTitle (),
    > > widgetStyle (),
    > > 0, parent.getHeight (), 0, 0,
    > > parent.handle,
    > > // to mimic the Windows behavior
    > > OS.HWND_BOTTOM, //OS.HWND_TOP,
    > > 0,
    > > 0,
    > > 0
    > > );

    >
    > > This operations works just fine an I get the following values in the
    > > log:
    > > [java] Control.createHandle(): Window has been created:
    > > [java] hwnd = 800000bf
    > > [java] hwnd.parent = hwnd.owner = 800000be
    > > [java] class = #40
    > > [java] style = b0020840

    >
    > a.) are you sure that "handle" points indeed to a Notebook window
    > (WC_NOTEBOOK) ?


    Yes
    >What does windowClass() return (should return WC_NOTEBOOK) ?


    class = 40 in hex is 28 and that's a WC_NOTEBOOK
    > b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    > and y = parent.getHeight() in relation to the parent (that is: outside
    > of the parent's dimensions as y = parent.getHeight()). Is this really
    > intended ?


    You got me there. That code was writen by dmik and it works for all
    other controls
    > c.) a window title for the notebook control itself is odd
    > (windowTitle()). Specify NULL for the title.


    The value is null for this particular call. You can overwrite that
    method for each control
    > d.) a window ID of 0 seems to be wrong to me


    I was suspicious of it too, but then I started to look at other
    people's code and they used constant values or 0
    > e.) Since you are using BKS_TABBEDDIALOG I guess you will also have to
    > use one of the following to specify the "layering":
    > #define BKS_BACKPAGESTR 0x00000004 /* Top right */
    > #define BKS_BACKPAGESTL 0x00000008 /* Top left */
    > As you can see, none of these are 0 therefore there is no default ...

    Agree, but...
    > See also "Presentation Manager Programming Guide and Ref"->Notebook Controls


    mmm... in the docs I got it says:

    Style Left to Right Right to Left
    (default)

    BKS_MAJORTABTOP (default) BKS_BACKPAGESTR BKS_BACKPAGESTL

    BKS_MAJORTABBOTTOM BKS_BACKPAGESBR BKS_BACKPAGESBL

    to me that was a default. Anyway I added the styles and the code still
    fails.

    Thanks for the ideas.

    Leonardo Pino



  14. Re: Can't insert a notebook page

    On 1 ago, 17:55, Lars Erdmann wrote:
    > lpino schrieb:
    >
    >
    >
    > > On 30 jul, 01:01, Will Honea wrote:
    > >> andrea.lecumbe...@gmail.com wrote:
    > >>> On 29 jul, 16:20, Lars Erdmann wrote:
    > >>>> lpino schrieb:
    > >>>>> I'm trying to insert a notebook page and I always get an error code:
    > >>>>> The code is very simple. I need to know how to find out why I get an
    > >>>>> error. The docs mention two reasons:
    > >>>>> - Invalid pageID (not the case since I'm using BKA_FIRST and the
    > >>>>> pageID is ignored)
    > >>>>> - Not enough space was available to allocate the page data (here I'm
    > >>>>> not sure what it means)
    > >>>>> What is the page data?, do I need it?, how do I reserve that space and
    > >>>>> when?
    > >>>>> Finally, is there a way to go deeper to try to find the reason for
    > >>>>> this kind of errors?. I can only check the return code but clearly
    > >>>>> that's not enough.
    > >>>>> Thanks very much
    > >>>>> Leonardo Pino
    > >>>> Maybe you are accidentally swapping low and high USHORT for the 2.
    > >>>> parameter, should be:
    > >>>> WinSendMsg(hwndNotebook,BKM_INSERTPAGE,MPVOID,MPFR OM2SHORT(BKA_MAJOR |
    > >>>> BKA_STATUSTEXTON,BKA_FIRST));
    > >>>> Also, you might want to experiment with the flags for the notebook
    > >>>> itself (BKS_...)
    > >>> This code is part of the SWT port. There is no code to show. There are
    > >>> a bunch of APIs that are called via JNI. The WinSendMessage works
    > >>> very well for every other call (so far). In the case of the
    > >>> BKM_INSERTPAGE returns 0. Maybe there is some combination of styles
    > >>> that are causing problems.
    > >>> I call a WinCreateWindow with the following styles:
    > >>> WS_VISIBLE | WS_CLIPCHILDREN | BKS_TABBEDDIALOG | BKS_MAJORTABTOP
    > >>> Then I send the message BKM_INSERTPAGE with the following flags:
    > >>> BKA_AUTOPAGESIZE | BKA_STATUSTEXTON | BKA_MAJOR and BKA_FIRST
    > >>> any ideas?
    > >> You need to include the code that creates the page you are inserting as well
    > >> as the pointers to that [age and the status of the create call. Insert Page
    > >> is very picky about the format of the pages it will accept and the status
    > >> codes are close to useless, best I recall.

    >
    > >> --
    > >> Will Honea
    > >> who...@yahoo.com

    >
    > > Ok, here goes the code and some logging:

    >
    > > - The call that creates the Notebook window is (remember this are Java
    > > wrappers for API calls) :

    >
    > > handle = OS.WinCreateWindow (
    > > parent.handle,
    > > windowClass (),
    > > windowTitle (),
    > > widgetStyle (),
    > > 0, parent.getHeight (), 0, 0,
    > > parent.handle,
    > > // to mimic the Windows behavior
    > > OS.HWND_BOTTOM, //OS.HWND_TOP,
    > > 0,
    > > 0,
    > > 0
    > > );

    >
    > > This operations works just fine an I get the following values in the
    > > log:
    > > [java] Control.createHandle(): Window has been created:
    > > [java] hwnd = 800000bf
    > > [java] hwnd.parent = hwnd.owner = 800000be
    > > [java] class = #40
    > > [java] style = b0020840

    >
    > a.) are you sure that "handle" points indeed to a Notebook window
    > (WC_NOTEBOOK) ? What does windowClass() return (should return WC_NOTEBOOK) ?
    > b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    > and y = parent.getHeight() in relation to the parent (that is: outside
    > of the parent's dimensions as y = parent.getHeight()). Is this really
    > intended ?
    > c.) a window title for the notebook control itself is odd
    > (windowTitle()). Specify NULL for the title.
    > d.) a window ID of 0 seems to be wrong to me
    > e.) Since you are using BKS_TABBEDDIALOG I guess you will also have to
    > use one of the following to specify the "layering":
    > #define BKS_BACKPAGESTR 0x00000004 /* Top right */
    > #define BKS_BACKPAGESTL 0x00000008 /* Top left */
    > As you can see, none of these are 0 therefore there is no default ...
    > See also "Presentation Manager Programming Guide and Ref"->Notebook Controls
    >
    > Lars


    At this point the only idea that comes to my mind would be to compare
    a dump of API calls between a dummy C example (that works) and the
    little testcase I have have written with SWT. Is there a tool to do
    such thing?. My PM experience is very basic so my mistake could be a
    really simple to solve.


    Thanks.

    Leonardo Pino


  15. Re: Can't insert a notebook page

    On Thu, 02 Aug 2007 13:14:31 -0700, lpino wrote:

    >> > handle = OS.WinCreateWindow (
    >> > parent.handle,
    >> > windowClass (),
    >> > windowTitle (),
    >> > widgetStyle (),
    >> > 0, parent.getHeight (), 0, 0,
    >> > parent.handle,
    >> > // to mimic the Windows behavior
    >> > OS.HWND_BOTTOM, //OS.HWND_TOP,
    >> > 0,
    >> > 0,
    >> > 0
    >> > );

    >>
    >> b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    >> and y = parent.getHeight() in relation to the parent (that is: outside
    >> of the parent's dimensions as y = parent.getHeight()). Is this really
    >> intended ?

    >
    > At this point the only idea that comes to my mind would be to compare
    > a dump of API calls between a dummy C example (that works) and the
    > little testcase I have have written with SWT. Is there a tool to do
    > such thing?. My PM experience is very basic so my mistake could be a
    > really simple to solve.


    OS2TRACE. You can use PMTREE for investigating windows etc. I would guess the
    window is created but not where you expect it. You seem to have ignored the
    advice about window width/height/position, which doesn't help your cause.

  16. Re: Can't insert a notebook page

    On 2 ago, 20:18, Paul Ratcliffe
    wrote:
    > On Thu, 02 Aug 2007 13:14:31 -0700, lpino wrote:
    > >> > handle = OS.WinCreateWindow (
    > >> > parent.handle,
    > >> > windowClass (),
    > >> > windowTitle (),
    > >> > widgetStyle (),
    > >> > 0, parent.getHeight (), 0, 0,
    > >> > parent.handle,
    > >> > // to mimic the Windows behavior
    > >> > OS.HWND_BOTTOM, //OS.HWND_TOP,
    > >> > 0,
    > >> > 0,
    > >> > 0
    > >> > );

    >
    > >> b.) the size of the Notebook is cx = 0 and cy = 0 and position is x = 0
    > >> and y = parent.getHeight() in relation to the parent (that is: outside
    > >> of the parent's dimensions as y = parent.getHeight()). Is this really
    > >> intended ?

    >
    > > At this point the only idea that comes to my mind would be to compare
    > > a dump of API calls between a dummy C example (that works) and the
    > > little testcase I have have written with SWT. Is there a tool to do
    > > such thing?. My PM experience is very basic so my mistake could be a
    > > really simple to solve.

    >
    > OS2TRACE. You can use PMTREE for investigating windows etc. I would guess the
    > window is created but not where you expect it. You seem to have ignored the
    > advice about window width/height/position, which doesn't help your cause.


    Paul, I didn't ignore the advice, in fact I tried changing the
    parameters but it didn't make any difference. I donwloaded the
    OS2TRACE tool and I'm learning to use it.

    After trying to get the right dlls to be included, a surprising thing
    happened. The tool reported that the call (BKM_INSERTPAGE) passed.
    Then I remenbered that the WinGetLastError returns 0, witch makes
    sence. Still something doesn't add up... why do I get 0 as the rc?.

    My next move will be to go on and complete the code using as example
    the code I found on the sources of PM123, since they are clear and
    neat.

    Thanks a lot for all the ideas and when it works I'll post here.

    Leonardo Pino



+ Reply to Thread