[GRASS-dev] gis.m: error message when trying to add layer without open map display

Michael,

Since you have been busy working on error catching in gis.m: I've always found that the error that occurs when you try to add a layer even though there is no open map display quite difficult to understand for newbies:

invalid command name ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1"
     while executing
"$tree($mon) selection get"
     (procedure "GmTree::add" line 11)
     invoked from within
"GmTree::add vector"
     ("uplevel" body line 1)
     invoked from within
"uplevel \#0 $cmd"
     (procedure "Button::_release" line 18)
     invoked from within
"Button::_release .mainframe.topf.tb0.bbox2.b0"
     (command bound to event)

Would it be possible to catch this and produce a nicer error message such as: "You need to open a map display first." ?

Moritz

Moritz,

I'll try to see what's going on with this. It probably has to do with the
necessary link between a layer tree and a display. A better error message
would likely be "You need to open a display before adding map layers"

Michael

On 2/8/07 6:11 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:

Michael,

Since you have been busy working on error catching in gis.m: I've always
found that the error that occurs when you try to add a layer even though
there is no open map display quite difficult to understand for newbies:

invalid command name ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1"
invalid command name ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1"
     while executing
"$tree($mon) selection get"
     (procedure "GmTree::add" line 11)
     invoked from within
"GmTree::add vector"
     ("uplevel" body line 1)
     invoked from within
"uplevel \#0 $cmd"
     (procedure "Button::_release" line 18)
     invoked from within
"Button::_release .mainframe.topf.tb0.bbox2.b0"
     (command bound to event)

Would it be possible to catch this and produce a nicer error message
such as: "You need to open a map display first." ?

Moritz

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Moritz:

> Since you have been busy working on error catching in gis.m: I've
> always found that the error that occurs when you try to add a layer
> even though there is no open map display quite difficult to
> understand for newbies:
>
> invalid command name
> ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1" invalid
> command name ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1"
> while executing
> "$tree($mon) selection get"

..

> Would it be possible to catch this and produce a nicer error message
> such as: "You need to open a map display first." ?

Michael:

I'll try to see what's going on with this. It probably has to do with
the necessary link between a layer tree and a display. A better error
message would likely be "You need to open a display before adding map
layers"

Even better: Don't bother with error messages, do what the user wanted:
open a new display if needed & add the layer.

Hamish

Good idea, but considerably more work to program this.

Michael

On 2/8/07 4:57 PM, "Hamish" <hamish_nospam@yahoo.com> wrote:

Moritz:

Since you have been busy working on error catching in gis.m: I've
always found that the error that occurs when you try to add a layer
even though there is no open map display quite difficult to
understand for newbies:

invalid command name
".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1" invalid
command name ".mainframe.frame.pw1.f0.frame.pgs.fpage_1.sw.tree_1"
     while executing
"$tree($mon) selection get"

..

Would it be possible to catch this and produce a nicer error message
such as: "You need to open a map display first." ?

Michael:

I'll try to see what's going on with this. It probably has to do with
the necessary link between a layer tree and a display. A better error
message would likely be "You need to open a display before adding map
layers"

Even better: Don't bother with error messages, do what the user wanted:
open a new display if needed & add the layer.

Hamish

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton