Change Treeview bitmap at runtime

Post Reply
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Change Treeview bitmap at runtime

Post by Maurilio Viana »

Hi!

I'm trying to implement a control access menu based in SysTreeView32.
I want to check/uncheck menu items that the user can or not access.

Code: Select all

{-}--Menu 1 
 |     |---[ ] Menu 1.1 
 |     |---[x] Menu 1.2 
 |     +---[ ] Menu 1.3 
 |
{-}--Menu 2 
       |---[x] Menu 2.1 
       +---[x] Menu 2.2 
Using TreeView I did any like this and I will use a bitmap to checked and other to unchecked state.

1. How can I change bitmap when we click over?
2. How can I know if a item is checked or not to save the results in a database?

Best regards,
Maurilio[/img]
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Although not as fancy, a browse would be much easier to program.

James
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Change Treeview bitmap at runtime

Post by Enrico Maria Giordano »

Maurilio Viana wrote:1. How can I change bitmap when we click over?
Try to change the image in the oImageList and then use SetImageList() method.
Maurilio Viana wrote:2. How can I know if a item is checked or not to save the results in a database?
Store the info in an array or a database and toggle it when you click on a tree item.

EMG
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Post by Maurizio »

Maurilio

From the oImageList


IF oItem:nImage = 1
oItem:Set( ,2)
oItem:nImage := 2
ELSE
oItem:Set( ,1)
oItem:nImage := 1
ENDIF

Regards Maurizio
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá Maurilio beleza :D

O que você precisa seia algo como a imagem abaixo ?

Image

Abraços,

Rossine.
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

Rossine wrote: O que você precisa seia algo como a imagem abaixo ?
Isso mesmo, Rossine!

[ ]'s
Maurilio
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá Maurilio,

Se eu não estou enganado eu peguei este exemplo aqui mesmo :lol:

http://geocities.yahoo.com.br/qiinforma ... 0/tree.zip

Este exemplo tem vários recursos:

- Mudar a cor do fundo
- Mudar o label das opções ( Basta clicar duas vezes emcima delas)
- Opção para acionar um calendário
- Mudar o bitmap ao clicar duas vezes, etc...

Espero que te ajude :wink:

Abraços,

Rossine.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

where is the ch files ?
---------------
Best Regards, Saludos

Falconi Silvio
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

Rossine wrote: Se eu não estou enganado eu peguei este exemplo aqui mesmo :lol:
http://geocities.yahoo.com.br/qiinforma ... 0/tree.zip
Obrigado, Rossine!
Vou testar. Eu estava apanhando, pois eu estava tentando montar como um browse e estava horrivel, o treeview tem opcao de esconder os sub-itens...

[ ]'s
Maurilio
Post Reply