$PBExportHeader$u_base_container.sru $PBExportComments$Base Container Userobject forward global type u_base_container from u_base end type end forward global type u_base_container from u_base event resize pbm_size event ke_resize ( readonly long newwidth, readonly long newheight ) end type global u_base_container u_base_container type prototypes FUNCTION ulong SetParent(ulong hWndChild,ulong hWndNewParent) LIBRARY "user32.dll" end prototypes type variables Public: Boolean #ResizeObjects = TRUE Private: str_resize istr_controls[] long il_oldwidth, il_oldheight rect istr_workspace Boolean ib_suspend_sizing end variables forward prototypes public function rect of_getworkspace () public subroutine of_setworkspace (long al_x, long al_y, long al_w, long al_h) public subroutine of_resizeobjects (boolean ab_resize) public subroutine of_resizeobjects () public subroutine of_suspendresize () public subroutine of_resumeresize () public function integer of_getcontrolresizeattrib (string as_controlname, ref str_resize astr) public function integer of_getcontrolresizeattrib (windowobject awo, ref str_resize astr) public function integer of_setcontrolresizeattrib (string as_controlname, str_resize astr) public function integer of_setcontrolresizeattrib (windowobject awo, str_resize astr) public function integer of_openuserobject (ref dragobject apo, readonly string as_classname) public function integer of_openuserobject (ref dragobject apo) public function integer of_closeuserobject (readonly dragobject apo) public function boolean of_validaterequiredfields () end prototypes event resize;IF #ResizeObjects THEN //skip minimizing IF sizetype = 1 THEN RETURN EVENT ke_resize(width, height) END IF end event event ke_resize(readonly long newwidth, readonly long newheight);n_svc_mgr lnv_svcman n_svc_resize lnv_r //skip if resize is suspended IF ib_suspend_sizing THEN RETURN lnv_svcman.of_loadsvc(lnv_r, CSvc.RESIZE) //ensure values IF il_oldwidth = 0 THEN il_oldwidth = newwidth IF il_oldheight = 0 THEN il_oldheight = newheight //skip if zero width or height IF newwidth <= 0 OR newheight <= 0 THEN RETURN lnv_r.of_resize(this, CFbase.UOContainer, istr_controls, il_oldwidth, il_oldheight, newwidth, newheight) il_oldwidth = newwidth il_oldheight = newheight //set workspace istr_workspace.right = newwidth istr_workspace.bottom = newheight end event public function rect of_getworkspace ();RETURN istr_workspace end function public subroutine of_setworkspace (long al_x, long al_y, long al_w, long al_h);istr_workspace.left = al_x istr_workspace.top = al_y istr_workspace.right = al_w istr_workspace.bottom = al_h end subroutine public subroutine of_resizeobjects (boolean ab_resize);n_svc_mgr lnv_svcman n_svc_resize lnv_r #ResizeObjects = ab_resize lnv_svcman.of_loadsvc(lnv_r, CSvc.RESIZE) IF ab_resize THEN lnv_r.of_initresize(lnv_svcman, this, istr_controls) END IF this.TriggerEvent("resize") end subroutine public subroutine of_resizeobjects ();this.of_resizeobjects(FALSE) end subroutine public subroutine of_suspendresize ();IF #ResizeObjects THEN ib_suspend_sizing = TRUE end subroutine public subroutine of_resumeresize ();IF #ResizeObjects THEN ib_suspend_sizing = FALSE TriggerEvent("resize") END IF end subroutine public function integer of_getcontrolresizeattrib (string as_controlname, ref str_resize astr);long ll_count, n ll_count = UPPERBOUND(istr_controls) FOR n = 1 to ll_count IF lower(istr_controls[n].Controlname) = as_controlname THEN astr = istr_controls[n] RETURN n END IF NEXT RETURN CRet.FAILURE end function public function integer of_getcontrolresizeattrib (windowobject awo, ref str_resize astr);long ll_count, n ll_count = UPPERBOUND(istr_controls) FOR n = 1 to ll_count IF istr_controls[n].Control = awo THEN astr = istr_controls[n] RETURN n END IF NEXT RETURN CRet.FAILURE end function public function integer of_setcontrolresizeattrib (string as_controlname, str_resize astr);long ll_count, n ll_count = UPPERBOUND(istr_controls) FOR n = 1 to ll_count IF lower(istr_controls[n].Controlname) = as_controlname THEN istr_controls[n] = astr RETURN n END IF NEXT RETURN CRet.FAILURE end function public function integer of_setcontrolresizeattrib (windowobject awo, str_resize astr);long ll_count, n ll_count = UPPERBOUND(istr_controls) FOR n = 1 to ll_count IF istr_controls[n].Control = awo THEN istr_controls[n] = astr RETURN n END IF NEXT RETURN CRet.FAILURE end function public function integer of_openuserobject (ref dragobject apo, readonly string as_classname);n_svc_mgr lnv_svc n_svc_window lnv_win Window lw str_resize lstr any la IF ISVALID(apo) THEN RETURN CRet.FAILURE //check if such an object exists IF ISNULL(FindClassDefinition(as_classname)) THEN & RETURN CRet.FAILURE lnv_svc.of_LoadSvc(lnv_win, CSvc.WINDOW) lw = lnv_win.of_getparentwindow(this, TRUE) IF NOT ISVALID(lw) THEN RETURN CRet.FAILURE TRY IF as_classname = CString.EMPTY THEN lw.OpenUserObject(apo) ELSE lw.OpenUserObject(apo, as_classname) END IF apo.Visible = FALSE //set parent SetParent(Handle(apo), Handle(this)) //fire custom constructor la = apo.EVENT DYNAMIC ke_constructor() //add to control array lstr = apo.DYNAMIC of_getresizeattrib() istr_controls[UPPERBOUND(istr_controls) + 1] = lstr CATCH (runtimeerror ex) // MessageBox(this.Classname() + " - of_OpenUserObject()", ex.GetMessage(), StopSign!) RETURN CRet.FAILURE END TRY //apo.Visible = TRUE //lw.SetRedraw(TRUE) RETURN CRet.SUCCESS end function public function integer of_openuserobject (ref dragobject apo);RETURN of_OpenUserObject(apo, CString.EMPTY) end function public function integer of_closeuserobject (readonly dragobject apo);n_svc_mgr lnv_svc n_svc_window lnv_win Window lw IF NOT ISVALID(apo) THEN RETURN CRet.FAILURE lnv_svc.of_LoadSvc(lnv_win, CSvc.WINDOW) lw = lnv_win.of_getparentwindow(this, TRUE) IF NOT ISVALID(lw) THEN RETURN CRet.FAILURE apo.Visible = FALSE //set parent SetParent(Handle(apo), Handle(lw)) //remove from control array long n, ll_count, c str_resize lstr_new[] ll_count = UPPERBOUND(istr_controls) FOR n = 1 to ll_count IF istr_controls[n].control = apo THEN CONTINUE ELSE c ++ lstr_new[c] = istr_controls[n] END IF NEXT //re-assign istr_controls = lstr_new //close object lw.CloseUserObject(apo) RETURN CRet.SUCCESS end function public function boolean of_validaterequiredfields ();n_svc_mgr lnv_svc n_svc_requirededit lnv_r lnv_svc.of_LoadSvc(lnv_r, CSvc.REQUIRED_EDIT) RETURN lnv_r.of_ValidateRequiredFields(lnv_svc, this) end function on u_base_container.create call super::create end on on u_base_container.destroy call super::destroy end on event ke_postopen;call super::ke_postopen;of_resizeobjects(#resizeobjects) end event
- Sources
- Kodigo
- OpenExplorer
- u_base_container.sru
File: u_base_container.sru
Size: 7058
Date: Mon, 07 Apr 2008 21:30:54 +0200
Size: 7058
Date: Mon, 07 Apr 2008 21:30:54 +0200
- u_base u_base_container(sru)
- of_closeuserobject (readonly dragobject apo) returns integer
- of_getcontrolresizeattrib (string as_controlname, ref str_resize astr) returns integer
- of_getcontrolresizeattrib (windowobject awo, ref str_resize astr) returns integer
- of_getworkspace () returns rect
- of_openuserobject (ref dragobject apo) returns integer
- of_openuserobject (ref dragobject apo, readonly string as_classname) returns integer
- of_resizeobjects ()
- of_resizeobjects (boolean ab_resize)
- of_resumeresize ()
- of_setcontrolresizeattrib (string as_controlname, str_resize astr) returns integer
- of_setcontrolresizeattrib (windowobject awo, str_resize astr) returns integer
- of_setworkspace (long al_x, long al_y, long al_w, long al_h)
- of_suspendresize ()
- of_validaterequiredfields () returns boolean