PhabLookupWidget

PhabLookupWidget — searches a widget hierarchy for a named widget.

Syntax

PhabLookupWidget (hierarchy, name, prefix)

		

Arguments

hierarchy

A widget hierarchy, such as created by PhabCreateWidgets.

name

The name of an instance of the widget you are looking up, expressed as a symbol.

prefix

The widget name prefix, such as passed in a call to PhabCreateWidgets, or nil for none.

Returns

The requested widget, or nil on failure.

Description

This function searches a widget hierarchy for a widget, based on the name of an instance. The name must be entered as a symbol, not as a string. If any prefix is passed, it will be prepended to the name.

To use this function, you must load the PhabTemplate.lsp library with a call to require_lisp("PhabTemplate.lsp").

Example

This example, ex_PhabLookupWidget.g, is included in the product distribution.

The following code:

#!/usr/cogent/bin/phgamma 

PtInit(nil);
require_lisp("PhabTemplate.lsp");

file = PhabReadWidgetFile(string(_os_, "-WidgetFiles/wgt/loadwindow.wgtw"));
win = PhabCreateWidgets(file,nil,nil);

lookup = PhabLookupWidget(win, #MainPane, nil);
pretty_princ("Looked up and found:\n", lookup,"\n");


Generates the following output:

Looked up and found:
{PtPane (_callbacks) (_exceptions) (anchor_flags . 0x40000f00)
	(anchor_offsets . {PhRect (lr . {PhPoint (x . 0) (y . 0)})
			   (ul . {PhPoint (x . 0) (y . 0)})})
	(area . {PhArea (pos . {PhPoint (x . 59) (y . 45)})
		 (size . {PhDim (h . 225) (w . 281)})}) (basic_flags . 0x0)
	(border_width . 1) (bot_border_color . 0x606060) (color . 0x0)
	(container_flags . 0x404010) (cursor_color . 0xffffe0) (cursor_type . 0)
	(dim . {PhDim (h . 225) (w . 281)}) (eflags . 0xffff8001)
	(fill_color . 0xffdebd) (fill_pattern . ) (flags . 0x520) (focus)
	(help_topic) (highlight_roundness . 0) (margin_height . 0)
	(margin_width . 0) (name . MainPane) (pane_flags . 0x3b58c689)
	(pos . {PhPoint (x . 59) (y . 45)}) (resize_flags . 0x0) (rid . 0)
	(top_border_color . 0xffffff) (trans_pattern . ) (user_data)}

See Also

PhabReadWidgetFile, PhabReadWidget