DCTREEVIEW

This forum is for eXpress++ general support.
Post Reply
Message
Author
Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

DCTREEVIEW

#1 Post by Wolfgang Ciriack »

Hello,
has someone an example for subclassing a DCTreeRoot and DCTreeItem ?
I would like to have other fonts for subitems and/or additional icons in a item.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCTREEVIEW

#2 Post by rdonnay »

Wolfgang -

I don't know why you would need to subclass to support additional icons. Look at this sample program from XDEMO.EXE (Sample Group 3).

Code: Select all

FUNCTION XSample_93()

/*
This example shows how to use the DCTREEROOT and DCTREEITEM
commands to build a tree menu system.
*/

LOCAL GetList := {}, oMenu, oFileMenu, oPrintMenu, oEditMenu, ;
      cDocument := Space(60), cMemo := '', oMemo, oStatic1,  ;
      oStatic2, oMsgBox, cSaveDir := DC_CurPath(), ;
      lDocLoaded := .f., lDocSaved := .f.

@ 1,4 DCSAY '--- MAIN MENU ---      ' FONT '12.Arial Bold'

@ 2,1 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 25,11 OBJECT oStatic1 ;
  FONT '10.Arial Bold'

@ 0,0 DCTREEROOT SIZE 25,11 OBJECT oMenu ;
  HASLINES HASBUTTONS PARENT oStatic1 ;
  ALWAYSSHOWSELECTION ;
  TOOLTIP 'Double-Click a main-menu item to expand/collapse sub-menu;' + ;
          'Double-Click a sub-menu item to select' ;
  EVAL {|o|o:keyboard := {|a,b,o|_TreeKeyboard(a,b,o,GetList)} }

DCTREEITEM CAPTION 'File' PARENT oMenu OBJECT oFileMenu ;
     MESSAGE 'These are File Options' INTO oMsgBox ;
     IMAGENORMAL ICON_CLOSEDFOLDER ;
     IMAGEMARKED ICON_CLOSEDFOLDER ;
     IMAGEEXPANDED ICON_OPENFOLDER

  DCTREEITEM CAPTION 'Load a Document' PARENT oFileMenu ;
     ACTION {||lDocLoaded := .t., lDocSaved := .f., ;
               _XSample_93(1,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will load a text file into the document Window' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON ;
     IMAGECHECKED ICON_CHECKED ;
     CHECKWHEN {||lDocLoaded} ;

  DCTREEITEM CAPTION 'Save Document' PARENT oFileMenu ;
     ACTION {||lDocSaved := .t., lDocLoaded := .f., ;
               _XSample_93(2,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will save the document in the Window to the text file' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON ;
     IMAGECHECKED ICON_CHECKED ;
     CHECKWHEN {||lDocSaved} ;

DCTREEITEM CAPTION 'Print' PARENT oMenu OBJECT oPrintMenu ;
     MESSAGE 'These are Printing Options' INTO oMsgBox

  DCTREEITEM CAPTION 'Preview File' PARENT oPrintMenu ;
     ACTION {||_XSample_93(3,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will display a text file in a Preview Window' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON ;
     IMAGECHECKED ICON_QUESTION ;

  DCTREEITEM CAPTION 'Print File' PARENT oPrintMenu ;
     ACTION {||_XSample_93(4,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will Print a text file' INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON ;
     IMAGECHECKED ICON_QUESTION

DCTREEITEM CAPTION 'Edit' PARENT oMenu OBJECT oEditMenu ;
     MESSAGE 'These are Editing Options' INTO oMsgBox

  DCTREEITEM CAPTION 'Edit Document' PARENT oEditMenu ;
     ACTION {||_XSample_93(5,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will allow a loaded document to be edited' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON

  DCTREEITEM CAPTION 'Check Spelling' PARENT oEditMenu ;
     ACTION {||_XSample_93(6,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will check spelling (only if you have sufficient funds)' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON

  DCTREEITEM CAPTION 'Clean Slate' PARENT oEditMenu ;
     ACTION {||_XSample_93(7,oMemo,@cDocument,@cMemo,GetList)} ;
     MESSAGE 'This will clear the document editor window' ;
       INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON

DCTREEITEM CAPTION 'Exit Program' PARENT oMenu ;
   ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
   MESSAGE 'This will exit the program' INTO oMsgBox ;
     IMAGENORMAL ICON_PUSHBUTTON ;
     IMAGEMARKED ICON_PUSHBUTTON ;
     IMAGEEXPANDED ICON_PUSHBUTTON

@ 1,32 DCMULTILINE cMemo SIZE 60,12 OBJECT oMemo READONLY ;
  MESSAGE 'Edit your text in this Window' INTO oMsgBox

@ 14,1 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 90,1.2 ;
   OBJECT oStatic2

@ .1,2 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 87,1 PARENT oStatic2 ;
   OBJECT oMsgBox FONT '12.Courier New Bold'

DCREAD GUI FIT ADDBUTTONS MODAL ;
   TITLE 'Tree View Menu Sample' ;
   SETAPPWINDOW ;
   EVAL {|o|SetAppFocus(oMenu)}

DC_ChDir(cSaveDir)

RETURN nil

* ----------------------

STATIC FUNCTION _XSample_93( nMode, oMemo, cDocument, cMemo, aGetList )

LOCAL oDirs, oFiles, cDirectory, lOk, GetList := {}, oFileName

IF nMode = 1 // Open file
  @ 5,2 DCSAY 'Enter name of file to Edit'
  @ 6,2 DCGET cDocument GETSIZE 53 GETOBJECT oFileName
  @ 7.5,2 DCDIRTREE ;
      DIRS oDirs VAR cDirectory ;
      FILES oFiles VAR cDocument ;
      DATALINK {||oFileName:SetData(), DC_GetRefresh(GetList)} ;
      SIZE 50,6 ;
      EXT '*.*','*.TXT','*.DOC'
  DCREAD GUI FIT ADDBUTTONS TO lOk MODAL
  IF lOk
    cMemo := MemoRead(cDocument)
    oMemo:setData()
  ENDIF
ELSEIF nMode = 2  // Save file
  cMemo := oMemo:GetData()
  MemoWrit(cDocument,cMemo)
ELSEIF nMode = 3  // Preview file
  DC_PrintFile(cDocument,.t.)
ELSEIF nMode = 4  // Print file
  DC_PrintFile(cDocument,.f.)
ELSEIF nMode = 5  // edit
  oMemo:setEditable(.t.)
  SetAppFocus(oMemo)
ELSEIF nMode = 6 // check spelling
  DC_Winalert('Please deposit $1,000,000 to start spell check')
ELSEIF nMode = 7
  cMemo := ''
  oMemo:setData()
ENDIF
DC_GetRefresh(aGetList)
RETURN nil
*** END OF EXAMPLE ***
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCTREEVIEW

#3 Post by Wolfgang Ciriack »

Hello Roger,
i know this sample, but i like to have another check symbol at the and of an item text.
But more important is another font size or font Attribute (bold, italic) for subitems.
So i thougt i could manipulate the drawing method of the cell like it is done with the ownerdraw feature of browses.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCTREEVIEW

#4 Post by rdonnay »

So i thougt i could manipulate the drawing method of the cell like it is done with the ownerdraw feature of browses.
XbpTreeView does not support owner drawing. It would actually be possible to create a custom Treeview system using the ownerdrawing capabilities of DCBROWSE, but this would be a project.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCTREEVIEW

#5 Post by Wolfgang Ciriack »

Oh, thanks, so i must use it how it is :(
_______________________
Best Regards
Wolfgang

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCTREEVIEW

#6 Post by Auge_Ohr »

rdonnay wrote:XbpTreeView does not support owner drawing.
but it should while every Windows Common Control does have Ownerdraw / Customdraw.

here Sample CLASS CustomTree FROM XbpTreeView using ot4xb using Customdraw.
Attachments
SubclassXbpTreeView.zip
need ot4xb
(183.14 KiB) Downloaded 738 times
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCTREEVIEW

#7 Post by rdonnay »

but it should while every Windows Common Control does have Ownerdraw / Customdraw
I don't support solutions that require libraries other than eXpress++ and Xbase++.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCTREEVIEW

#8 Post by Auge_Ohr »

rdonnay wrote:
but it should while every Windows Common Control does have Ownerdraw / Customdraw
I don't support solutions that require libraries other than eXpress++ and Xbase++.
what about native Windows Controls ? ( DXE Lib written in Xbase++ with ot4xb )

i did see that your DC_XbpPushButton() can have Multi-Line.
you have used Windows Constante BS_MULTILINE to "manipulate" GWL_STYLE of XbpPushButton().

CLASS CustomTree FROM XbpTreeView is doing the same ... with higher Level.
it is just a Sample how XbParts can be enhance "full Power" while Xbase++ does not give use "all" what the normal Windows Control can do.
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCTREEVIEW

#9 Post by rdonnay »

Code: Select all

i did see that your DC_XbpPushButton() can have Multi-Line. 
you have used Windows Constante BS_MULTILINE to "manipulate" GWL_STYLE of XbpPushButton().
Everything I write is 100% Xbase++ code.
eXpress++ customers prefer it that way. That's why they like eXpress++ because it is simple to understand the code. I looked at your sample program. It would require a lot of new learning. I don't have time for that. I have gone down this road before and was sorry for it. It is too much work to try to support another third-party library. Nobody would pay me to do this and I cannot afford to work on it for free.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCTREEVIEW

#10 Post by Auge_Ohr »

rdonnay wrote:I looked at your sample program. It would require a lot of new learning.
the Sample is from Pablo and i agree it looks very "dangerous" ... it just show what is possible with Xbase++ using ot4xb ( instead of BAP )

when writing native Controls for DXE Lib ***, to get rid of XbParts which need ActiveX, i try to use same Xbase++ Syntax and how OOP Design use Class Code. you just have to add a #xtranslate into existing Code to use new Benefits.

Code: Select all

#xtranslate XbpTreeView           => DXE_TreeView
#xtranslate XbpTreeViewItem       => DXE_TreeViewItem
my DXE_Treeview use NM_CUSTOMDRAW Notify Event for (real) Customdraw like this.
DXE_Tree.jpg
DXE_Tree.jpg (46.21 KiB) Viewed 14751 times
Tree_ZebraStyle.jpg
Tree_ZebraStyle.jpg (152.87 KiB) Viewed 14751 times
*** see User Contributions http://bb.donnay-software.com/donnay/vi ... f=7&t=1583
greetings by OHR
Jimmy

Post Reply