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

OpenSheet using a variable (most likely a string?

410 views
Skip to first unread message

Rosalind

unread,
Apr 8, 2003, 1:31:51 PM4/8/03
to
Is there anyway to open a MDI sheet using a variable most likely first
stored as a string?


Philip_Salgannik

unread,
Apr 8, 2003, 2:22:28 PM4/8/03
to
From Help:
Syntax

OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position
{, arrangeopen } } )

Argument Description
sheetrefvar The name of any window variable that is not an MDI frame
window. OpenSheet places a reference to the open sheet in sheetrefvar
windowtype (optional) A s-t-r-i-n-g whose value is the data type of the
window you want to open. The data type of windowtype must be the same or a
descendant of sheetrefvar

Greg Winfield

unread,
Apr 8, 2003, 2:30:06 PM4/8/03
to
Use OpenSheetWithParm especially if you need to pass more than one
variable...store them in an nvo and pass it

OpenSheetWithParm ( sheetrefvar, parameter {, windowtype }, mdiframe


{, position {, arrangeopen } } )


Greg

"Rosalind" <r...@brcf.org> wrote in message
news:u$NHbUf$CHA.317@forums-1-dub...

jla...@hotmail.com

unread,
Apr 8, 2003, 3:24:38 PM4/8/03
to
seems like some people's versions of powerbuilder didn't come with the help
files

Rosalind

unread,
Apr 9, 2003, 8:49:53 AM4/9/03
to
Yes, use the OpenSheet function -- but if you substitute a string variable
for the window class name you get an error. You even get an error if you
use a variable such as l_window. Is there anyway to open the sheet using
some sort of variable instead of the class name of the window???

"Rosalind" <r...@brcf.org> wrote in message
news:u$NHbUf$CHA.317@forums-1-dub...

Philip_Salgannik

unread,
Apr 9, 2003, 11:04:14 AM4/9/03
to
If the variable does NOT contain a name of an existing class, then what do
you expect to get opened?

Rosalind

unread,
Apr 9, 2003, 11:06:18 AM4/9/03
to
The window name is in a file. It is a string data type. Essentially I have
had to resort to something like this.

IF is_window[row] = 'w_post_gl' THEN
OpenSheet(w_post_gl,w_brcf_frame, 0, layered!)
ELSEIF ...

END IF

Just wondering if there was another way...
<Philip_Salgannik> wrote in message
news:FC98DB0C815B007C0052C8FD85256D03.004E2CB385256D03@webforums...

Philip_Salgannik

unread,
Apr 9, 2003, 12:34:05 PM4/9/03
to
I'm still not clear on what the problem is with using the version of
OpenSheet that is documented in help?

Instead of:

>IF is_window[row] = 'w_post_gl' THEN
> OpenSheet(w_post_gl,w_brcf_frame, 0, layered!)
>ELSEIF ...
>
>END IF

You need this:

window w_toopen
OpenSheet(w_toopen, is_window[row], w_brcf_frame, 0, layered!)

If you have potential errors in the names contained in the file with window
names, then you can use FindClasssDefinition function for defensive
coding...

Rosalind

unread,
Apr 9, 2003, 1:38:12 PM4/9/03
to
Have you tried:

string ls_window = 'w_mywindow'

OpenSheet(ls_window,w_frame,0,layered!)

<Philip_Salgannik> wrote in message
news:E91345FC02D754BD005B02B385256D03.0059877285256D03@webforums...

Philip_Salgannik

unread,
Apr 9, 2003, 2:59:31 PM4/9/03
to
Why would I even bother, there is NO syntax like that for OpenSheet...

Rosalind

unread,
Apr 9, 2003, 3:23:00 PM4/9/03
to
I realize that. But that was my question. Is there any sort of work around
for PB to recognize a variable (most likely a string) as a classname. to use
in the OpenSheet function?

Round and round we go... :-)


<Philip_Salgannik> wrote in message
news:05636EB15AE6D6C40068538A85256D03.0067B76A85256D03@webforums...

Terry Voth

unread,
Apr 9, 2003, 3:37:27 PM4/9/03
to
The syntax is:

OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position
{, arrangeopen } } )

So, you'd need something like:

window lw_RefVar
OpenSheet (lw_RefVar, 'w_mywindow', w_frame, 0, layered!)

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten


Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a PowerBuilder Developer's Toolkit.
Version 2.2.05 now available at the Sandbox
See the new PB Troubleshooting Guide at the Sandbox
^ ^
o o
=*=

woz

unread,
Apr 9, 2003, 3:35:19 PM4/9/03
to
opensheetwithparm?

From the seldom seen help file:

Syntax

OpenSheetWithParm ( sheetrefvar, parameter {, windowtype }, mdiframe


{, position {, arrangeopen } } )

Argument Description


sheetrefvar The name of any window variable that is not an MDI frame window.
OpenSheet places a reference to the open sheet in sheetrefvar

parameter The parameter you want to store in the Message object when the sheet
is opened. Parameter must have one of these data types:· String· Numeric·
PowerObject
windowtype (optional) A string whose value is the data type of the window you


want to open. The data type of windowtype must be the same or a descendant of
sheetrefvar

mdiframe The name of the MDI frame window in which you want to open this sheet.
position (optional) The number of the menu item (in the menu associated with the
sheet) to which you want to append the names of the open sheets. Menu bar menu
items are numbered from the left, beginning with 1. The default is to list the
open sheets under the next-to-last menu item
arrangeopen (optional) A value of the ArrangeOpen enumerated data type
specifying how you want the sheets arranged in the MDI frame when they are
opened:· Cascaded! — (Default) Cascade the sheet relative to other open sheets
so that its title bar is below the previously opened sheet· Layered! — Layer the
sheet so that it fills the frame and covers previously opened sheets· Original!
— Open the sheet in its original size and cascade it

Philip_Salgannik

unread,
Apr 9, 2003, 4:32:10 PM4/9/03
to
Yes, there is and it is not a workaround, it is a way which was there as
long as OpenSheet command was there:

Instead of:
>IF is_window[row] = 'w_post_gl' THEN
> OpenSheet(w_post_gl,w_brcf_frame, 0, layered!)
>ELSEIF ...
>
>END IF

You need this:

window w_toopen
OpenSheet(w_toopen, is_window[row], w_brcf_frame, 0, layered!)

where is_window[row] is YOUR string variable containing the classname of
the window.

Norm Smith

unread,
Apr 10, 2003, 4:58:25 PM4/10/03
to
Rosalind,

I believe you can do what you're asking with some caveats.

Firstly the syntax is correct.
OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position {,
arrangeopen } } )

We use this in our app; but heres the caveat.

The sheetrefvar represents the parent window class.
windowtype is a string, but the window it references must be inherited from
sheetrefvar. Also sheetrefvar must be in a PBD, it cannot be in the EXE's
pbl.
If the window represented by the string is not in your applications Pbl
list, you can add it on the fly using GetApplication().SetLibraryList (
lv_library_list )

so...
string lv_my_window = "w_whatever" // w_whatever is inherited from
w_parent

OpenSheet ( w_parent, lv_my_window, w_frame )

We use this to open customer specific window without the need to include any
customer specific references in the base code, we just store the custom
window name (and PBL name) in the database and refer to that before opening
the window.

I hope this helps. If I've missed the point (happens a bit) I'm sorry
Norm


"Rosalind" <r...@brcf.org> wrote in message

news:u2Vs7F2$CHA.287@forums-1-dub...
> I guess that I never understood what the window type variable was. Thank
> you all.
>
>
> <Philip_Salgannik> wrote in message
> news:48DFFD519A033C930070CEFA85256D03.00703B0485256D03@webforums...

Rosalind

unread,
Apr 10, 2003, 9:00:07 AM4/10/03
to
I guess that I never understood what the window type variable was. Thank
you all.


<Philip_Salgannik> wrote in message
news:48DFFD519A033C930070CEFA85256D03.00703B0485256D03@webforums...

Terry Voth

unread,
Apr 11, 2003, 9:58:11 AM4/11/03
to
The part about needing to be in a PBD is inaccurate, but it brings up
a good point. If the window is referred to only as a string, the
"smart" compiler will not compile it into an EXE, because it can't see
a reference to it (it doesn't recognize strings as object references).
One work around is to compile the window's PBL into a PBD, which
forces all objects to be compiled into the PBD. A lot of people just
make PBDs out of every single PBL. If you want to have the object
compiled into an EXE, you need to make an explicit reference to it in
an object that you know will be compiled into the EXE. Personally, I
make a custom event (that is never called) in the application object
and either make a variable of that window type or an explicit Open ()
call to that window. The PBR Plus report in PBL Peeper (see below) is
designed to build a script like that which will force all of your
objects to be compiled into a single EXE.

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten

0 new messages