Page 1 of 1

Please could i have some advise

Posted: Fri Jun 03, 2005 1:34 pm
by nrasool
Hi there

Please could someone give me a guiding light. Its a followup from this thread

I have now got something which i like, many thanks to Paul which helped me out. I know have a series of dialog box see the following picture:
Image

If i highlight a node in the treeview, how can i relate that to the text dialog on the right hand side, so it shows information?

Please could anyone give me some advise or links?

Kind Regards

Posted: Fri Jun 03, 2005 2:10 pm
by GedB
Quick example

Code: Select all

OpenWindow(0, 0, 0, 500, 500, #PB_Window_ScreenCentered|#PB_Window_SystemMenu, "Tree Demo")

CreateGadgetList(WindowID())

TreeGadget(0, 0, 0, 250, 500)
TextGadget(1, 250, 0, 250, 500, "")

AddGadgetItem(0, -1, "England")
OpenTreeGadgetNode(0)
  AddGadgetItem(0, -1, "London")
  AddGadgetItem(0, -1, "Manchester")
  AddGadgetItem(0, -1, "Birmingham")
CloseTreeGadgetNode(0)


AddGadgetItem(0, -1, "France")
OpenTreeGadgetNode(0)
  AddGadgetItem(0, -1, "Paris")
  AddGadgetItem(0, -1, "Nice")
  AddGadgetItem(0, -1, "Lyon")
CloseTreeGadgetNode(0)

Repeat
  event = WaitWindowEvent()
  If event = #PB_Event_Gadget
    If EventGadgetID() = 0
      item = GetGadgetState(0)
      itemtext.s = GetGadgetItemText(0, item, 0)
      text.s = ""
      
      For i = 1 To 100
        text + itemtext + " "
      Next i
      
      SetGadgetText(1, text)
    EndIf
  EndIf
  
  
Until event = #PB_Event_CloseWindow

Posted: Fri Jun 03, 2005 2:15 pm
by gnozal
What about those functions ?

Code: Select all

- GetGadgetState(#MyTreeGadget): Return the current selected item. 
- GetGadgetText(#MyTreeGadget): Return the text of the currently selected item. 
If you know what tree item is selected, you can update your text dialog.

Posted: Fri Jun 03, 2005 4:45 pm
by nrasool
Hi there

I really appreciate the help, thankyou. Now got a good starting block.

@gnozal
i did check the helpfile, and saw that function, however just got stuck on EvenGadgetID, which GedB explained.

Many thanks for the help :)