>#Define TRUE .T. >#Define FALSE .F. > >#Define CON_PEMSTAT_DEFINED 5 > >#Define CON_TABOR_TOP 0 >#Define CON_TABOR_BOTTOM 1 >#Define CON_TABOR_LEFT 2 >#Define CON_TABOR_RIGHT 3 > > >******************************************************************************** >Function ctlObjToClient(m.poControl As Control, m.pcValueToReturn As String) >******************************************************************************** >*!* pcValueToReturn can be: T, B, L, R for Top, Bottom, Left, Right >*!* This replaces OBJTOCLIENT that has bugs with pageframes >******************************************************************************** > > Local m.lnPosition As Integer > > m.pcValueToReturn = Upper(m.pcValueToReturn) > m.lnPosition = 0 > > Do Case > > Case m.pcValueToReturn $ "TB" >*!* 20070711 Modified to account for toolbars > Do While Inlist(Upper(m.poControl.BaseClass), "FORM", "TOOLBAR") = FALSE > If Pemstatus(m.poControl, "Top", CON_PEMSTAT_DEFINED) Then > m.lnPosition = m.lnPosition + m.poControl.Top > Endif > If Upper(m.poControl.BaseClass) == "PAGE" Then > If m.poControl.Parent.TabOrientation = CON_TABOR_TOP Then && Top > m.lnPosition = m.lnPosition + ; > m.poControl.Parent.Height - ; > m.poControl.Parent.PageHeight - ; > m.poControl.Parent.BorderWidth * 2 > Else > m.lnPosition = m.lnPosition + 1 > Endif > Endif > m.poControl = m.poControl.Parent > Enddo > > If m.pcValueToReturn == "B" Then > m.lnPosition = m.lnPosition + This.Height > Endif > > Case m.pcValueToReturn $ "LR" >*!* 20070711 Modified to account for toolbars > Do While Inlist(Upper(m.poControl.BaseClass), "FORM", "TOOLBAR") = FALSE > If Pemstatus(m.poControl, "Left", CON_PEMSTAT_DEFINED) Then > m.lnPosition = m.lnPosition + m.poControl.Left > Endif > If Upper(m.poControl.BaseClass) == "PAGE" > If m.poControl.Parent.TabOrientation = CON_TABOR_LEFT Then && Left > m.lnPosition = m.lnPosition + ; > m.poControl.Parent.Width - ; > m.poControl.Parent.PageWidth - ; > m.poControl.Parent.BorderWidth * 2 > Else > m.lnPosition = m.lnPosition + 1 > Endif > Endif > m.poControl = m.poControl.Parent > Enddo > > If m.pcValueToReturn == "R" Then > m.lnPosition = m.lnPosition + This.Width > Endif > > Endcase > > Return m.lnPosition >Endfunc >>