Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining WindowType

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
CA
Hello,

The process I am working on loops through an array of windows contained within a PBL. It passes the window name to a function to perform some more processing. If the windowtype is not MAIN! (ie. Child!, Response!) then I want to skip this window... HOW do I easily retrieve the Windowtype property of a Window? Do I have to open the window?

// NOTE: as_window is passed to this function as a string
// Open current window
// This does not work... If this is a Response window
// it waits for a "response" before going to the next
// statement which checks the window type. This window
// closes ... and windowtype property on the next statement
// cannot be determined?!
Open(lw_window, as_window)
if lw_window.WindowType <> Main! then
Close(lw_window)
Return -1
// Return of -1 means skip this window return -1
else
Close(lw_window)
if (as_window <> iw_frame.ClassName ()) then // ClassName returns name of window
openSheet (lw_window, as_window, iw_frame)
else
lw_window = iw_frame
end if
end if

Thanks,

Computergeek
 
"Easy" is a relative term, but the following example shows a way to get the windowtype without opening the window.

Code:
String               ls_pbls[]
Integer              li_var
ClassDefinition      lcd
VariableDefinition   lvd
WindowType           le_type

ls_pbls[1] = "<full path name of PBL containing the windows>"
// Searches for an object in one or more PowerBuilder PBL(s) and provides its class definition.
lcd = FindClassDefinition(as_window, ls_pbls)
IF IsNull(lcd) THEN
   RETURN -1   // Error - The window was not found.
END IF

// Search through the variable list in the class definition for the windowtype property.
li_var = UpperBound(lcd.VariableList)
DO WHILE li_var > 0
   IF lcd.VariableList[li_var].Name = "windowtype" THEN EXIT
   li_var --
LOOP
IF li_var = 0 THEN
   RETURN -1   // Error - as_window was not a window object.
END IF

le_type = lcd.VariableList[li_var].InitialValue
IF le_type <> Main! THEN
   RETURN -1   // Skip - The window is not a MAIN window.
ELSE
   // Perform whatever processing you want for a MAIN window.
END IF

Good Luck,

xsyguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top