Alaska Software Inc. - Using a menubar in xbpcrt
Username: Password:
AuthorTopic: Using a menubar in xbpcrt
Daniel GodefroyUsing a menubar in xbpcrt
on Tue, 01 Mar 2005 21:23:46 -0500
I need to move on GUI version. As recommended I am going step by step. i
need the xbpcrt window to style display my text base output. I tried to add
a menuber in this window. Whenever I get to the additem method i get the
message that this is a reserved word.

In the appsys function I have:

oDlg:=xbpCrt():new:AppDesktop())
oDlg:create()
SetappWindow(oDlg)
m_bar:oDlg:Menubar()
@ 10,5 say m_bar:clasname()
wait
m_bar:additem(.....)
m_bar:title:="Title"

I get the message XBPmenuBar confirming that m_bar is an xbpmenubar object.

However at compile time I get the message that I have a reserved keyword on
the additem line. If I comment it out the compilation goes through. At
execution time I get the message that m_bar do not have the member title.

Any help

Thanks
James Loughner Re: Using a menubar in xbpcrt
on Tue, 01 Mar 2005 21:42:04 -0500
From the Doc's  XbpMenu

        Install menu bar in the XbpCrt window
       oMenuBar := SetAppWindow():MenuBar()


        Define submenu in procedural style.
        The numeric index of the selected menu item
        is passed to the Callback code block -> mp1
Note->oSubMenu       := XbpMenu():new(oMenuBar):create()
       oSubMenu:title := "~Procedural"
       oSubMenu:addItem( { "Procedure ~1", } )
       oSubMenu:addItem( { "Procedure ~2", } )
       oSubMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
       oMenuBar:addItem( { oSubMenu, NIL } )

You must add a menu object to a menu object

Jim

Daniel Godefroy wrote:
> I need to move on GUI version. As recommended I am going step by step. i
> need the xbpcrt window to style display my text base output. I tried to add
> a menuber in this window. Whenever I get to the additem method i get the
> message that this is a reserved word.
> 
> In the appsys function I have:
> 
> oDlg:=xbpCrt():new:AppDesktop())
> oDlg:create()
> SetappWindow(oDlg)
> m_bar:oDlg:Menubar()
> @ 10,5 say m_bar:clasname()
> wait
> m_bar:additem(.....)
> m_bar:title:="Title"
> 
> I get the message XBPmenuBar confirming that m_bar is an xbpmenubar object.
> 
> However at compile time I get the message that I have a reserved keyword on
> the additem line. If I comment it out the compilation goes through. At
> execution time I get the message that m_bar do not have the member title.
> 
> Any help
> 
> Thanks
> 
>
Daniel GodefroyRe: Using a menubar in xbpcrt
on Tue, 01 Mar 2005 22:42:46 -0500
Thanks for the precision. On the documentation it said that additem takes an
array with one to four items. The secons item is a code block. I was using
the following construct:
m_bar:additem({"Fin",{||exit}})
When i take the code block out it works ok. This means:
m_bar:additem({"Fin"}

I do not quite understand the reason. It would be good if you could explain
it for me

Thanks again for pointing this difference to me

"James Loughner" <jwrl@charter.net> wrote in message
news:2dOvsFtHFHA.3104@S15147418...
> From the Doc's  XbpMenu
>
>         Install menu bar in the XbpCrt window
>        oMenuBar := SetAppWindow():MenuBar()
>
>
>         Define submenu in procedural style.
>         The numeric index of the selected menu item
>         is passed to the Callback code block -> mp1
> Note->oSubMenu       := XbpMenu():new(oMenuBar):create()
>        oSubMenu:title := "~Procedural"
>        oSubMenu:addItem( { "Procedure ~1", } )
>        oSubMenu:addItem( { "Procedure ~2", } )
>        oSubMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
>        oMenuBar:addItem( { oSubMenu, NIL } )
>
> You must add a menu object to a menu object
>
> Jim
>
> Daniel Godefroy wrote:
> > I need to move on GUI version. As recommended I am going step by step. i
> > need the xbpcrt window to style display my text base output. I tried to
add
> > a menuber in this window. Whenever I get to the additem method i get the
> > message that this is a reserved word.
> >
> > In the appsys function I have:
> >
> > oDlg:=xbpCrt():new:AppDesktop())
> > oDlg:create()
> > SetappWindow(oDlg)
> > m_bar:oDlg:Menubar()
> > @ 10,5 say m_bar:clasname()
> > wait
> > m_bar:additem(.....)
> > m_bar:title:="Title"
> >
> > I get the message XBPmenuBar confirming that m_bar is an xbpmenubar
object.
> >
> > However at compile time I get the message that I have a reserved keyword
on
> > the additem line. If I comment it out the compilation goes through. At
> > execution time I get the message that m_bar do not have the member
title.
> >
> > Any help
> >
> > Thanks
> >
> >
James Loughner Re: Using a menubar in xbpcrt
on Wed, 02 Mar 2005 01:19:23 -0500
What is exit??? If a function or procedure it should be

exit()

Jim


Daniel Godefroy wrote:
> Thanks for the precision. On the documentation it said that additem takes an
> array with one to four items. The secons item is a code block. I was using
> the following construct:
> m_bar:additem({"Fin",{||exit}})
> When i take the code block out it works ok. This means:
> m_bar:additem({"Fin"}
> 
> I do not quite understand the reason. It would be good if you could explain
> it for me
> 
> Thanks again for pointing this difference to me
> 
> "James Loughner" <jwrl@charter.net> wrote in message
> news:2dOvsFtHFHA.3104@S15147418...
> 
>>From the Doc's  XbpMenu
>>
>>        Install menu bar in the XbpCrt window
>>       oMenuBar := SetAppWindow():MenuBar()
>>
>>
>>        Define submenu in procedural style.
>>        The numeric index of the selected menu item
>>        is passed to the Callback code block -> mp1
>>Note->oSubMenu       := XbpMenu():new(oMenuBar):create()
>>       oSubMenu:title := "~Procedural"
>>       oSubMenu:addItem( { "Procedure ~1", } )
>>       oSubMenu:addItem( { "Procedure ~2", } )
>>       oSubMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
>>       oMenuBar:addItem( { oSubMenu, NIL } )
>>
>>You must add a menu object to a menu object
>>
>>Jim
>>
>>Daniel Godefroy wrote:
>>
>>>I need to move on GUI version. As recommended I am going step by step. i
>>>need the xbpcrt window to style display my text base output. I tried to
> 
> add
> 
>>>a menuber in this window. Whenever I get to the additem method i get the
>>>message that this is a reserved word.
>>>
>>>In the appsys function I have:
>>>
>>>oDlg:=xbpCrt():new:AppDesktop())
>>>oDlg:create()
>>>SetappWindow(oDlg)
>>>m_bar:oDlg:Menubar()
>>>@ 10,5 say m_bar:clasname()
>>>wait
>>>m_bar:additem(.....)
>>>m_bar:title:="Title"
>>>
>>>I get the message XBPmenuBar confirming that m_bar is an xbpmenubar
> 
> object.
> 
>>>However at compile time I get the message that I have a reserved keyword
> 
> on
> 
>>>the additem line. If I comment it out the compilation goes through. At
>>>execution time I get the message that m_bar do not have the member
> 
> title.
> 
>>>Any help
>>>
>>>Thanks
>>>
>>>
> 
> 
>
Daniel GodefroyRe: Using a menubar in xbpcrt
on Wed, 02 Mar 2005 08:44:05 -0500
exit is the command to end a loop in clipper. I just put a function name in
its place and it took it. The error explanation is really imprecise. I did
not know that commands were not accepted in the block code in Alaska. I
guess that skip or some thong like that would not work either?

Thanks for the explanations

"James Loughner" <jwrl@charter.net> wrote in message
news:IaGeC$uHFHA.6160@S15147418...
> What is exit??? If a function or procedure it should be
>
> exit()
>
> Jim
>
>
> Daniel Godefroy wrote:
> > Thanks for the precision. On the documentation it said that additem
takes an
> > array with one to four items. The secons item is a code block. I was
using
> > the following construct:
> > m_bar:additem({"Fin",{||exit}})
> > When i take the code block out it works ok. This means:
> > m_bar:additem({"Fin"}
> >
> > I do not quite understand the reason. It would be good if you could
explain
> > it for me
> >
> > Thanks again for pointing this difference to me
> >
> > "James Loughner" <jwrl@charter.net> wrote in message
> > news:2dOvsFtHFHA.3104@S15147418...
> >
> >>From the Doc's  XbpMenu
> >>
> >>        Install menu bar in the XbpCrt window
> >>       oMenuBar := SetAppWindow():MenuBar()
> >>
> >>
> >>        Define submenu in procedural style.
> >>        The numeric index of the selected menu item
> >>        is passed to the Callback code block -> mp1
> >>Note->oSubMenu       := XbpMenu():new(oMenuBar):create()
> >>       oSubMenu:title := "~Procedural"
> >>       oSubMenu:addItem( { "Procedure ~1", } )
> >>       oSubMenu:addItem( { "Procedure ~2", } )
> >>       oSubMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
> >>       oMenuBar:addItem( { oSubMenu, NIL } )
> >>
> >>You must add a menu object to a menu object
> >>
> >>Jim
> >>
> >>Daniel Godefroy wrote:
> >>
> >>>I need to move on GUI version. As recommended I am going step by step.
i
> >>>need the xbpcrt window to style display my text base output. I tried to
> >
> > add
> >
> >>>a menuber in this window. Whenever I get to the additem method i get
the
> >>>message that this is a reserved word.
> >>>
> >>>In the appsys function I have:
> >>>
> >>>oDlg:=xbpCrt():new:AppDesktop())
> >>>oDlg:create()
> >>>SetappWindow(oDlg)
> >>>m_bar:oDlg:Menubar()
> >>>@ 10,5 say m_bar:clasname()
> >>>wait
> >>>m_bar:additem(.....)
> >>>m_bar:title:="Title"
> >>>
> >>>I get the message XBPmenuBar confirming that m_bar is an xbpmenubar
> >
> > object.
> >
> >>>However at compile time I get the message that I have a reserved
keyword
> >
> > on
> >
> >>>the additem line. If I comment it out the compilation goes through. At
> >>>execution time I get the message that m_bar do not have the member
> >
> > title.
> >
> >>>Any help
> >>>
> >>>Thanks
> >>>
> >>>
> >
> >
> >
James Loughner Re: Using a menubar in xbpcrt
on Wed, 02 Mar 2005 10:13:17 -0500
You can't use a command in a codeblock. must be a function.

Jim

Daniel Godefroy wrote:
> exit is the command to end a loop in clipper. I just put a function name in
> its place and it took it. The error explanation is really imprecise. I did
> not know that commands were not accepted in the block code in Alaska. I
> guess that skip or some thong like that would not work either?
> 
> Thanks for the explanations
> 
> "James Loughner" <jwrl@charter.net> wrote in message
> news:IaGeC$uHFHA.6160@S15147418...
> 
>>What is exit??? If a function or procedure it should be
>>
>>exit()
>>
>>Jim
>>
>>
>>Daniel Godefroy wrote:
>>
>>>Thanks for the precision. On the documentation it said that additem
> 
> takes an
> 
>>>array with one to four items. The secons item is a code block. I was
> 
> using
> 
>>>the following construct:
>>>m_bar:additem({"Fin",{||exit}})
>>>When i take the code block out it works ok. This means:
>>>m_bar:additem({"Fin"}
>>>
>>>I do not quite understand the reason. It would be good if you could
> 
> explain
> 
>>>it for me
>>>
>>>Thanks again for pointing this difference to me
>>>
>>>"James Loughner" <jwrl@charter.net> wrote in message
>>>news:2dOvsFtHFHA.3104@S15147418...
>>>
>>>>From the Doc's  XbpMenu
>>>
>>>>       Install menu bar in the XbpCrt window
>>>>      oMenuBar := SetAppWindow():MenuBar()
>>>>
>>>>
>>>>       Define submenu in procedural style.
>>>>       The numeric index of the selected menu item
>>>>       is passed to the Callback code block -> mp1
>>>>Note->oSubMenu       := XbpMenu():new(oMenuBar):create()
>>>>      oSubMenu:title := "~Procedural"
>>>>      oSubMenu:addItem( { "Procedure ~1", } )
>>>>      oSubMenu:addItem( { "Procedure ~2", } )
>>>>      oSubMenu:itemSelected := {|mp1| MyMenuProcedure( 100+mp1 ) }
>>>>      oMenuBar:addItem( { oSubMenu, NIL } )
>>>>
>>>>You must add a menu object to a menu object
>>>>
>>>>Jim
>>>>
>>>>Daniel Godefroy wrote:
>>>>
>>>>
>>>>>I need to move on GUI version. As recommended I am going step by step.
> 
> i
> 
>>>>>need the xbpcrt window to style display my text base output. I tried to
>>>
>>>add
>>>
>>>
>>>>>a menuber in this window. Whenever I get to the additem method i get
> 
> the
> 
>>>>>message that this is a reserved word.
>>>>>
>>>>>In the appsys function I have:
>>>>>
>>>>>oDlg:=xbpCrt():new:AppDesktop())
>>>>>oDlg:create()
>>>>>SetappWindow(oDlg)
>>>>>m_bar:oDlg:Menubar()
>>>>>@ 10,5 say m_bar:clasname()
>>>>>wait
>>>>>m_bar:additem(.....)
>>>>>m_bar:title:="Title"
>>>>>
>>>>>I get the message XBPmenuBar confirming that m_bar is an xbpmenubar
>>>
>>>object.
>>>
>>>
>>>>>However at compile time I get the message that I have a reserved
> 
> keyword
> 
>>>on
>>>
>>>
>>>>>the additem line. If I comment it out the compilation goes through. At
>>>>>execution time I get the message that m_bar do not have the member
>>>
>>>title.
>>>
>>>
>>>>>Any help
>>>>>
>>>>>Thanks
>>>>>
>>>>>
>>>
>>>
>>>
> 
>
Phil Ide
Re: Using a menubar in xbpcrt
on Thu, 03 Mar 2005 12:45:16 +0000
Daniel,

> exit is the command to end a loop in clipper. I just put a function name in
> its place and it took it. The error explanation is really imprecise. I did
> not know that commands were not accepted in the block code in Alaska. I
> guess that skip or some thong like that would not work either?

As Jim said, no commands in code-blocks.  For SKIP etc you can use the
fuunctional equivalent - dbSkip().

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Sir, Romulan Warbird decloaking &^#%$&... No Carrier
Frans VermeulenRe: Using a menubar in xbpcrt
on Thu, 03 Mar 2005 14:02:09 +0100
> As Jim said, no commands in code-blocks.  For SKIP etc you can use the
> fuunctional equivalent - dbSkip().

To add to this:
Commands can always be worked around.

Keywords like:
Exit, For, Next, Do While, EndDo
are not really commands, but they are called "statements"
in the docs.

I know the example is stupid, but the trick to work around the
command in codeblock limitation is like this:

Procedure MySkip()
     SKIP
Return

{||MySkip()}

HTH,
Frans Vermeulen
Thomas Braun
Re: Using a menubar in xbpcrt
on Thu, 03 Mar 2005 18:52:16 +0100
On Thu, 3 Mar 2005 14:02:09 +0100, Frans Vermeulen wrote:

> I know the example is stupid

Yes, you are right 

> , but the trick to work around the
> command in codeblock limitation is like this:

Is there any COMMAND that does not have a function equivalent?
Or tho ask it in a different way... is there a "command in a codeblock"
limitation?

IMO, all commands are preprocessed via std.ch (or other ch files) into
function calls. Which raises one interesting question... are commands part
of the language syntax? (the compiler never sees a command, only function
calls)

Thomas

Xbase++ FAQ : www.software-braun.de/xbasecentral/xbfaq/
To define recursion, we must first define recursion.
Frans VermeulenRe: Using a menubar in xbpcrt
on Thu, 03 Mar 2005 20:59:53 +0100
Thomas,

> Is there any COMMAND that does not have a function equivalent?
> Or tho ask it in a different way... is there a "command in a codeblock"
> limitation?

Good question, to be honest I don't know any example.
The one that comes near is the DllFunction, err.. command ???

Not a command either, but it proves there are commands possible, 
which cannot be translated into a function call.

Another stupid example perhaps:
#xCommand Increase <x> => For i:=1 To Len(x); x[i]++; Next

Or:
Set Filter To ?

Regards,
Frans Vermeulen
Wolfgang CiriackRe: Using a menubar in xbpcrt
on Fri, 04 Mar 2005 06:38:40 +0100
Hi Frans,
> Or:
> Set Filter To ?

DbSetfilter()  ??

Regards Wolfgang
Frans VermeulenRe: Using a menubar in xbpcrt
on Fri, 04 Mar 2005 10:23:02 +0100
Wolfgang,

> > Set Filter To ?
>
> DbSetfilter()  ??

How do they say...,  Close but no cigar ?
have a look at the std.ch somewhere at line 474
(v1.82)

Regards,
Frans Vermeulen
Thomas Braun
Re: Using a menubar in xbpcrt
on Fri, 04 Mar 2005 12:53:32 +0100
On Fri, 4 Mar 2005 10:23:02 +0100, Frans Vermeulen wrote:

>> DbSetfilter()  ??
>
> How do they say...,  Close but no cigar ?
> have a look at the std.ch somewhere at line 474
> (v1.82)

iif ( Empty(<(x)>), dbClearFilter(), dbSetFilter(__EBCB(<x>), <(x)>) )

(hopefully I didn't miss a bracket 

Because I'm a non-smoker, I prefer a beer or a good
whiskey over a cigar 

I'm shure that would have called Joao into this discussion... (Joao,
wherever you may be now, I hope they have Havanas there 

Thomas

Xbase++ FAQ : www.software-braun.de/xbasecentral/xbfaq/
Heisenberg might have been here.
Thomas Braun
Re: Using a menubar in xbpcrt
on Fri, 04 Mar 2005 12:54:32 +0100
On Thu, 3 Mar 2005 20:59:53 +0100, Frans Vermeulen wrote:

> Not a command either, but it proves there are commands possible,
> which cannot be translated into a function call.
>
> Another stupid example perhaps:
> #xCommand Increase <x> => For i:=1 To Len(x); x[i]++; Next

Ah yes, that is a valid one.

Thomas

Xbase++ FAQ : www.software-braun.de/xbasecentral/xbfaq/
"Why are we hiding from the police dad?"
"They use EMACS son.  We use vi".
 		-- Peter Gutmann