Welcome, Guest
Username: Password: Remember me
Qui si parla italiano
  • Page:
  • 1
  • 2

TOPIC:

VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 21 Dec 2021 08:53 #20842

  • claudiocarletta
  • claudiocarletta's Avatar
  • Topic Author


  • Posts: 94
  • Salve a tutti,
    in una DATAWINDOW di un'applicazione MDI ho delle DATALISTVIEW, alcuni campi, che soddisfano a certe condizioni, forrei che venissero evidenziati modificando il colore del testo e/o del background.
    Se è possibile, qualcuno può suggerirmi una soluzione?

    Questo è quello che vorrei ottenere (modificato con Paint)
    Anche qualcosa di analogo.
    Grazie a tutti
    Attachments:

    Please Log in or Create an account to join the conversation.

    Last edit: by claudiocarletta.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 21 Dec 2021 08:59 #20843

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3367
  • Ciao Claudio,
    questo funziona solo con OwnerDraw, e purtroppo non ti posso dare del codice in quanto la base del mio codice è stata comprata tanti anni fa, e perciò il copyright non è mio.
    Prova qui: groups.google.com/g/comp.lang.clipper.vi...listview%20ownerdraw
    Dovresti trovare qualcosa.
    Saluti
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 21 Dec 2021 15:09 #20850

    • ic2
    • ic2's Avatar


  • Posts: 1667
  • Hello Claudio,

    It is not what you want to hear I think, but you do realize that you can do this all perfectly with bBrowser?

    Most VO users bought bBrowser, it is inexpensive, well supported and versatile and it is also available for X# when you want to convert some day. It will take you a maybe day to setup a general structure (many of us are willing to share some common code) and then it's maybe from about 30 minutes to replace each old listview/browser.

    Dick

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 21 Dec 2021 16:01 #20851

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Claudio,

    There´s no need to use the ownerdraw mode. The advantage of the customdraw mode over the ownerdraw mode is that you don´t have to draw *all* columns yourself. In your case the only column that must be painted manually seems to be the third column. Note: Zero based, that´s the second column !

    To make the VO-DataLIstview class work:

    1. Themes must be enabled !
    2. In the CustomDraw() callback there are two places marked with
    "<-----"
    , where you must modify the current conditons.
    METHOD CustomDraw ( lParam ) CLASS ListVIewData // VO Callback   
    LOCAL pNMCustomDraw AS _winNMLVCUSTOMDRAW
    LOCAL dwDrawStage, dwCurrentTextCOlor AS DWORD 
    LOCAL iRetValue AS INT 
    LOCAL hDC, ptrSubItemValue AS PTR  
    LOCAL struRectText IS _winRECT
    
    
     
    	iRetValue := CDRF_DODEFAULT 
    	
      
    
    	pNMCustomDraw := PTR( _CAST , lParam )
            
    	dwDrawStage := pNMCustomDraw.nmcd.dwDrawStage 
    	
     
    	// --------------
    	
    
    	DO CASE 
    	CASE dwDrawStage == CDDS_PREPAINT    
    
    		iRetValue := CDRF_NOTIFYITEMDRAW
    				
    		
    	CASE dwDrawStage == CDDS_ITEMPREPAINT  
    		
    		iRetValue := CDRF_NOTIFYSUBITEMDRAW
    				
    	 
    	CASE dwDrawStage == _OR  ( CDDS_ITEMPREPAINT | CDDS_SUBITEM  )  
    		
    		// we want to draw only one specific column.
    		// All other columns are still drawn by the system ! 
    		  
    		// --------------------
    		
    		// note: The subitem ( column) number is zero based !  
    		// LOoking at your posted image it´s about the third column. But zero based, that´s the second  column ! 
    		
    		IF pNMCustomDraw.iSubItem  == 2   // <-------  
    			
    			// -----------------
    			
    			ptrSubItemValue := MemAlloc(255 )
    						
    			ListView_GetItemText( SELF:Handle() , pNMCustomDraw.nmcd.dwItemSpec   , pNMCustomDraw.iSubItem  , ptrSubItemValue , 255 )
    			 
     			// --------------------
     			                      
    			IF Val ( Psz2String ( ptrSubItemValue ) ) <= 765  // <----- the red color threshold !  
    								
    				hDC  := pNMCustomDraw.nmcd.hDC
    				 
    				CopyRect ( @struRectText , @pNMCustomDraw.nmcd.rc ) 
    				
    				// --------------
    				
    				FillRect ( hDC  , @struRectText ,  _oBkgBrush:Handle() )
    				
    				dwCurrentTextCOlor := SetTextColor ( hDC , _oTxtCOlor:COlorref )
    				
    				struRectText.right -= 6
    				
                DrawText (  hDC , ptrSubItemValue , -1 ,  @struRectText ,_OR ( DT_SINGLELINE , DT_RIGHT , DT_VCENTER )  )
                
        			SetTextColor ( hDC , dwCurrentTextCOlor )             
    
    				// ----------------
    				
    				iRetValue := CDRF_SKIPDEFAULT 
    				
    			ENDIF
    			
    			
    			MemFree ( ptrSubItemValue ) 
    			
    			
    		ENDIF	
    			
    
       ENDCASE
       
        
    	RETURN iRetValue 
    	
    
    METHOD Init(oOwner, xID, oPoint, oDimension, kStyle) CLASS ListVIewData
    
    	SUPER:Init(oOwner, xID, oPoint, oDimension, kStyle)  
    	
    	_oBkgBrush := Brush { Color { COLORRED } }  
    	_oTxtColor := Color { COLORWHITE }   	
    	
    
    	RETURN SELF 
                                                
    CLASS ListVIewData INHERIT DataListView 
    
    PROTECT _oBkgBrush AS Brush  
    PROTECT _oTxtColor AS COlor  
    btw. Doing the same with bBrowser is just a "ColorCondition" one liner ...

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 22 Dec 2021 19:48 #20859

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Hi Claudio,

    I have improved the CustomDraw() method. For example, you'll now see the three dots when the column is not wide enough to display the complete text.
    METHOD CustomDraw ( lParam ) CLASS ListVIewData // VO Callback   
    LOCAL pNMCustomDraw AS _winNMLVCUSTOMDRAW
    LOCAL dwDrawStage, dwCurrentTextColor, dwTextStyle, dwItemState AS DWORD 
    LOCAL iRetValue AS INT 
    LOCAL hDC, ptrSubItemValue AS PTR  
    LOCAL struRectText IS _winRECT 
    LOCAL lFocused, lDisabled AS LOGIC
    
     
    	iRetValue := CDRF_DODEFAULT 
    	
      
    
    	pNMCustomDraw := PTR( _CAST , lParam )
            
    	dwDrawStage := pNMCustomDraw.nmcd.dwDrawStage
    	
    	dwItemState := pNMCustomDraw.nmcd.uItemState 
    
    	lFocused := _AND ( dwItemState  , CDIS_FOCUS ) == CDIS_FOCUS 
    		
    	lDisabled := _AND ( GetWindowLong ( SELF:Handle() , GWL_STYLE ), WS_DISABLED ) == WS_DISABLED  
    		
     
    	// --------------
    	
    
    	DO CASE 
    	CASE dwDrawStage == CDDS_PREPAINT    
    
    		iRetValue := CDRF_NOTIFYITEMDRAW
    				
    		
    	CASE dwDrawStage == CDDS_ITEMPREPAINT  
    		
    		iRetValue := CDRF_NOTIFYSUBITEMDRAW
    				
    	 
    	CASE dwDrawStage == _OR  ( CDDS_ITEMPREPAINT | CDDS_SUBITEM  )  
    		
    		// we want to draw only one specific column.
    		// All other columns are still drawn by the system ! 
    		  
    		// --------------------
    		
    		// note: The subitem ( column) number is zero based !  
    		// LOoking at your posted image it´s about the third column. But zero based, that´s the second  column !
    		 
    		
    		IF pNMCustomDraw.iSubItem  == 1   // <-------  
    			
    			// -----------------
    			
    			ptrSubItemValue := MemAlloc(255 )
    						
    			ListView_GetItemText( SELF:Handle() , pNMCustomDraw.nmcd.dwItemSpec   , pNMCustomDraw.iSubItem  , ptrSubItemValue , 255 )
    			 
     			// --------------------  
     			 
     			
    			hDC  := pNMCustomDraw.nmcd.hDC
    				 
    			CopyRect ( @struRectText , @pNMCustomDraw.nmcd.rc ) 
     			
     			dwTextStyle := _OR ( DT_SINGLELINE , DT_RIGHT , DT_VCENTER , DT_END_ELLIPSIS ) 
     			
     			dwCurrentTextColor := GetTextColor ( hDC ) 
     			
    			
     			// --------------------
     			  
    
    			IF Val ( Psz2String ( ptrSubItemValue ) ) > 765   // <----- the red color threshold !  
    				
    				FillRect ( hDC  , @struRectText ,  _oBkgBrush:Handle() )
    				
    				SetTextColor ( hDC , _oTxtCOlor:COlorref ) 
    				
    			ELSE  
    				 
                
    				DO CASE
    					
    	  			CASE lDisabled
       				
    						FillRect ( hDC , @struRectText ,  GetSysColorBrush ( COLOR_BTNFACE ) ) 
       	
     						SetTextColor ( hDC , GetSysColor ( COLOR_WINDOWTEXT ) )  
    									 
    				
       			CASE lFocused
       				
    						FillRect ( hDC , @struRectText ,  GetSysColorBrush ( COLOR_HIGHLIGHT ) ) 
       	
     						SetTextColor ( hDC , GetSysColor ( COLOR_HIGHLIGHTTEXT ) )  
    					
    						DrawFocusRect (hDC , @struRectText)
    					
    				
       			OTHERWISE
       				
    						FillRect ( hDC , @struRectText ,  GetSysColorBrush ( COLOR_WINDOW ) )  
    					
    						SetTextColor ( hDC , GetSysColor ( COLOR_WINDOWTEXT ) )  
       				
    				ENDCASE
       			
    	
    			ENDIF 
    			
    			
     			// --------------------
    			
    			struRectText.right -= 6   
    			
    			DrawText (  hDC , ptrSubItemValue , -1 ,  @struRectText ,dwTextStyle  )  
    			
    			SetTextColor ( hDC , dwCurrentTextColor ) 
     
    			MemFree ( ptrSubItemValue ) 
       
     			// --------------------
       
    		
    			iRetValue := CDRF_SKIPDEFAULT 
    			
    			
    		ENDIF	
    			
    
       ENDCASE
       
        
    	RETURN iRetValue 

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 22 Dec 2021 20:57 #20860

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Grazie mille
    ... e buone feste

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 02 Jan 2022 11:53 #20961

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Salve a tutti e buon anno,
    ho comprato le librerie bBrowser (bBrw4_PE_v4.4.197) per risolvere definitivamente il problema dei campi colorati in una DATALISTVIEW e spero molto altro ancora, ma io uso il linguaggio VO e Visual Studio 2019 come IDE.
    Dovo trovo un po' di documentazione per utilizzare efficacemente queste librerie con programmi in VO e ide Visual Studio?

    Grazie a tutti e buon anno

    Please Log in or Create an account to join the conversation.

    Last edit: by claudiocarletta.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 02 Jan 2022 17:29 #20964

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3367
  • Ciao Claudio,
    uso il bBrowser da anni in VO e devo dire che è molto potente.
    Come sorgente di dati è da usare sempre un DataServer, sia DBServer o ArrayServer, e per quanto riguarda esempi dovresti trovarne parecchi nella distribuzione.
    Non so comunque se questi esempi sono stati portati in X#, perchè tutti scritti in VO.
    Magari si potrebbe fare qualcosa, ma purtroppo sono in ferie e lontano dalla mia macchina di sviluppo.
    Saluti
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 02 Jan 2022 17:44 #20965

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Ciao Wolfgang,
    tanti anni fa quando avevo VO5 l'ho utilizzavo anchio. Adesso non ho VO come programma e IDE ma uso come IDE il Visual Studio 2019 e X# come compilatore.
    Per creare le DLL credo di aver capito come fare ma non capisco come includere il controllo bBrowser nell'Editor delle maschere?
    Nel caso ci si risente quando torni dalle ferie.
    Buone vacanze

    ciao
    Claudio

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 02 Jan 2022 18:20 #20966

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • Claudio,

    As in VO, in order to put bBrowser in the toolbox (for the VO-style windows only, as bBrowser is not available for windows forms or WPF), you need to have it defined in cavowed.inf.

    You can find such a file in the bBrowser samples and must put it inside the solution folder, then VS will automatically find it and show the control when editing VO windows.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 09:46 #20975

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Ciao Chris,
    Grazie per i tuoi suggerimenti ma credo che le mie competenze siano troppo scadenti per poter risolvere il problema.
    Sul file bBrowser.chm l'unica pagina che si riferisce al problema nell'Help è questa


    eseguendo il programma suggerito


    si ha:

    Attachment not found



    qui non so quale percorso inserire

    Attachment not found



    e la combobox successiva è vuota, e non posso selezionare nulla

    Attachment not found



    Ho trovato il file che mi hai suggerito, ho capito che dovrei operare su di esso: cavowed.inf ma non so cosa aggiungere a questo file di configurazione e come fare.
    Se potessi darmi qualche altro suggerimento ...

    Ciao Claudio

    Please Log in or Create an account to join the conversation.

    Last edit: by robert.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 10:14 #20977

    • diobrando
    • diobrando's Avatar


  • Posts: 37
  • Buongiorno Claudio ,

    perdonami la domanda forse banale ma hai acquistato la versione bBrowser per VO oppure la versione bBrowser per X#?
    Se fosse vero il primo caso non le puoi usare con Visual Studio 20219 e X#.

    maggiori informazioni qui
    www.bbrowser.net/index.php/en/

    Ciao
    Stefano

    Please Log in or Create an account to join the conversation.

    Last edit: by diobrando.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 10:41 #20978

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Ciao Stefano,
    ho acquistato questa versione: bBrowser 4 (Visual Objects Edition) Versione 4.4.197


    Programmando in VO ma con l'IDE di Visual Studio 2019 quale avrei dovuto acquistare?

    Grazie
    Claudio
    Attachments:

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 12:07 #20979

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • Qui sembra esserci un malinteso: Non vedo come VO possa essere collegato all'IDE VS.
    Potete usare X# in VS, programmare nel dialetto VO e usare le classi VO. Ma per questo avresti dovuto comprare la versione X# del browser. Parla con Joachim, sono sicuro che questo può essere corretto.
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 12:46 #20980

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Purtroppo non so chi sia Joachim

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 12:48 #20981

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • scusate - Joachim Bieler, l'autore di bBrowser
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 12:51 #20982

    • diobrando
    • diobrando's Avatar


  • Posts: 37
  • Ciao Claudio,
    come ti ha già risposto Karl, la versione che hai acquistato tu la puoi usare esclusivamente con VO.
    Avresti dovuto prendere quella per X#.
    contatta Joachim Bieler, è l'autore del bBrowser.

    In English:
    for anyone that is reading this, Claudio purchased the wrong version of bBrowser (the VO version) but he is using VS2019 + X# (VO dialect).
    He needs to contact Joachim Bieler to find a solution

    Please Log in or Create an account to join the conversation.

    Last edit: by diobrando.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 17:36 #20986

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • Guys,

    I have sent an email to Joachim about this, if he's not on vacation right now, I think he can help.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 19:06 #20993

    • claudiocarletta
    • claudiocarletta's Avatar
    • Topic Author


  • Posts: 94
  • Grazie Chris,
    io ho già chiesto al mio rivenditore la sua fattura di acquisto.
    La mia scuola non poteva acquistare direttamente su internet e mi sono affidato ad un negozio di Hardware & Software per l'acquisto.
    Speriamo che non perda questi soldi

    Ciao Claudio

    Please Log in or Create an account to join the conversation.

    VO: Colorare testo e/o background di alcuni campi e/o righe di una DATALISTVIEW 03 Jan 2022 19:39 #20994

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • Hi Claudio,

    I think Joachim is on the road at the moment, so it will probably take him a couple days to respond. I also hope you will find a solution!

    ciao!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    • 2
    Moderators: wriedmann