From: Amilcar A. Camargo on 5 Oct 2009 06:45 Hi Phil, On 5 Oct 2009 09:59:30 GMT, "Phil Mermod" <pmermod(a)REMOVEpkl.ch> wrote: >Hi Amilcar, > >Thanks for sharing your code. I have the following behavior >using Windows Vista Pro Sp2 with Windows Vista theme (Aero mode) >: > >I enter the path in the sle then press Tab : in the end of the >sle, there is still a part of the text selected (blue) !?!? If I >move the cursor upon the sle, it disappears.... I've seen that. Add a 'FocusChange(oEvent)' method to your class and force a repaint when going out: IF !oEvent:GotFocus InvalidateRect( SELF:Handle(), NULL_PTR, TRUE ) ENDIF RETURN SUPER:FocusChange( oEvent ) and see if this solves the problem. Some events are not working the same on your machine. Best regards, Amilcar A. Camargo F. Guatemala, C. A.
From: Phil Mermod on 5 Oct 2009 07:19 Thanks ! It works now ! -- Phil Mermod Crystal Reports Library for Visual Objects http://www.pkl.ch/dev/ Amilcar A. Camargo wrote: > IF !oEvent:GotFocus > InvalidateRect( SELF:Handle(), NULL_PTR, TRUE ) > ENDIF > RETURN SUPER:FocusChange( oEvent )
From: Geoff Schaller on 11 Oct 2009 09:39 Guys. It is much, much easier than this. 5 lines of code at most. Attached is the FixedText class from the SDK with the 5 added lines of code. This one works in all focus situations, with or without themes, as long as the flag lUseDrawtext is set. Below is the URL for a sample dialog. Compile and run and stretch/compress the right edge of the dialog to see the effect. It could also be extended to an SLE but you would need to store the original value and adjust the uValue on Lost Focus. Copy the same display logic but be careful not to alter the uValue without storing its original. Your dispatch will need to ignore the process if in focus but do it if not. http://www.softwareobjectives.com.au/Downloads/VO/Basicdlg.zip This is NOT good for an SLE. In fact it would confuse users because it would display different things at different times. It is very good for a FT. I used the FT here because it is easier to demonstrate. Cheers, Geoff "Amilcar A. Camargo" <amilcarcamargo(a)gmail.com> wrote in message news:nee2c5diuavljrrru8ooe2e8lappgseibq(a)4ax.com: > Hi Everybody, > > Some weeks ago there was a thread about using PathCompactPath to show > 'compacted' paths in SLE. Today i share with all of you my class that allows to > edit the full text but, once entered, shows it in a 'compacted' way so the user > can understand what's inside. > > [BEGIN PASTE] > > CLASS SlePath INHERIT SingleLineEdit > // shows 'compacted' paths > // > // Author.......: Amilcar Camargo > // Date.........: 15-Jul-2007 > > METHOD Dispatch( oEv ) CLASS SIAAPSlePath > // Event handler, overrides where necessary > // > LOCAL uMsg := oEv:Message AS LONG > LOCAL wParam := oEv:wParam AS DWORD > LOCAL lParam := oEv:lParam AS LONG > > DO CASE > CASE uMsg == WM_PAINT > IF GetFocus() <> SELF:Handle() > SELF:ExposeEx( oEv ) > RETURN 0L > ENDIF > > CASE uMsg == WM_ERASEBKGND > IF SELF:PaintBackground( PTR( _CAST, wParam ) ) > SELF:EventReturnValue := 1L > RETURN 1L > ENDIF > > ENDCASE > > RETURN SUPER:Dispatch( oEv ) > > METHOD ExposeEx( uEvent ) CLASS SIAAPSlePath > // Paints out compacted path > // > LOCAL sPStru IS _winPAINTSTRUCT > LOCAL hDC AS PTR > LOCAL hWnd AS PTR > LOCAL iLen AS LONG > LOCAL iSaveDC AS INT > LOCAL pText AS PTR > LOCAL hFont AS PTR > LOCAL dwColor AS DWORD > LOCAL sRect IS _winRECT > > hWnd := SELF:Handle() > > // Check if there is a need to repaint > IF GetUpdateRect( hWnd, NULL_PTR, FALSE ) > > hDC := BeginPaint( hWnd, @sPStru ) > IF hDC <> NULL_PTR > > // save dc status > iSaveDC := SaveDC( hWnd ) > > // our area > GetClientRect( hWnd, @sRect ) > > // Erase background > IF sPStru.fErase > SendMessage( hWnd, WM_ERASEBKGND, DWORD( _CAST,hDC ), 0L ) > ENDIF > > // Is there something to display > iLen := SendMessage( hWnd, WM_GETTEXTLENGTH, 0, 0L ) > IF iLen > 0 > pText := MemAlloc( MAX_PATH ) > IF pText <> NULL_PTR > // Get foreground color > IF SELF:TextColor <> NULL_OBJECT > dwColor := SELF:TextColor:ColorRef > ELSE > dwColor := GetSysColor( COLOR_WINDOWTEXT ) > ENDIF > > // Get text font > // Use <oFont> to avoid creating a default font > IF SELF:oFont <> NULL_OBJECT > hFont := SELF:oFont:Handle() > ELSE > hFont := GetStockObject( DEFAULT_GUI_FONT ) > ENDIF > > MemClear( pText, MAX_PATH ) > SendMessage( hWnd, ; > WM_GETTEXT, ; > MAX_PATH, ; > LONG(_CAST, ; > pText ) ) > SetTextColor( hDC, dwColor ) > SelectObject( hDC, hFont ) > PathCompactPath( hDC, pText, sRect.right - sRect.left - 2 ) > TextOut( hDC, 0, 1, pText, LONG( _CAST, PszLen( pText ) ) ) > MemFree( pText ) > ENDIF > ENDIF > > // Restore DC > RestoreDC( hWnd, iSaveDC ) > > ENDIF > > // close painting cicle > EndPaint( hWnd, @sPStru ) > SELF:EventReturnValue := 1L > ENDIF > > RETURN NIL > > METHOD PaintBackground( uDC ) CLASS SIAAPSlePath > // Background erase > // > LOCAL lRet AS LOGIC > LOCAL hDC AS PTR > LOCAL sRect IS _winRECT > LOCAL hBrush AS PTR > > lRet := TRUE > hDC := uDC > GetClientRect( SELF:Handle(), @sRect ) > > IF SELF:oControlBackground <> NULL_OBJECT > hBrush := SELF:oControlBackground:Handle() > ELSE > hBrush := PTR( _CAST, COLOR_WINDOW + 1 ) > ENDIF > FillRect( hDC, @sRect, hBrush ) > > RETURN lRet > > > [END PASTE] > > Hope this is of help to somebody. > > Best regards, > Amilcar A. Camargo F. > Guatemala, C. A.
First
|
Prev
|
Pages: 1 2 3 Prev: ODBC drivers Next: Visual Objects 2.8 Service Pack 3 released today Sept. 30, 2009 |