Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Small Upp gems. Native icons in TreeCtrl
Small Upp gems. Native icons in TreeCtrl [message #18448] Wed, 01 October 2008 18:33 Go to previous message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Dear all

When I want a new possibility from Upp, it is Upp the main source of solutions. One example: Sample TreeCtrl looks not very good as the icons are too simple, but with a little change you get fine native icons (see "Before" and "After").

index.php?t=getfile&id=1406&private=0

How to do it?. Very simple. Go to main.cpp and in OpenDir() function change this:
tree1.Add(id, ff.IsFolder() ? CtrlImg::error() : CtrlImg::File(),

with this:
tree1.Add(id, ff.IsFolder() ? GetFileIcon(n, true, false) : GetFileIcon(n, false, false),

To use function "Image GetFileIcon(const char *path, bool dir, bool force)" you have to go to declare it in, for example, FileSel.h and go to FileSel.cpp and in the definition change:

Image GetFileIcon(const char *path, bool dir, bool force = false)

by

Image GetFileIcon(const char *path, bool dir, bool force)

Thats all. Thank you Upp developers!
  • Attachment: Screen.JPG
    (Size: 48.42KB, Downloaded 959 times)


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: More small gems
Next Topic: Sample CUPS driver for PDF files generation
Goto Forum:
  


Current Time: Fri Apr 26 10:01:03 CEST 2024

Total time taken to generate the page: 0.02848 seconds