Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Tree View Images


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2008, 05:21 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 482
Awards Showcase
Beta Tester 
Total Awards: 1
Default Tree View Images

I'm creating a messaging application to replace the one already installed on my phone, which will give me some added features that I need.
The initial idea is to use a table to store all intercepted messages with an extra column added to signify whether the message is new or has already been read.
I'd like to use the tree view to show each message i.e.- each column of the table.
So far I'm making good progress, but is it possible to define different images for node1?
I'd like to display an icon to indicate if the message has been read or not, just like already done in most phones.

From the examples and help file it does not look possible, but is there a work-a-round that I could use?

Thanks,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #2 (permalink)  
Old 02-04-2008, 07:31 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 611
Default

Hi RandomCoder,

I am just before finishing a small todo-tree application so I came up this question some time ago. As I was not able to select individual images for each node, I added a small character to the beginning of the node text, indicating that this node has additional information.

It looks something like this (see attachment). Maybe you use this as an indication for read/unread messages.


specci48

@Erel: You can add this missing feature to the wishlist for future updates...
Attached Images
File Type: jpg Marker.jpg (3.8 KB, 24 views)
Reply With Quote
  #3 (permalink)  
Old 02-04-2008, 07:36 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 482
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I hadn't thought of that but it's exactly the kind of work-a-round I was after.
Thanks for sharing it with us.

Erel, if we could have individual images for each node some time in a future release then that would be better still

Thanks,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #4 (permalink)  
Old 02-05-2008, 04:51 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,973
Default

TreeView supports different images for different nodes.
For example:
Code:
Sub Globals
    'Declare the global variables here.

End Sub

Sub App_Start
    Form1.Show
    tree.New1("form1",10,10,200,300)
    node.New1
    tree.ImageMode = true
    tree.AddImage1(AppPath & "\smiley.gif")
    tree.AddImage1(AppPath & "\folder.bmp")
    tree.AddImage1(AppPath & "\openfolder.bmp")
    node.Value = tree.AddNewNode("first")
    node.ImageIndex = 0
    node.SelectedImageIndex = 0
    node.Value = tree.AddNewNode("second")
    node.ImageIndex = 1
    node.SelectedImageIndex = 1
    node.Value = tree.AddNewNode("third")
    node.ImageIndex = 2
    node.SelectedImageIndex = 2
End Sub
Reply With Quote
  #5 (permalink)  
Old 02-05-2008, 06:40 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 482
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Erel, this is great news, I've just played with the code and it works

What I hadn't realised from the "Folder Chooser" example (which others can find here... Treeview - different pics for nodes? Post #4) was that you can redefine the node.
I had misunderstood that this would add another level to the tree, but that was because in the folder chooser you have actually set two nodes, Node1.New1 and Node2.New1.
I think that the penny has finaly dropped for me

Thanks once again for your support.

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 04:51 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 611
Default

Wow... ... I didn't realize this possibility yet.

This feature drives my current project into a very nice different direction...


specci48
Reply With Quote
  #7 (permalink)  
Old 02-08-2008, 04:01 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 482
Awards Showcase
Beta Tester 
Total Awards: 1
Default Why won't this work now???

After your helpful post #4 I thought that I'd grasped how to make the tree control work the way I wanted but for some reason I'm still having problems

This is the snippet of code I'm struggling with...
Code:
Sub UpdateInbox
 TreeViewInbox.RemoveAllNodes
 For MSG = 0 To TBLSMSInbox.RowCount-1
  If TblSMSInbox.Cell( "READ" , MSG ) = False Then
   TreeViewNode1.Value = TreeViewInbox.AddNewNode( TblSMSInbox.Cell( "FROM" , MSG ) & "  --  " & Time( TblSMSInbox.Cell( "DATE" , MSG ) ) & " , " & Date( TblSMSInbox.Cell( "DATE" , MSG ) ) )
   TreeViewNode2.Value = TreeViewNode1.AddNewNode( TblSMSInbox.Cell( "BODY" , MSG ) )
   TreeViewInbox.ImageIndex = 0
   TreeViewInbox.SelectedImageIndex = 0
  Else
   TreeViewNode1.Value = TreeViewInbox.AddNewNode( TblSMSInbox.Cell( "FROM" , MSG ) & "  --  " & Time( TblSMSInbox.Cell( "DATE" , MSG ) ) & " , " & Date( TblSMSInbox.Cell( "DATE" , MSG ) ) )
   TreeViewNode2.Value = TreeViewNode1.AddNewNode( TblSMSInbox.Cell( "BODY" , MSG ) )
   TreeViewInbox.ImageIndex = 1
   TreeViewInbox.SelectedImageIndex = 1
  End If
 Next
 TreeViewInbox.ExpandAll
End Sub
When the READ column is True, then the tree view should display image 1, but it doesn't, it continues to show image 0.
I've checked that the Else block of code is being used my inserting a MsgBox in there and I've double checked that image 1 is working by changing the other image 0 commands.
For some reason I just cannot get the tree view to loop through my table and display an image the depicts whether the message has been read or not.
Am I just being really thick today???

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #8 (permalink)  
Old 02-08-2008, 04:12 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,973
Default

You should change the nodes images not the treeview images.
try this:
Code:
Sub UpdateInbox
 TreeViewInbox.RemoveAllNodes
 For MSG = 0 To TBLSMSInbox.RowCount-1
  If TblSMSInbox.Cell( "READ" , MSG ) = False Then
   TreeViewNode1.Value = TreeViewInbox.AddNewNode( TblSMSInbox.Cell( "FROM" , MSG ) & "  --  " & Time( TblSMSInbox.Cell( "DATE" , MSG ) ) & " , " & Date( TblSMSInbox.Cell( "DATE" , MSG ) ) )
   TreeViewNode2.Value = TreeViewNode1.AddNewNode( TblSMSInbox.Cell( "BODY" , MSG ) )
   TreeViewNode1.ImageIndex = 0
   TreeViewNode1.SelectedImageIndex = 0
  Else
   TreeViewNode1.Value = TreeViewInbox.AddNewNode( TblSMSInbox.Cell( "FROM" , MSG ) & "  --  " & Time( TblSMSInbox.Cell( "DATE" , MSG ) ) & " , " & Date( TblSMSInbox.Cell( "DATE" , MSG ) ) )
   TreeViewNode2.Value = TreeViewNode1.AddNewNode( TblSMSInbox.Cell( "BODY" , MSG ) )
   TreeViewNode1.ImageIndex = 1
   TreeViewNode1.SelectedImageIndex = 1
  End If
 Next
 TreeViewInbox.ExpandAll
End Sub
Reply With Quote
  #9 (permalink)  
Old 02-08-2008, 04:16 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 482
Awards Showcase
Beta Tester 
Total Awards: 1
Default



After loads of attempts at getting this working I just have, but as always, you have beaten me to it

Sorry for wasting your time.

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tree View - Help Cableguy Questions & Help Needed 18 07-19-2008 12:43 PM
Another problem with tree view RandomCoder Questions & Help Needed 8 02-28-2008 11:36 AM
Registry to Tree View willisgt Questions & Help Needed 0 02-20-2008 04:17 PM
Context Menu and Tree View. RandomCoder Questions & Help Needed 4 02-18-2008 04:35 PM
Canīt view whole Website with PPC Browser Smurfy2000 Forum Discussion 3 02-13-2008 08:08 AM


All times are GMT. The time now is 10:16 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0