Page 1 of 2

imagelist on tree

Posted: Fri Sep 27, 2024 10:37 am
by Silvio.Falconi
I made

oImageList = TImageList():New()

oBmp1 := TBitmap():Define( "open",, oDlg )
oBmp2 := TBitmap():Define( "close",, oDlg)


@ 5, 1 TREEVIEW oTree OF oDlg SIZE 80, 80 COLOR 0, GetSysColor( 15 )
oTree:SetImageList( oImageList )

Image

Why I not see the bmps ?

on resource

Code: Select all | Expand

open  BITMAP "open.bmp"
close BITMAP "arrow.bmp"




#ifndef __64__
   1 24 ".\winxp\WindowsXP.Manifest"
#endif
#ifdef __64__
   1 24 "WinXP/WindowsXP.Manifest64"
#endif

Re: imagelist on tree

Posted: Fri Sep 27, 2024 1:34 pm
by Jimmy
Silvio.Falconi wrote:Why I not see the bmps ?

on resource

Code: Select all | Expand

open  BITMAP "open.bmp"
close BITMAP "arrow.bmp"
 
try

Code: Select all | Expand

open  10 "open.BMP"
close 10 "arrow.BMP"

Re: imagelist on tree

Posted: Fri Sep 27, 2024 2:38 pm
by Silvio.Falconi
Jimmy wrote:
Silvio.Falconi wrote:Why I not see the bmps ?

on resource

Code: Select all | Expand

open  BITMAP "open.bmp"
close BITMAP "arrow.bmp"
 
try

Code: Select all | Expand

open  10 "open.BMP"
close 10 "arrow.BMP"
no "10" is for PNG file

Re: imagelist on tree

Posted: Fri Sep 27, 2024 2:53 pm
by karinha
Samples,

Code: Select all | Expand

elixir.prg
elixir.rc
 
Regards, saludos.

Re: imagelist on tree

Posted: Fri Sep 27, 2024 5:02 pm
by Jimmy
hi Silvio,
Silvio.Falconi wrote:
Jimmy wrote:
Silvio.Falconi wrote:Why I not see the bmps ?
on resource

Code: Select all | Expand

open  BITMAP "open.bmp"
close BITMAP "arrow.bmp"
 
try

Code: Select all | Expand

open  10 "open.BMP"
close 10 "arrow.BMP"
no "10" is for PNG file
WRONG :!:
10 mean RC_DATA and i use it for Bitmap which else are not shown.
try it

Re: imagelist on tree

Posted: Fri Sep 27, 2024 5:36 pm
by Silvio.Falconi
karinha wrote:Samples,

Code: Select all | Expand

elixir.prg
elixir.rc
 
Regards, saludos.
Please Master Guru Moderatore Kharina ,
avoid answering with meaningless sentences
I don't have time to waste on your Brazilian games

Re: imagelist on tree

Posted: Fri Sep 27, 2024 5:54 pm
by karinha
No comments,

Code: Select all | Expand

// C:\FWH\SAMPLES\ELIXIR.PRG

#include "FiveWin.ch"

STATIC oImageList

FUNCTION Main()

   LOCAL oDlg, oGet, cText := ""

   DEFINE DIALOG oDlg SIZE 900, 600

   @ 0, 100 GET oGet VAR cText MEMO SIZE 350, 300 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT BuildTree( oDlg, oGet )

   oImageList:End()

RETURN NIL

FUNCTION BuildTree( oDlg, oGet )

   LOCAL oTreeView := TTreeView():New( 0, 0, oDlg )
   LOCAL cPath := "c:\FWH1905\*", oItem

   oImageList := TImageList():New()

   oDlg:SetText( cPath )

   oTreeView:SetSize( 200, oDlg:nHeight - 30 )

   oTreeView:bChanged = {|| If( ( oItem := oTreeView:GetSelected() ) != nil, ;
      oGet:SetText( MemoRead( oItem:Cargo ) ), ) }

   oImageList:Add( TBitmap():Define( "folder",,  oDlg ), ;
      TBitmap():Define( "fldmask",, oDlg ) )

   oImageList:Add( TBitmap():Define( "prg",,  oDlg ), ;
      TBitmap():Define( "prgMask",,  oDlg ) )

   oTreeView:SetImageList( oImageList )

   ReadFiles( cPath, oTreeView )

RETURN NIL

FUNCTION ReadFiles( cPath, oTreeView )

   LOCAL aFiles := Directory( cPath, "D" )
   LOCAL oTreeItem, n

   FOR n = 1 TO Len( aFiles )
      IF aFiles[ n ][ 1 ] != "." .AND. aFiles[ n ][ 1 ] != ".."
         oTreeItem = oTreeView:Add( aFiles[ n ][ 1 ], If( aFiles[ n ][ 5 ] == "D", 0, 1 ) )
         IF aFiles[ n ][ 5 ] == "D"
            ReadFiles( SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ] + "\*", oTreeItem )
         ELSE
            oTreeItem:Cargo = SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ]
         ENDIF
      ENDIF
   NEXT

RETURN NIL

// FIN / END
Regards, saludos.

Re: imagelist on tree

Posted: Fri Sep 27, 2024 5:56 pm
by karinha
// C:\FWH\SAMPLES\ELIXIR.RC

Code: Select all | Expand

#ifndef __64__
  1 24 "WinXP/WindowsXP.Manifest" 
#endif

background BITMAP .\..\bitmaps\backgrnd\iosbg.bmp

New      BITMAP "../bitmaps/32x32/new.bmp"
New2     BITMAP "../bitmaps/16x16/new.bmp"
Dialog   BITMAP "../bitmaps/16x16/form.bmp"
DlgMask  BITMAP "../bitmaps/16x16/frmmask.bmp"
Open     BITMAP "../bitmaps/32x32/open.bmp"
Open2    BITMAP "../bitmaps/16x16/open.bmp"
Save     BITMAP "../bitmaps/32x32/floppy.bmp"
Run      BITMAP "../bitmaps/32x32/run.bmp"
Prg      BITMAP "../bitmaps/16x16/source.bmp"
PrgMask  BITMAP "../bitmaps/16x16/srcmask.bmp"
Exit2    BITMAP "../bitmaps/16x16/exit2.bmp"
includes BITMAP "../bitmaps/16x16/next.bmp"
bitmap   BITMAP "../bitmaps/16x16/bitmap.bmp"
bmpmask  BITMAP "../bitmaps/16x16/bmpmask.bmp"
icon     BITMAP "../bitmaps/16x16/icon.bmp"
icomask  BITMAP "../bitmaps/16x16/icomask.bmp"
folder   BITMAP "../bitmaps/16x16/folder.bmp"
fldmask  BITMAP "../bitmaps/16x16/fldmask.bmp"
 
Regards, saludos.

Re: imagelist on tree

Posted: Fri Sep 27, 2024 9:00 pm
by Silvio.Falconi
karinha wrote:// C:\FWH\SAMPLES\ELIXIR.RC

Code: Select all | Expand

#ifndef __64__
  1 24 "WinXP/WindowsXP.Manifest" 
#endif

background BITMAP .\..\bitmaps\backgrnd\iosbg.bmp

New      BITMAP "../bitmaps/32x32/new.bmp"
New2     BITMAP "../bitmaps/16x16/new.bmp"
Dialog   BITMAP "../bitmaps/16x16/form.bmp"
DlgMask  BITMAP "../bitmaps/16x16/frmmask.bmp"
Open     BITMAP "../bitmaps/32x32/open.bmp"
Open2    BITMAP "../bitmaps/16x16/open.bmp"
Save     BITMAP "../bitmaps/32x32/floppy.bmp"
Run      BITMAP "../bitmaps/32x32/run.bmp"
Prg      BITMAP "../bitmaps/16x16/source.bmp"
PrgMask  BITMAP "../bitmaps/16x16/srcmask.bmp"
Exit2    BITMAP "../bitmaps/16x16/exit2.bmp"
includes BITMAP "../bitmaps/16x16/next.bmp"
bitmap   BITMAP "../bitmaps/16x16/bitmap.bmp"
bmpmask  BITMAP "../bitmaps/16x16/bmpmask.bmp"
icon     BITMAP "../bitmaps/16x16/icon.bmp"
icomask  BITMAP "../bitmaps/16x16/icomask.bmp"
folder   BITMAP "../bitmaps/16x16/folder.bmp"
fldmask  BITMAP "../bitmaps/16x16/fldmask.bmp"
 
Regards, saludos.
Sorry but what i wrote ?
I compiled a fwh samples test and not run ok

given what happened in another topic avoid replying to my messages, I can not compare myself with you who are a master Guru Expert of fivewin

Re: imagelist on tree

Posted: Sat Sep 28, 2024 8:57 am
by richard-service
karinha wrote:No comments,

Code: Select all | Expand

// C:\FWH\SAMPLES\ELIXIR.PRG

#include "FiveWin.ch"

STATIC oImageList

FUNCTION Main()

   LOCAL oDlg, oGet, cText := ""

   DEFINE DIALOG oDlg SIZE 900, 600

   @ 0, 100 GET oGet VAR cText MEMO SIZE 350, 300 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT BuildTree( oDlg, oGet )

   oImageList:End()

RETURN NIL

FUNCTION BuildTree( oDlg, oGet )

   LOCAL oTreeView := TTreeView():New( 0, 0, oDlg )
   LOCAL cPath := "c:\FWH1905\*", oItem

   oImageList := TImageList():New()

   oDlg:SetText( cPath )

   oTreeView:SetSize( 200, oDlg:nHeight - 30 )

   oTreeView:bChanged = {|| If( ( oItem := oTreeView:GetSelected() ) != nil, ;
      oGet:SetText( MemoRead( oItem:Cargo ) ), ) }

   oImageList:Add( TBitmap():Define( "folder",,  oDlg ), ;
      TBitmap():Define( "fldmask",, oDlg ) )

   oImageList:Add( TBitmap():Define( "prg",,  oDlg ), ;
      TBitmap():Define( "prgMask",,  oDlg ) )

   oTreeView:SetImageList( oImageList )

   ReadFiles( cPath, oTreeView )

RETURN NIL

FUNCTION ReadFiles( cPath, oTreeView )

   LOCAL aFiles := Directory( cPath, "D" )
   LOCAL oTreeItem, n

   FOR n = 1 TO Len( aFiles )
      IF aFiles[ n ][ 1 ] != "." .AND. aFiles[ n ][ 1 ] != ".."
         oTreeItem = oTreeView:Add( aFiles[ n ][ 1 ], If( aFiles[ n ][ 5 ] == "D", 0, 1 ) )
         IF aFiles[ n ][ 5 ] == "D"
            ReadFiles( SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ] + "\*", oTreeItem )
         ELSE
            oTreeItem:Cargo = SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ]
         ENDIF
      ENDIF
   NEXT

RETURN NIL

// FIN / END
Regards, Saludos.
Dear Karinha,
I just to build it and not work. See picture.
Image

Re: imagelist on tree

Posted: Sat Sep 28, 2024 9:32 am
by alerchster
There must be an existing directory instead of c:\fwh1905\*

Code: Select all | Expand

LOCAL cPath := "c:\FWH1905\*", oItem

Re: imagelist on tree

Posted: Sat Sep 28, 2024 1:02 pm
by karinha
alerchster wrote:There must be an existing directory instead of c:\fwh1905\*

Code: Select all | Expand

LOCAL cPath := "c:\FWH1905\*", oItem
Very good Anton Lerchster, I thought no one would notice! hahaha, thanks. You are very intelligent.

Gracias, tks.

Regards, saludos.

Re: imagelist on tree

Posted: Sat Sep 28, 2024 3:15 pm
by karinha
More humanized version of ELIXIR.PRG

Versión más humanizada de ELIXIR.PRG

Code: Select all | Expand

// C:\FWH\SAMPLES\ELIXIR.PRG - NEW VRSION - 28/09/2024 - Mod: by Kapiaba.

#include "FiveWin.ch"

STATIC oImageList, cPath, lOk := .F., lExit := .F.

FUNCTION Main()

   LOCAL oDlg, oGet, cText := "", oFont, oFnt

   SkinButtons() // COLOR IN BUTTONS

   DEFINE FONT oFnt  NAME "Ms Sans Serif" SIZE 0,  14 BOLD
   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 1000, 800 FONT oFont

   oDlg:lHelpIcon := .F.
                                      // 350, 300
   @ 0, 100 GET oGet VAR cText MEMO SIZE 395, 350 PIXEL OF oDlg FONT oFont

   ACTIVATE DIALOG oDlg ; // CENTERED ;
      ON INIT Choice_Image( oDlg, oGet )

   // ON INIT BuildTree( oDlg, oGet ) // OLD Version.

   oFont:End()
   oFnt:End()

   lExit := .F.

   IF .NOT. EMPTY( oImageList )

      oImageList:End()

   ENDIF

RETURN NIL

FUNCTION Choice_Image( oDlg, oGet )

   LOCAL oDlgC, oDir, oOk, cDir := "C:\FWH1905" // Space( 256 ) -> A tu gusto!
   LOCAL oFont, oFnt, oExit, oSel

   DEFINE FONT oFnt  NAME "Ms Sans Serif" SIZE 0,  14 BOLD
   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -14 BOLD

   DEFINE DIALOG oDlgC SIZE 400, 200 PIXEL TRANSPARENT FONT oFont            ;
      TITLE "Choice Directory Of Images For Tree" COLOR CLR_BLACK, CLR_WHITE

   oDlgC:lHelpIcon := .F.

   @ 12, 5 SAY "Directory:" OF oDlgC SIZE 60, 12 PIXEL TRANSPARENT UPDATE    ;
      FONT oFont COLOR METRO_ORANGE, CLR_WHITE

   @ 10, 45 GET oDir VAR cDir OF oDlgC SIZE 100, 12 PIXEL UPDATE FONT oFont

   @ 38.50, 5 SAY "New Version: Choice Directory Of Images For Tree" OF oDlgC   ;
      SIZE 200, 12 PIXEL TRANSPARENT UPDATE FONT oFont                       ;
      COLOR METRO_CRIMSON, CLR_WHITE

   @ 10, 150 BUTTONBMP oSel PROMPT "&Sel" SIZE 35, 12 PIXEL OF oDlgC         ;
      BITMAP "..\bitmaps\16x16\floppy.bmp" TEXTRIGHT                         ;
      ACTION SelDir( oDlgC, oDir, @cDir )

   @ 60, 45 BUTTONBMP oOk PROMPT "&Ok" SIZE 50, 14 PIXEL OF oDlgC            ;
      BITMAP "..\bitmaps\16x16\open.bmp" TEXTRIGHT                           ;
      ACTION( BuildTree( oDlg, oGet, lExit := .T., oDlgc:End() ) ) WHEN( lOk )

   @ 60, 100 BUTTONBMP oExit PROMPT "&Exit" SIZE 50, 14 PIXEL OF oDlgC       ;
      BITMAP "..\bitmaps\16x16\Exit.bmp" TEXTRIGHT                           ;
      ACTION( lExit := .T., oDlgc:End(), __QUIT() ) CANCEL

   ACTIVATE DIALOG oDlgC CENTERED VALID( lExit )

   oFont:End()
   oFnt:End()

   lExit := .F.

RETURN NIL

FUNCTION SelDir( oDlgC, oDir, cDir )

   LOCAL cTitle  := "Choice Directory Of Images"
   LOCAL cInitDir := cDir
   LOCAL cTmpDir := AllTrim( cGetDir( cTitle, cInitDir ) )

   IF .NOT. EMPTY( cTmpDir )

      cDir  := cTmpDir

      cPath := cDir+"\*"  // aqui el truco.

      lOk   := .T. // Button "Ok" Action

      oDlgC:UpDate()

   ELSE

      MsgInfo( "CHOOSE A VALID DIRECTORY TO GET THE IMAGES FROM THE TREE.", ;
               "CHOOSE A VALID DIRECTORY TO GET THE IMAGES FROM THE TREE." )

   ENDIF

RETURN NIL

FUNCTION BuildTree( oDlg, oGet )

   LOCAL oTreeView := TTreeView():New( 0, 0, oDlg )
   // LOCAL cPath := "c:\FWH1905\*", oItem // OLD VERSION
   LOCAL oItem

   oImageList := TImageList():New()

   oDlg:SetText( cPath )

   oTreeView:SetSIZE( 200, oDlg:nHeight - 30 )

   oTreeView:bChanged = {|| If( ( oItem := oTreeView:GetSelected() ) != nil, ;
      oGet:SetText( MemoRead( oItem:Cargo ) ), ) }

   oImageList:Add( TBitmap():Define( "folder",,  oDlg ), ;
      TBitmap():Define( "fldmask",, oDlg ) )

   oImageList:Add( TBitmap():Define( "prg",,  oDlg ), ;
      TBitmap():Define( "prgMask",,  oDlg ) )

   oTreeView:SetImageList( oImageList )

   ReadFiles( cPath, oTreeView )

RETURN NIL

FUNCTION ReadFiles( cPath, oTreeView )

   LOCAL aFiles := Directory( cPath, "D" )
   LOCAL oTreeItem, n

   FOR n = 1 TO Len( aFiles )
      IF aFiles[ n ][ 1 ] != "." .AND. aFiles[ n ][ 1 ] != ".."
         oTreeItem = oTreeView:Add( aFiles[ n ][ 1 ], If( aFiles[ n ][ 5 ] == "D", 0, 1 ) )
         IF aFiles[ n ][ 5 ] == "D"
            ReadFiles( SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ] + "\*", oTreeItem )
         ELSE
            oTreeItem:Cargo = SubStr( cPath, 1, RAt( "\", cPath ) ) + aFiles[ n ][ 1 ]
         ENDIF
      ENDIF
   NEXT

RETURN NIL

// FIN / END - kapiabafwh@gmail.com
Regards, saludos.

Re: imagelist on tree

Posted: Sat Sep 28, 2024 4:24 pm
by richard-service
alerchster wrote:There must be an existing directory instead of c:\fwh1905\*

Code: Select all | Expand

LOCAL cPath := "c:\FWH1905\*", oItem
WoW... Old folder, so old sample file. Define Folder c:\harbour ...
Now, it's working.

Re: imagelist on tree

Posted: Mon Sep 30, 2024 6:25 am
by Silvio.Falconi
richard-service wrote:
alerchster wrote:There must be an existing directory instead of c:\fwh1905\*

Code: Select all | Expand

LOCAL cPath := "c:\FWH1905\*", oItem
WoW... Old folder, so old sample file. Define Folder c:\harbour ...
Now, it's working.
Jimmy wrote:hi Silvio,

10 mean RC_DATA and i use it for Bitmap which else are not shown.
try it
Friends,
Mr. Brazilian Moderator Guru Expert Kharina invents tests that I have not tried.....

I mean this sample :

the test

Code: Select all | Expand

#include "fivewin.ch"
#include "constant.ch"


Function test()
     local  oDlg,oBar,oBar2,oFont,oBold,oLbx
     local  nBottom   := 35
     local  nRight    := 90
     local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
     local  nHeight := nBottom * DLG_CHARPIX_H
     local cTitle:= "test"
     local oBtnConfirm,oBtnClose,oBtnAiuto
     local nClrText := CLR_BLACK

 DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 12
     DEFINE FONT oBold NAME "MS Sans Serif" SIZE 0, 12 BOLD


     DEFINE DIALOG  oDlg ;
      SIZE nWidth, nHeight  PIXEL  ;
      TITLE cTitle  RESIZABLE

  @ 100,10 BUTTON oBtnConfirm PROMPT "Conferma" of oDlg SIZE 45,15 DEFAULT ACTION (oDlg:end( IDOK  ) )
      @ 100,10 BUTTON oBtnClose PROMPT "Annulla" of oDlg  SIZE 45,15 CANCEL ACTION ( oDlg:end( IDCANCEL ) )
      @ 100,10 BUTTON oBtnAiuto PROMPT "Aiuto" of oDlg  SIZE 45,15 CANCEL ACTION NIL

      oDlg:bResized  := <||
             local oRect        := oDlg:GetCliRect()
                oBtnConfirm:nTop   := oRect:nBottom - 40
                oBtnConfirm:nLeft  := oRect:nRight - 310
                oBtnClose:nTop     := oRect:nBottom - 40
                oBtnClose:nLeft    := oRect:nRight - 210
                oBtnAiuto:nTop     := oRect:nBottom - 40
                oBtnAiuto:nLeft    := oRect:nRight - 110

        return nil
        >
ACTIVATE DIALOG oDlg CENTER;
   ON INIT  (AddItems( oBar2 ),eval(oDlg:bResized))
 oImageList:End()
RETURN NIL


 function AddItems(oBar2,oDlg )

   local oItem1, oItem2, oItem3,oItem4,oItem5
   local oImageList := TImageList():New()
   local oTree, oBmp1,oBmp2

      oBmp1 := TBitmap():Define( "open",, oBar2 )
      oBmp2 := TBitmap():Define( "close",, oBar2)


   @ 15, 1 TREEVIEW oTree OF oBar2 SIZE 190, 180
         oTree:SetImageList( oImageList )


   oItem1 = oTree:Add( "Estratti" )
   oItem1:Add( "Numeri dispari" )
   oItem1:Add( "Numeri Fibonacci" )
   oItem1:Add( "Numeri pari tutti" )
   oItem1:Add( "Numeri primi" )
   oItem1:Add( "Numeri tutti" )
   oItem2 = oTree:Add( "Ambi" )
   oItem2:Add( "Ambi al quadrato" )
   oItem2:Add( "World" )
   oItem3 = oTree:Add( "Terzine" )
   oItem3:Add( "Last" )
   oItem3:Add( "item" )
   oItem4 = oTree:Add( "Quartine" )
   oItem4:Add( "Last" )
   oItem4:Add( "item" )
return oTree


oBar 2 is another class I cannot publish it here but it is as a vertical status bar you can see on figure



rc file

Code: Select all | Expand

open  BITMAP "open.bmp"
close BITMAP "arrow.bmp"




#ifndef __64__
   1 24 ".\winxp\WindowsXP.Manifest"
#endif
#ifdef __64__
   1 24 "WinXP/WindowsXP.Manifest64"
#endif
 
I saw the same test on fwh\sample testtre2.prg anf I copied it

please don't listen and read what Kharina writes, we are tired of her meaningless messages and she often makes me waste time with his "not helping"