Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

return frame from package

31 views
Skip to first unread message

Kim Skatun

unread,
May 15, 2013, 4:01:09 AM5/15/13
to
I am currently using this code which works:

# Generate geometry pane
geometry::getPane


gridplus notebook .mynotebook2 -relief raised {
"Naca" .geometryFrame
"Browse" .mypage2
"Modify" .mypage3
}


however i would like to use:

gridplus notebook .mynotebook2 -relief raised {
"Naca" geometry::getPane
"Browse" .mypage2
"Modify" .mypage3
}


Here is my package:

package provide geometry 1.0

package require gridplus 1.0
namespace import gridplus::*

namespace eval ::geometry {
# this is the public interface
namespace export geometry

# these contain references to available commands and subcommands
#variable getPane

}

proc ::geometry::geometry {args} {
}
proc ::geometry::getPane {} {
button .generateNaca -text "Generate" -command "geometry::airfoilGen"
button .browseAirfoil -text "Browse"

entry .naca -width 8 -textvariable nacaEdit
entry .geomb -width 20


gridplus grid .geometryPage -size 80 {
"NACA 4-Series Airfoil" .naca .generateNaca
{"File" .geomb} - .browseAirfoil
}


gridplus button .buttons {
{Find .find} {Exit .exit}
}


gridplus layout .geometryFrame {
.geometryPage
}


}


Also i cant figure out how to use the value of .naca in another procedure

Adrian Davis

unread,
May 17, 2013, 8:06:24 AM5/17/13
to
Kim,

Firstly I would strongly recommend that you use GRIDPLUS2 (http://
www.satisoft.com/tcltk/gridplus2). This has been the main/developed
version since 2006. GRIDPLUS2 has considerably more functionality than
the earlier version. Almost every screen/window layout can be created
with significantly less code.

I suggest you take a look at Example 4 (http://www.satisoft.com/tcltk/
gridplus2/example4.html) as this uses some of the features you are
using in your example.

For Example: Using GRIDPLUS2 the "::geometry::getPane" procedure could
be reduced to something like:-


proc ::geometry::getPane {} {
gridplus entry .geometryPage {
{"NACA 4-Series Airfoil" .naca 8} {&b "Generate" .generateNaca
~geometry::airfoilGen}
{"File" .geomb 20} {&b
"Browse" .browseAirfoil}
}
}


The default name of the command invoked by a GRIDPLUS button is based
on the name of the grid and the name of the item. In the above example
the "Browse" button will invoke a procedure called
"geometryPage,browseAirfoil". It is possible, as shown for the
"Generate" button, to use the "~" widget option explicitly specify a
procedure. In this case the name of the button isn't important, so you
could just let GRIDPLUS generate a name automatically. The procedure
then becomes...


proc ::geometry::getPane {} {
gridplus entry .geometryPage {
{"NACA 4-Series Airfoil" .naca 8} {&b "Generate" .
~geometry::airfoilGen}
{"File" .geomb 20} {&b
"Browse" .browseAirfoil}
}
}

NOTE: I'm not sure what ".buttons" is for, so I have omitted this from
my example.


The easiest way to access GRIDPLUS(2) values in "other" procedures is
to use...


global {}


...In the procedure. In the case of my example the ".naca" entry value
can be referenced as: $(geometryPage,naca)


As for the notebook: Your working version is the recommended method
for GRIDPLUS. However, you could change my example above to...


proc ::geometry::getPane {} {
gridplus entry .geometryPage {
{"NACA 4-Series Airfoil" .naca 8} {&b "Generate" .
~geometry::airfoilGen}
{"File" .geomb 20} {&b
"Browse" .browseAirfoil}
}
return .geometryPage
}


...you could then change the quoting used for the notebook to...



gridplus notebook .mynotebook2 "
{Naca} [geometry::getPane]
{Browse} .mypage2
{Modify} .mypage3
"


Your idea is interesting, I shall consider incorporating a better
method into the next GRIDPLUS2 release.

Very Best Regards,
=Adrian=

Adrian Davis

unread,
May 17, 2013, 8:14:19 AM5/17/13
to
Sorry, The wrap has screwed the example procedures. I think you should
be able to get the idea.

I'll try again below - Maybe it will work this time...

proc ::geometry::getPane {} {
gridplus entry .geometryPage {
{"NACA 4-Series Airfoil" .naca 8} {&b "Generate" .generateNaca
~geometry::airfoilGen}
{"File" .geomb 20} {&b
"Browse" .browseAirfoil}
}
}

proc ::geometry::getPane {} {
gridplus entry .geometryPage {
{"NACA 4-Series Airfoil" .naca 8} {&b "Generate" .
~geometry::airfoilGen}
{"File" .geomb 20} {&b
"Browse" .browseAirfoil}
}
}

Kim Skatun

unread,
May 21, 2013, 6:31:07 AM5/21/13
to
Sorry for late reply, have been on holidays lately.
Will look at it
0 new messages