MenuRead() Question

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

MenuRead() Question

Keith Chamberlain
Dear List-mates,

I'm trying to read a tk window menu from a file using {svWidgets} and
'menus.txt' but am receiving Warnings without seeing the desired
consequences of the call.

library(svWidgets)
tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
MenuRead(file="menus.txt")

Warning messages:
1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)

<menu.txt - in RHOME>
$KSesnMain
|$MenuTest
||Objects  ~~ ls()
||-
||Path   ~~ search()

Please Advise,
KeithC.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: MenuRead() Question

Keith Chamberlain
Dear List-mates,

I think the difficulty I'm having is localized to the MenuType() call made
from within MenuRead(). I'm not used to seeing text operations such as "^"
or "[]", so am having trouble understanding what's going on.

I'm interested in understanding the regular expression:
regexpr("^[$]Tk[.].+/", menu), and why it my menus.txt file is not returning
at that point.

?regex explains that the "^" symbol excludes the text enclosed in brackets
what is in the character string in following brackets, so a bunch of
matching on string vectors going on that I don't understand well enough yet.
Do I need to install PCRE-6.6 for this to start working?

Rgds,
KeithC.



-----Original Message-----
From: Keith Chamberlain [mailto:[hidden email]]
Sent: Saturday, March 25, 2006 4:26 PM
To: '[hidden email]'
Cc: 'Philippe Grosjean'
Subject: MenuRead() Question

Dear List-mates,

I'm trying to read a tk window menu from a file using {svWidgets} and
'menus.txt' but am receiving Warnings without seeing the desired
consequences of the call.

library(svWidgets)
tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
MenuRead(file="menus.txt")

Warning messages:
1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)

<menu.txt - in RHOME>
$KSesnMain
|$MenuTest
||Objects  ~~ ls()
||-
||Path   ~~ search()

Please Advise,
KeithC.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: MenuRead() Question

Gabor Grothendieck
On 3/26/06, Keith Chamberlain <[hidden email]> wrote:

> Dear List-mates,
>
> I think the difficulty I'm having is localized to the MenuType() call made
> from within MenuRead(). I'm not used to seeing text operations such as "^"
> or "[]", so am having trouble understanding what's going on.
>
> I'm interested in understanding the regular expression:
> regexpr("^[$]Tk[.].+/", menu), and why it my menus.txt file is not returning
> at that point.
>
> ?regex explains that the "^" symbol excludes the text enclosed in brackets

Outside of [...] ^ and $ mean beginning of string and end of string.
Putting characters within [...] removes their special meaning.

> what is in the character string in following brackets, so a bunch of
> matching on string vectors going on that I don't understand well enough yet.
> Do I need to install PCRE-6.6 for this to start working?
>
> Rgds,
> KeithC.
>
>
>
> -----Original Message-----
> From: Keith Chamberlain [mailto:[hidden email]]
> Sent: Saturday, March 25, 2006 4:26 PM
> To: '[hidden email]'
> Cc: 'Philippe Grosjean'
> Subject: MenuRead() Question
>
> Dear List-mates,
>
> I'm trying to read a tk window menu from a file using {svWidgets} and
> 'menus.txt' but am receiving Warnings without seeing the desired
> consequences of the call.
>
> library(svWidgets)
> tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
> MenuRead(file="menus.txt")
>
> Warning messages:
> 1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>
> <menu.txt - in RHOME>
> $KSesnMain
> |$MenuTest
> ||Objects  ~~ ls()
> ||-
> ||Path     ~~ search()
>
> Please Advise,
> KeithC.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: MenuRead() Question

Philippe Grosjean
In reply to this post by Keith Chamberlain
Hi Keith,

If you want to define a Tk menu using MenuRead() and a text file to
define your menu, you have to start it with "Tk.". That way, MenuRead()
recognizes that it is a Tk menu. So, rewrite your menu definition file as:

 > <menu.txt - in RHOME>
 > $Tk.KSesnMain
 > |$MenuTest
 > ||Objects        ~~ ls()
 > ||-
 > ||Path   ~~ search()

Note also that KSesnMain must point to a valid Tk window previously
constructed.
Best,

Philippe Grosjean


Keith Chamberlain wrote:

> Dear List-mates,
>
> I think the difficulty I'm having is localized to the MenuType() call made
> from within MenuRead(). I'm not used to seeing text operations such as "^"
> or "[]", so am having trouble understanding what's going on.
>
> I'm interested in understanding the regular expression:
> regexpr("^[$]Tk[.].+/", menu), and why it my menus.txt file is not returning
> at that point.
>
> ?regex explains that the "^" symbol excludes the text enclosed in brackets
> what is in the character string in following brackets, so a bunch of
> matching on string vectors going on that I don't understand well enough yet.
> Do I need to install PCRE-6.6 for this to start working?
>
> Rgds,
> KeithC.
>
>
>
> -----Original Message-----
> From: Keith Chamberlain [mailto:[hidden email]]
> Sent: Saturday, March 25, 2006 4:26 PM
> To: '[hidden email]'
> Cc: 'Philippe Grosjean'
> Subject: MenuRead() Question
>
> Dear List-mates,
>
> I'm trying to read a tk window menu from a file using {svWidgets} and
> 'menus.txt' but am receiving Warnings without seeing the desired
> consequences of the call.
>
> library(svWidgets)
> tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
> MenuRead(file="menus.txt")
>
> Warning messages:
> 1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>
> <menu.txt - in RHOME>
> $KSesnMain
> |$MenuTest
> ||Objects  ~~ ls()
> ||-
> ||Path   ~~ search()
>
> Please Advise,
> KeithC.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: MenuRead() Question

Keith Chamberlain
Dear Gabor & Philipe,

Thank you for clarifying regular expressions, and how tk menus are
demarcated in menus.txt. Regular expressions are beginning to make sense for
me, and the menu is now being added properly to the tk window.

regexpr("^[$]Tk[.].+/", menu)...
If I understand better, the expression is matching "$Tk." but since "$" and
"." have special meanings in regular expressions, they need to be in
brackets so that they are interpreted literally.

Rgds,
KeithC.

-----Original Message-----
From: Philippe Grosjean [mailto:[hidden email]]
Sent: Sunday, March 26, 2006 9:49 AM
To: Keith Chamberlain
Cc: [hidden email]
Subject: Re: [R] MenuRead() Question

Hi Keith,

If you want to define a Tk menu using MenuRead() and a text file to
define your menu, you have to start it with "Tk.". That way, MenuRead()
recognizes that it is a Tk menu. So, rewrite your menu definition file as:

 > <menu.txt - in RHOME>
 > $Tk.KSesnMain
 > |$MenuTest
 > ||Objects        ~~ ls()
 > ||-
 > ||Path   ~~ search()

Note also that KSesnMain must point to a valid Tk window previously
constructed.
Best,

Philippe Grosjean


Keith Chamberlain wrote:
> Dear List-mates,
>
> I think the difficulty I'm having is localized to the MenuType() call made
> from within MenuRead(). I'm not used to seeing text operations such as "^"
> or "[]", so am having trouble understanding what's going on.
>
> I'm interested in understanding the regular expression:
> regexpr("^[$]Tk[.].+/", menu), and why it my menus.txt file is not
returning
> at that point.
>
> ?regex explains that the "^" symbol excludes the text enclosed in brackets
> what is in the character string in following brackets, so a bunch of
> matching on string vectors going on that I don't understand well enough
yet.

> Do I need to install PCRE-6.6 for this to start working?
>
> Rgds,
> KeithC.
>
>
>
> -----Original Message-----
> From: Keith Chamberlain [mailto:[hidden email]]
> Sent: Saturday, March 25, 2006 4:26 PM
> To: '[hidden email]'
> Cc: 'Philippe Grosjean'
> Subject: MenuRead() Question
>
> Dear List-mates,
>
> I'm trying to read a tk window menu from a file using {svWidgets} and
> 'menus.txt' but am receiving Warnings without seeing the desired
> consequences of the call.
>
> library(svWidgets)
> tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
> MenuRead(file="menus.txt")
>
> Warning messages:
> 1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
> 4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>
> <menu.txt - in RHOME>
> $KSesnMain
> |$MenuTest
> ||Objects  ~~ ls()
> ||-
> ||Path   ~~ search()
>
> Please Advise,
> KeithC.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: MenuRead() Question

Brian Ripley
On Sun, 26 Mar 2006, Keith Chamberlain wrote:

> Dear Gabor & Philipe,
>
> Thank you for clarifying regular expressions, and how tk menus are
> demarcated in menus.txt. Regular expressions are beginning to make sense for
> me, and the menu is now being added properly to the tk window.
>
> regexpr("^[$]Tk[.].+/", menu)...
> If I understand better, the expression is matching "$Tk." but since "$" and
> "." have special meanings in regular expressions, they need to be in
> brackets so that they are interpreted literally.

Or, better, escaped by \ (entered as \\ in an R character string).
Please do read ?regexp for how to use regular expressions in R.


>
> Rgds,
> KeithC.
>
> -----Original Message-----
> From: Philippe Grosjean [mailto:[hidden email]]
> Sent: Sunday, March 26, 2006 9:49 AM
> To: Keith Chamberlain
> Cc: [hidden email]
> Subject: Re: [R] MenuRead() Question
>
> Hi Keith,
>
> If you want to define a Tk menu using MenuRead() and a text file to
> define your menu, you have to start it with "Tk.". That way, MenuRead()
> recognizes that it is a Tk menu. So, rewrite your menu definition file as:
>
> > <menu.txt - in RHOME>
> > $Tk.KSesnMain
> > |$MenuTest
> > ||Objects        ~~ ls()
> > ||-
> > ||Path   ~~ search()
>
> Note also that KSesnMain must point to a valid Tk window previously
> constructed.
> Best,
>
> Philippe Grosjean
>
>
> Keith Chamberlain wrote:
>> Dear List-mates,
>>
>> I think the difficulty I'm having is localized to the MenuType() call made
>> from within MenuRead(). I'm not used to seeing text operations such as "^"
>> or "[]", so am having trouble understanding what's going on.
>>
>> I'm interested in understanding the regular expression:
>> regexpr("^[$]Tk[.].+/", menu), and why it my menus.txt file is not
> returning
>> at that point.
>>
>> ?regex explains that the "^" symbol excludes the text enclosed in brackets
>> what is in the character string in following brackets, so a bunch of
>> matching on string vectors going on that I don't understand well enough
> yet.
>> Do I need to install PCRE-6.6 for this to start working?
>>
>> Rgds,
>> KeithC.
>>
>>
>>
>> -----Original Message-----
>> From: Keith Chamberlain [mailto:[hidden email]]
>> Sent: Saturday, March 25, 2006 4:26 PM
>> To: '[hidden email]'
>> Cc: 'Philippe Grosjean'
>> Subject: MenuRead() Question
>>
>> Dear List-mates,
>>
>> I'm trying to read a tk window menu from a file using {svWidgets} and
>> 'menus.txt' but am receiving Warnings without seeing the desired
>> consequences of the call.
>>
>> library(svWidgets)
>> tkWinAdd("KSesnMain",title="kLab Session Manager for R", pos="+0+0")
>> MenuRead(file="menus.txt")
>>
>> Warning messages:
>> 1: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>> 2: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>> 3: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>> 4: Unrecognized menu type for $KSesnMain/MenuTest in: MenuType(menu)
>>
>> <menu.txt - in RHOME>
>> $KSesnMain
>> |$MenuTest
>> ||Objects  ~~ ls()
>> ||-
>> ||Path   ~~ search()
>>
>> Please Advise,
>> KeithC.
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>>
>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html