Treeview with checkbox ?

Treeview with checkbox ?

Postby Patrick Mast » Fri May 18, 2007 4:27 pm

Hello,

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

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Maurizio » Fri May 18, 2007 4:58 pm

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

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Patrick Mast » Sat May 19, 2007 8: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby jose_murugosa » Sat May 19, 2007 1: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 y el teclado y la IA!!"
User avatar
jose_murugosa
 
Posts: 1180
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Postby Patrick Mast » Sat May 19, 2007 7: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Sat May 19, 2007 10:43 pm

In the resources, this treeview style has to be used:
#define TVS_CHECKBOXES 0x0100

Code: Select all  Expand view
#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 ) );
}

Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ctoas » Mon Jun 02, 2008 9: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
User avatar
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Postby Antonio Linares » Mon Jun 02, 2008 9:27 pm

Christiano,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby goosfancito » Thu Oct 09, 2008 2: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/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Postby Antonio Linares » Thu Oct 09, 2008 6:32 pm

Gustavo,

Por favor proporciona un pequeño ejemplo PRG autocontenido para probarlo aqui, gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby goosfancito » Thu Oct 09, 2008 11:03 pm

Antonio Linares wrote:Gustavo,

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



Code: Select all  Expand view
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/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Treeview with checkbox ?

Postby goosfancito » Wed Oct 15, 2008 3: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:
Image

Patrick
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Postby Antonio Linares » Wed Oct 15, 2008 7:31 am

Gustavo,

test.prg
Code: Select all  Expand view
#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

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Horizon » Wed Oct 15, 2008 7: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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests