Code: Alles auswählen
METHOD XbpDialogEx:LBDown(aPos)
IF ::ishold
::CaptureMouse(.T.)
::isMove :=.T.
::mPos := GetCurAbsPos(aPos)
//
// sonst zur "SuperClass" leiten !!!
//
ELSE
::XbpDialog:LBDown(aPos)
ENDIF
RETURN Self
so das ist die Lösung des Problems.
Ich hab ja eine eigene Class von XbpDialog erstellt. Wenn ich nun also
"vererbte" Methoden "überschreibe" muss ich im ELSE zur "SuperClass"
umleiten.
Code: Alles auswählen
METHOD XbpDialogEx:show()
...
IF myShow
...
ELSE
::XbpDialog:show()
ENDIF
also auch das Problem "gelöst" nun sind es "nur" noch 2 ...
1.) "Focus" Problem : ich komme jetzt auch wieder an den "close" Button
ran ... ABER wenn ich nun auf meinen "bunten Titelbar" clicke um z.B.
das "Fenster" zu moven (was jetzt geht), dann kan ich "danach" nicht
mehr an den "sichtbaren close" button. Unter XP "sieht" man sogar noch
das der "close" Button die "hover" Farbe aktiviert aber es passiert nichts
wenn ich auf das "X" clicke.
2.) wenn ich "minimieren" und dann wieder auf "normal" bin ist nur
noch ein "schwarzer" Balken statt Titlebar vorhanden
da ich aber auch mit "::TitleON" zur Laufzeit den "Titlebar" ein/aus-
schalten kann müssten die Bitmap Objekte "eigendlich" zur Laufzeit
"vorhanden" sein ...oder werden die "irgendwie" evtl. auf Size = {0,0}
gesetzt so das ich die nicht mehr "sehen" kann ?
gruss by OHR
Jimmy
Code: Alles auswählen
CLASS XbpDialogEx FROM XbpDialog
...
METHOD XbpDialogEx:AddBitmap( cCaption )
LOCAL aPos := ::SetBMPPos( 1 )
LOCAL aItemSize := { ::currentsize()[1] + ::nYTitlebarheight - ::nXOffset -( (LEN( ::aDlg4Buttons )+1)*(::nYTitlebarheight ) ) , ::nYTitlebarheight }
LOCAL oDlg, oBitmap, nBGClr
LOCAL oButton, oTEXT
LOCAL aPres := {{ XBP_PP_FGCLR, GRA_CLR_BLACK },;
{ XBP_PP_BGCLR, XBPSYSCLR_TRANSPARENT },;
{ XBP_PP_COMPOUNDNAME , FONT_DEFPROP_SMALL+FONT_STYLE_BOLD }}
LOCAL aTest := {{ XBP_PP_FGCLR, GRA_CLR_BLACK },;
{ XBP_PP_BGCLR, GRA_CLR_RED },;
{ XBP_PP_COMPOUNDNAME , FONT_DEFPROP_SMALL+FONT_STYLE_BOLD }}
LOCAL hWndDlg := 0
IF PCOUNT() > 0
::TText := cCaption
ENDIF
#IFDEF TESTI
oBitmap := XbpBitmap():New():Create()
#ELSE
oBitmap := ExXbpBitmap():New():Create()
#ENDIF
IF FILE("TITLE.BMP")
oBitmap:LoadFile("TITLE.BMP")
ELSE
oBitmap:load( , 4000 )
ENDIF
nBGClr := oBitmap:getDefaultBgColor()
oBitmap:transparentClr := nBGClr
::Setparent():SetColorBG( nBGClr )
::SetColorBG( nBGClr )
// the dialog created without border, titlebar or anything.
oDlg := XbpDialog():new( AppDesktop(), self, aPos, aItemSize, aTest, .F. )
oDlg:movewithOwner := .T.
oDlg:Border := XBPDLG_NO_BORDER
oDlg:Titlebar := .F.
oDlg:minButton := .F.
oDlg:maxButton := .F.
oDlg:create()
hWndDlg:= oDlg:GetHWND()
oButton := XbpPushButton():new( oDlg:drawingarea,,{ 0, 0},;
oDlg:CurrentSize() )
oButton:autosize := .F.
oButton:PointerFocus := .F.
oButton:activate := {|| ;
IF(::getFrameState() = XBPDLG_FRAMESTAT_NORMALIZED ,;
IF(::maxButton,::XbpDialog:setFrameState(XBPDLG_FRAMESTAT_MAXIMIZED),NIL) ,;
::XbpDialog:setFrameState(XBPDLG_FRAMESTAT_NORMALIZED) ), ::myRefresh(.T.) }
* oButton := XbpStatic():new( oDlg:drawingarea , , { 0, 0}, oDlg:CurrentSize())
* oButton:type := XBPSTATIC_TYPE_BITMAP
oButton:caption := BMP2BMP(oBitmap,oDlg:CurrentSize())
oButton:clipSiblings := .T.
oButton:Create()
oTEXT := XbpStatic():new( oButton , , { 4, 0}, oDlg:CurrentSize(), aPres)
oTEXT:type := XBPSTATIC_TYPE_TEXT
oTEXT:options := XBPSTATIC_TEXT_LEFT + XBPSTATIC_TEXT_VCENTER
oTEXT:caption := ::TText
oTEXT:lbdblclick := {|| PostAppEvent(xbeP_Activate,,,oButton)}
oTEXT:lbDown := {|x,y,o| ::ishold := .T., ::lbdown(x,y)}
oTEXT:motion := {|x,y,o| ::motion(x,y)}
oTEXT:lbUp := {|x,y,o| ::lbUp (x,y), ::ishold := .F.}
oTEXT:Create()
// add the dialog to the array that stores each user defined
// button of the titlebar.
AAdd( ::aoBitmap, oDlg )
RETURN( self )
METHOD XbpDialogEx:myRefresh(lvalue)
IF PCOUNT() > 0
::TitleON := lvalue
ENDIF
::hide()
::show()
RETURN Self
METHOD XbpDialogEx:hide()
LOCAL i,iMax := LEN(::aDlg4Buttons)
LOCAL j,nLen
LOCAL aZeroSize := {0,0}
::nLastSize := ::currentsize()
::aoBitmap[1]:DrawingArea:Childlist()[1]:hide()
::aoBitmap[1]:hide()
FOR i = 1 TO iMax
::aDlg4Buttons[i]:hide()
nLen := LEN(::aDlg4Buttons[i]:Childlist() )
j := 0
FOR j = 1 TO nLen
::aDlg4Buttons[i]:Childlist()[j]:hide()
NEXT
NEXT
* ::XbpDialog:setsize(aZeroSize)
::XbpDialog:hide()
::XbpDialog:toBack()
RETURN Self
METHOD XbpDialogEx:show()
LOCAL i,iMax := LEN(::aDlg4Buttons)
LOCAL j,nLen
LOCAL aMainSize := ::nLastSize
LOCAL aTitleSize
LOCAL aChildSize
IF aMainSize <> NIL
* ::XbpDialog:setsize(aMainSize)
ENDIF
::XbpDialog:toFront()
::XbpDialog:show()
IF ::TitleON .AND. LEN(::aoBitmap) > 0
aTitleSize := ::aoBitmap[1]:currentSize()
aChildSize := { ::currentsize()[1] + ::nYTitlebarheight - ::nXOffset ;
-( (LEN( ::aDlg4Buttons )+1)*(::nYTitlebarheight ) ) ,;
::nYTitlebarheight }
IF aMainSize <> NIL
//
// if "maximize" or "minimize" while :hide
//
IF aTitleSize[1] > aMainSize[1]
::Resize( aTitleSize, aMainSize )
ELSEIF aTitleSize[1] < aChildSize[1]
::Resize( aTitleSize, aMainSize )
ENDIF
ENDIF
::aoBitmap[1]:Show()
::aoBitmap[1]:invalidateRect()
::aoBitmap[1]:DrawingArea:Childlist()[1]:Show()
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:invalidateRect()
FOR i = 1 TO iMax
::aDlg4Buttons[i]:Show()
nLen := LEN(::aDlg4Buttons[i]:Childlist() )
j := 0
FOR j = 1 TO nLen
::aDlg4Buttons[i]:Childlist()[j]:Show()
NEXT
NEXT
ENDIF
RETURN Self
METHOD XbpDialogEx:Resize( aOldSize, aNewSize )
LOCAL i, iMax
LOCAL oButton, aNewPos
LOCAL aChildSize,oBitmap
IF aOldSize[1] == 0 .AND. aOldSize[2] == 0 // New line
aOldSize := aNewSize // New line
ELSEIF aNewSize[1] == 0 .OR. aNewSize[2] == 0 // New line
RETURN // New line
// add "same Size", nothing had happend
ELSEIF aNewSize[1] == aOldSize[1] .AND. aNewSize[2] == aOldSize[2]
RETURN
ENDIF // New line
::XbpDialog:resize( aOldSize, aNewSize )
IF ::TitleON .AND. LEN(::aoBitmap) > 0
iMax := LEN( ::aDlg4Buttons )
IF ( ::minButton .AND. ::maxButton )
IF IsThemeActive(.T.)
::nXOffset := 97
ELSE
::nXOffset := 94
ENDIF
ELSEIF ( ::maxButton .AND. .NOT. ::minButton )
IF IsThemeActive(.T.)
::nXOffset := 96/4*3
ELSE
::nXOffset := 96/4*3
ENDIF
ELSEIF (::minButton .AND. .NOT. ::maxButton )
IF IsThemeActive(.T.)
::nXOffset := 97
ELSE
::nXOffset := 94
ENDIF
ELSEIF (.NOT. ::minButton .AND. .NOT. ::maxButton )
IF IsThemeActive(.T.)
#IFDEF TESTI
::nXOffset := 96/4*2
#ELSE
::nXOffset := (96/4*1)+3
#ENDIF
ELSE
::nXOffset := 96/4*2
ENDIF
ENDIF
aChildSize := { ::currentsize()[1] + ::nYTitlebarheight - ::nXOffset ;
-( (LEN( ::aDlg4Buttons )+1)*(::nYTitlebarheight ) ) ,;
::nYTitlebarheight }
::aoBitmap[1]:setPosAndSize( ::SetBMPPos(1), aChildSize )
::aoBitmap[1]:DrawingArea:Childlist()[1]:setSize( aChildSize )
IF ::isvisible()
::aoBitmap[1]:Show()
ELSE
::aoBitmap[1]:hide()
ENDIF
oBitmap := ::aoBitmap[1]:DrawingArea:Childlist()[1]:caption
oBitmap := BMP2BMP( oBitmap,aChildSize)
::aoBitmap[1]:DrawingArea:Childlist()[1]:setcaption(oBitmap)
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:setSize( {aChildSize[1]-::IconSize,aChildSize[2]} )
IF ::isvisible()
::aoBitmap[1]:DrawingArea:Childlist()[1]:Show()
ELSE
::aoBitmap[1]:DrawingArea:Childlist()[1]:hide()
ENDIF
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:setcaption(::title)
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:invalidateRect()
IF ::isvisible()
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:Show()
ELSE
::aoBitmap[1]:DrawingArea:Childlist()[1]:Childlist()[1]:hide()
ENDIF
FOR i := 1 TO iMax
oButton := ::aDlg4Buttons[i]:drawingArea:childList()[1]
aNewPos := ::SetRelPos( i )
::aDlg4Buttons[i]:setPos( aNewPos )
IF ::isvisible()
::aDlg4Buttons[i]:Show()
ELSE
::aDlg4Buttons[i]:hide()
ENDIF
NEXT
ENDIF
RETURN( self )
gruss by OHR
Jimmy