Groups > dBase > dBase shared code > Re: help is needed for sure...




Re: help is needed for sure...

Re: help is needed for sure...
Wed, 17 Jan 2007 22:01:53 -050
Rick,
I can not make it to work, I tought by using the parent form function
It would open the About.wfm form, but nothing happend.
When you get time, please look at my code example:

** END HEADER -- do not remove this line
//
// Generated on 01/17/2007
//
parameter bModal
local f
f = new treeview_exampleForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class treeview_exampleForm of FORM
   with (this)
      onLeftDblClick = class::FORM_ONLEFTDBLCLICK
      height = 16
      left = 41
      top = 4.2727
      width = 40
      text = ""
   endwith

   this.TREEVIEW1 = new TREEVIEW(this)
   with (this.TREEVIEW1)
      height = 13.5
      left = 2
      top = 1
      width = 19
      colorNormal = "red/Window"
      borderStyle = 6 // Drop Shadow
      indent = 19
      imageSize = 16
      selectedImage = "resource #51"
   endwith

   this.TREEVIEW1.TREEITEM1 = new TREEITEM(this.TREEVIEW1)
   with (this.TREEVIEW1.TREEITEM1)
      text = "House"
      expanded = true
   endwith

   this.TREEVIEW1.TREEITEM1.TREEITEM1 = new 
TREEITEM(this.TREEVIEW1.TREEITEM1)
   with (this.TREEVIEW1.TREEITEM1.TREEITEM1)
      text = "House1"
      image = "resource #21"
      selectedImage = "resource #18"
   endwith

   this.TREEVIEW1.TREEITEM2 = new TREEITEM(this.TREEVIEW1)
   with (this.TREEVIEW1.TREEITEM2)
      text = "Cars"
   endwith

   this.TREEVIEW1.TREEITEM2.TREEITEM1 = new 
TREEITEM(this.TREEVIEW1.TREEITEM2)
   with (this.TREEVIEW1.TREEITEM2.TREEITEM1)
      text = "Car1"
      image = "resource #21"
   endwith

   this.TREEVIEW1.TREEITEM2.TREEITEM2 = new 
TREEITEM(this.TREEVIEW1.TREEITEM2)
   with (this.TREEVIEW1.TREEITEM2.TREEITEM2)
      text = "Car2"
      image = "resource #21"
   endwith

   this.TREEVIEW1.TREEITEM3 = new TREEITEM(this.TREEVIEW1)
   with (this.TREEVIEW1.TREEITEM3)
      text = "Boats"
   endwith

   this.TREEVIEW1.TREEITEM3.TREEITEM1 = new 
TREEITEM(this.TREEVIEW1.TREEITEM3)
   with (this.TREEVIEW1.TREEITEM3.TREEITEM1)
      text = "Boat1"
      image = "resource #21"
   endwith

   this.TREEVIEW1.TREEITEM3.TREEITEM2 = new 
TREEITEM(this.TREEVIEW1.TREEITEM3)
   with (this.TREEVIEW1.TREEITEM3.TREEITEM2)
      text = "Boat2"
      image = "resource #21"
   endwith

   this.TREEVIEW1.TREEITEM3.TREEITEM3 = new 
TREEITEM(this.TREEVIEW1.TREEITEM3)
   with (this.TREEVIEW1.TREEITEM3.TREEITEM3)
      text = "Boat3"
      image = "resource #21"
   endwith


/////////////////////////////////////////////////////////////////
   function form_onLeftDblClick(flags, col, row)

      set procedure to ABabout.wfm additive
      fChild=new ABaboutform()
      fChild.parentform=form
      fChild.mdi=false
      fChild.readModal()


      /*
      private oItem
      oItem  =  this.getItemByPos(col, row)

      if type("oItem") == "O"
         // a treeItem is selected.

         Local cText
         // store the current treeItem's text property
         // to cText to simplify the if/endif construct.
         cText =  "" + oItem.text

         // start a new form based upon
         // the currently selected treeItem.
         if cText == "New Customer"
            do newCustomer.wfm
         elseif cText == "Preferences"
            do preferences.wfm
         else

            // perform the default behavior
            // for a leftDblClick.
            if oItem.noOfChildren > 0
               // there is something to do.
               if oItem.expanded
                  // already expanded, roll it up.
                  oItem.expanded := false
               else
                  // not expanded, roll it down.
                  oItem.expanded := true
               endif

            else
               // nothing to do.
            endif
         endif

      else
         // no treeItem is selected.
      endif
   return
   */
endclass







"Rick Miller" <nospam@nospam.com> wrote in message 
news:Xns9676EE4076421rmadv@64.132.211.168...
> Hello Benttini,
>
> additional to Andrew's post,
> below is a snippet of code.
>
> Rick Miller
>
> "Imar B DaCunha" <idacunha@nc.rr.com> wrote in
> news:EpFkJ0hcFHA.1768@news-server:
>
>> Hi everyone, I am trying to execute events from a treeView object
>> menu in one of my forms, however I have never use the treeView
>> control. Can some one help me out here.
>> Example:
>>  I would like to click (or high light) in a particular treeItem
>>  and open
>> another form per example etc. or do some thing else.
>> A small piece of code would help me a lot, since I still struggle
>> with the English language to this day.
> ----
>
>   /*
>   because the treeItem object has no events
>   to work with, You would normally use
>   an event of the parent (treeView) object.
>
>   The example code below would be linked to
>   the treeView object's onLeftDblClick event.
>   */
>
>   //-------------------------------------------------//
>   // treeView method, linked to onLeftDblClick event.
>   // either start a new form or do the default.
>   function treeView1_onLeftDblClick(flags, col, row)
>      // private variable used cuz of the type function.
>      private oItem
>      oItem  =  this.getItemByPos(col, row)
>
>      if type("oItem") == "O"
>         // a treeItem is selected.
>
>         Local cText
>         // store the current treeItem's text property
>         // to cText to simplify the if/endif construct.
>         cText =  "" + oItem.text
>
>         // start a new form based upon
>         // the currently selected treeItem.
>         if cText == "New Customer"
>            do newCustomer.wfm
>         elseif cText == "Preferences"
>            do preferences.wfm
>         else
>
>            // perform the default behavior
>            // for a leftDblClick.
>            if oItem.noOfChildren > 0
>               // there is something to do.
>               if oItem.expanded
>                  // already expanded, roll it up.
>                  oItem.expanded := false
>               else
>                  // not expanded, roll it down.
>                  oItem.expanded := true
>               endif
>
>            else
>               // nothing to do.
>            endif
>         endif
>
>      else
>         // no treeItem is selected.
>      endif
>   return 

Post Reply
about | contact