FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Treeview with checkbox ?
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Treeview with checkbox ?
Posted: Fri May 18, 2007 04:27 PM
Hello,

How can we make a treeview with checkboxes in FWH so it looks something like this:


Patrick
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Treeview with checkbox ?
Posted: Fri May 18, 2007 04:58 PM

You have to modify the resource of the TREEVIEW control (RC or DLL)
checkboxes = Yes

Maurizio

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Treeview with checkbox ?
Posted: Fri May 18, 2007 10:47 PM

Patrick,

If you will send me your email address, I will send you some sample code that I got from somewhere. I haven't tried it myself.

It is several files in a zip file or I would just post it here.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Treeview with checkbox ?
Posted: Sat May 19, 2007 08:08 AM
James Bott wrote:If you will send me your email address, I will send you some sample code that I got from somewhere. I haven't tried it myself.
It is several files in a zip file or I would just post it here.
It's "patrick . mast @ winfakt . com"

Thank you James.

Patrick
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
Treeview with checkbox ?
Posted: Sat May 19, 2007 01:36 PM

James,

Could you please send this samples to me too?

jmurugosa@gmail.com

Thanks

Saludos/Regards,

Jos茅 Murugosa

"Los errores en programaci贸n, siempre est谩n entre la silla, el teclado y la IA!!"
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Treeview with checkbox ?
Posted: Sat May 19, 2007 07:26 PM
James Bott wrote:If you will send me your email address, I will send you some sample code that I got from somewhere. I haven't tried it myself.
It is several files in a zip file or I would just post it here.
Got the files. Thank you. But.. This is exactly how we did it for the printscreen I posted in this 1st message. But this is not NATIVE. It's tricking the class :-)
I was hoping we could do it natively with the standard FWH Tree class.

Antonio?

Patrick
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Sat May 19, 2007 10:43 PM
In the resources, this treeview style has to be used:
#define TVS_CHECKBOXES 0x0100

#include <windows.h>
#include <commctrl.h>
#include <hbapi.h>

HB_FUNC( TVSETCHECK )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   HTREEITEM hItem = ( HTREEITEM ) hb_parnl( 2 );

   TreeView_SetItemState( hWnd, hItem, hb_parl( 3 ) );
}
 
HB_FUNC( TVGETCHECK )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   HTREEITEM hItem = ( HTREEITEM ) hb_parnl( 2 );

   hb_retl( TreeView_GetCheckState( hWnd, hItem ) );
}

   METHOD GetCheck( oItem ) INLINE ; 
      If( oItem == nil, oItem := ::GetSelected(), nil ), ; 
      TVGetCheck( ::hWnd, oItem:hWnd )

   METHOD SetCheck( oItem, lOnOff ) INLINE ; 
      If( oItem == nil, oItem := ::GetSelected(), nil ), ; 
      TVSetCheck( ::hWnd, oItem:hWnd, lOnOff )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 115
Joined: Wed Oct 26, 2005 02:38 PM
Treeview with checkbox ?
Posted: Mon Jun 02, 2008 09:05 PM

Antonio, this is a solution that I already tried there is some time.
I just don t know only where you put the codes identified

Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Solu莽玫es em TI
http://www.maxxtech.com.br
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Mon Jun 02, 2008 09:27 PM

Christiano,

You have to include it in the Class TTreeView at source/classes/treeview.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Treeview with checkbox ?
Posted: Thu Oct 09, 2008 02:49 PM
Antonio,

A ver si me explico el problema que tengo (o quizas no sea problema y tenga que hacerlo por lineas de programas)
Tengo un Tree con 3 ramas y cada rama con items, cada item tiene un checkbox, cuando selecciono en el item de la rama los item de esa rama no se seleccionan. porque?

Gracias.

Antonio Linares wrote:Christiano,

You have to include it in the Class TTreeView at source/classes/treeview.prg
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Thu Oct 09, 2008 06:32 PM

Gustavo,

Por favor proporciona un peque帽o ejemplo PRG autocontenido para probarlo aqui, gracias

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Treeview with checkbox ?
Posted: Thu Oct 09, 2008 11:03 PM
Antonio Linares wrote:Gustavo,

Por favor proporciona un peque帽o ejemplo PRG autocontenido para probarlo aqui, gracias



METHOD pantalla() CLASS TABMUSUARIOS
   LOCAL oDlg,;
         oTree,;
         oFolder,;
         oDatos  := Array(3),;
         vDatos  := Array(3),;
         oTextos := Array(4),;
         oBtns   := Array(2)

   ::oQuery:= ::oConexion:query(::cQuery)

   DEFINE DIALOG oDlg resource "DLG_USUARIOS"

      //----------( Botones principales )----------

      REDEFINE BUTTON oBtns[1] ID 204 OF oDlg
      REDEFINE BUTTON oBtns[2] ID 205 OF oDlg

      //----------( Folder )----------

      REDEFINE FOLDER oFolder ID 4002 OF oDlg ;
         PROMPT "Datos", "Permisos", "Llave";
         DIALOGS "DLG_TAB1", "DLG_TAB2", "DLG_TAB3"

      oFolder:aEnable := {.T., .T., .T.}

      //----------( Tree )----------

      oTree:= TTreeView():REDEFINE(206, oFolder:aDialogs[2])

      //----------( Acci贸n botones )----------

      oBtns[2]:bAction:={|| oDlg:END() }

   ACTIVATE DIALOG oDlg CENTERED ON INIT (definirTree(oTree))

   msgstop( oTree:IsChecked( 1 ) )

   RETURN (NIL)

//------------------------------------------------------------------------------

FUNCTION definirTree(oTree)

   LOCAL oMenu    := array(3), ;
         oSubMenu := array(10)

   oMenu[1]:= oTree:ADD("Principal")
      oSubMenu[1]:= oMenu[1]:ADD("Imprimir...")

   oMenu[2]:= oTree:ADD("Proyectos")
      oSubMenu[6]:= oMenu[2]:ADD("Definir Proyectos")
      oSubmenu[7]:= oMenu[2]:ADD("Actualizaci贸n datos")

   oTree:expand()

   RETURN (NIL)
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Treeview with checkbox ?
Posted: Wed Oct 15, 2008 03:22 AM
Patrick,

Can you send me your example dialog + tree + checkbox.

Tank麓s

Patrick Mast wrote:Hello,

How can we make a treeview with checkboxes in FWH so it looks something like this:


Patrick
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 07:31 AM
Gustavo,

test.prg
#include "FiveWin.ch"

function Main()

   local oDlg, oTree 

   DEFINE DIALOG oDlg

   @ 0, 0 TREEVIEW oTree OF oDlg SIZE 200, 200 CHECKBOXES

   ACTIVATE DIALOG oDlg CENTERED ON INIT definirTree( oTree ) 

   MsgInfo( oTree:GetCheck( oTree:aItems[ 1 ] ) ) 

return nil 

function definirTree(oTree) 

   local oMenu    := array(3), ; 
         oSubMenu := array(10) 

   oMenu[1]:= oTree:Add( "Principal" ) 
      oSubMenu[1]:= oMenu[1]:Add( "Imprimir..." ) 

   oMenu[2]:= oTree:Add( "Proyectos" ) 
      oSubMenu[6]:= oMenu[2]:Add( "Definir Proyectos" ) 
      oSubmenu[7]:= oMenu[2]:Add( "Actualizaci贸n datos" ) 

   oTree:expand() 

return nil

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Treeview with checkbox ?
Posted: Wed Oct 15, 2008 07:55 AM

Hi Antonio,

Should it be changed any class to run this example. I have compiled it and there is not any checkbox.

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06