Subject Re: AutoDropNot
From Tom <IHaveNoEmail@ddress>
Date Tue, 6 Nov 2018 17:00:08 -0500
Newsgroups dbase.getting-started
Attachment(s) BickCholla2b.wfm

On 11/6/18 7:46 AM, Mervyn Bick wrote:
> On 2018-11-06 2:29 PM, Tom wrote:
>
>>> You are going to need a separate combobox for each entryfield.  I've
>>
>> This statement I do not understand. I was attempting to use the same
>> combobox with appropriate list information for each/any entryfield
>> that it overlies. The combobox need not be datalinked, just transfer
>> entryfield value to combobox during onGotFocus and transfer user
>> selection back to entryfield during onLostFocus. One combobox could be
>> used with many entryfields. Better than my current method of popping
>> up a window containing a listbox directly under/over selected
>> entryfield in my opinion.
>
> I didn't fully understand what you were doing.  If it works it's not
> wrong. :-)
>
>> Thank you for your work on the example. Illustrations help everyone
>> understand what and how to achieve desired results.
>
> My pleasure.  I'm a card carrying member of the "Monkey see, monkey do"
> school of programming and a simple example can be worth pages of
> explanation.
>
> Back in the days when I was getting to grips with OODML I found little
> working examples, especially those from Marko Mihorko (who I think lived
> in Romania), invaluable.  I've tried to carry on Marko's good work where
> I can.
>
> Mervyn.
>

Mervyn,

Try the attached. This is what I have been struggling to do. :)
Fond memories of Marko. Good guys like you and him are hard to find.
Monkey see, monkey do works well for me.

Thanks for your help.

Regards,

Tom



*
** END HEADER -- do not remove this line
//
// Generated on 11/06/2018
//
parameter bModal
local f
f = new BickCholla2bForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class BickCholla2bForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      metric = 6        // Pixels
      colorNormal = "LightGrey"
      height = 352.0
      left = 840.0
      top = 0.0
      width = 280.0
      text = ""
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      onOpen = {;this.value = "Rose"}
      height = 22.0
      left = 89.0
      top = 48.0
      width = 100.0
      fontSize = 11.0
      value = "Entryfield1"
   endwith

   this.ENTRYFIELD2 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD2)
      onGotFocus = class::JUMPING_CHOLLA
      onOpen = {;this.value = "Tomato"}
      height = 22.0
      left = 89.0
      top = 115.0
      width = 100.0
      fontSize = 11.0
      value = "Entryfield2"
   endwith

   this.ENTRYFIELD3 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD3)
      onGotFocus = class::JUMPING_CHOLLA
      onOpen = {;this.value = "West"}
      height = 22.0
      left = 89.0
      top = 182.0
      width = 100.0
      fontSize = 11.0
      value = "Entryfield3"
   endwith

   this.ENTRYFIELD4 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD4)
      onGotFocus = class::JUMPING_CHOLLA
      onOpen = {;this.value = "Mow Lawn"}
      height = 22.0
      left = 89.0
      top = 249.0
      width = 100.0
      fontSize = 11.0
      value = "Entryfield4"
   endwith


        Function Form_onOpen
        * ----------------------------- *
            if type('LockWindowUpdate') # 'FP'
         extern cLogical LockWindowUpdate( cHandle ) User32
      endif
        return
        *

        Function Jumping_Cholla
        * ------------------------------- *
                // create CHOLLA list for each entryfield ...
                do case
                        case this.name = "ENTRYFIELD2"
                                if type("form.aList") = 'U'
                                        form.aList = new array()
                                        form.aList.add( "Peaches" )
                                        form.aList.add( "Banana" )
                                        form.aList.add( "Rhubarb" )
                                        form.aList.add( "Pumpkin" )
                                        form.aList.add( "Apple" )
                                        // purposly left off entryfield2.value of 'Tomato"
                                        *
                                        local nRow
                                        if NOT EMPTY( form.ENTRYFIELD2.value )
                                                nRow = aScan( form.aList, form.ENTRYFIELD2.value )
                                                if nRow = 0 // not already in list ...
                                                        form.aList.add( TRIM( form.ENTRYFIELD2.value ) )
                                                endif
                                        endif
                                        *
                                        aSort( form.aList ) // nice alphabetical list for user ...
                                        *
                                endif
                                *
                                // new OCHOLLA object
                                LockWindowUpdate(form.hWND)
                                form.CHOLLA = new COMBOBOX(form)
                                with (form.CHOLLA)
                                        onLostFocus = class::Reset_Cholla
                                        systemTheme = false
                                        height = 24.0
                                        left = form.activeControl.left
                                        top = form.activeControl.top
                                        width = form.activeControl.width+18
                                        fontSize = 11.0
                                        style = 2        // DropDownList
                                        dropDownHeight = 132.0
                                        dataSource = 'ARRAY form.aList'
                                        value = TRIM( this.value )
                                endwith
                                *
                                form.oLastFocus = form.activeControl // where was I ?
                                LockWindowUpdate(0)
                                form.CHOLLA.setFocus()
                                form.CHOLLA.keyboard("{F4}")
                                form.CHOLLA.visible = true
                                *
                        case this.name = "ENTRYFIELD3"
                                // and repeat for new entryfield
                                *
                                // create CHOLLA list for each entryfield ...
                                if type("form.bList") = 'U'
                                        form.bList = new array()
                                        form.bList.add( "North" )
                                        form.bList.add( "South" )
                                        form.bList.add( "East" )
                                        form.bList.add( "West" )
                                        // purposly included entryfield3.value of 'West"
                                        *
                                        local nRow
                                        if NOT EMPTY( form.ENTRYFIELD3.value )
                                                nRow = aScan( form.bList, form.ENTRYFIELD3.value )
                                                if nRow = 0 // not already in list ...
                                                        form.bList.add( TRIM( form.ENTRYFIELD3.value ) )
                                                endif
                                        endif
                                        *
                                        aSort( form.bList ) // nice alphabetical list for user ...
                                        *
                                endif
                                *
                                LockWindowUpdate(form.hWND)
                                form.CHOLLA = new COMBOBOX(form)
                                with (form.CHOLLA)
                                        onLostFocus = class::Reset_Cholla
                                        systemTheme = false
                                        height = 24.0
                                        left = form.activeControl.left
                                        top = form.activeControl.top
                                        width = form.activeControl.width+18
                                        fontSize = 11.0
                                        style = 2        // DropDownList
                                        dropDownHeight = 132.0
                                        dataSource = 'ARRAY form.bList'
                                        value = TRIM( this.value )
                                endwith
                                *
                                form.oLastFocus = form.activeControl // where was I ?
                                LockWindowUpdate(0)
                                form.CHOLLA.setFocus()
                                form.CHOLLA.keyboard("{F4}")
                                *
                        case this.name = "ENTRYFIELD4"
                                if type("form.cList") = 'U'
                                        form.cList = new array()
                                        form.cList.add( "Rake Leaves" )
                                        form.cList.add( "Clead Gutters" )
                                        form.cList.add( "Wash Car" )
                                        form.cList.add( "Walk Dog" )
                                        form.cList.add( "Shovel Snow" )
                                        // purposly left off entryfield4.value of 'Mow Lawn"
                                        *
                                        local nRow
                                        if NOT EMPTY( form.ENTRYFIELD4.value )
                                                nRow = aScan( form.cList, form.ENTRYFIELD4.value )
                                                if nRow = 0 // not already in list ...
                                                        form.cList.add( TRIM( form.ENTRYFIELD4.value ) )
                                                endif
                                        endif
                                        *
                                        aSort( form.cList ) // nice alphabetical list for user ...
                                        *
                                endif
                                *
                                // new OCHOLLA object
                                LockWindowUpdate(form.hWND)
                                form.CHOLLA = new COMBOBOX(form)
                                with (form.CHOLLA)
                                        onLostFocus = class::Reset_Cholla
                                        systemTheme = false
                                        height = 24.0
                                        left = form.activeControl.left
                                        top = form.activeControl.top
                                        width = form.activeControl.width+18
                                        fontSize = 11.0
                                        style = 2        // DropDownList
                                        dropDownHeight = 132.0
                                        dataSource = 'ARRAY form.cList'
                                        value = TRIM( this.value )
                                endwith
                                *
                                form.oLastFocus = form.activeControl // where was I ?
                                LockWindowUpdate(0)
                                form.CHOLLA.setFocus()
                                form.CHOLLA.keyboard("{F4}")
                                *
                endcase
                *
        return
        *

        Function Reset_Cholla
        * --------------------------- *
                if TRIM( form.oLastFocus.value ) # form.CHOLLA.value // no use updating same value
                        form.oLastFocus.value = TRIM( form.CHOLLA.value ) // transfer value
                endif
                *
                release object form.CHOLLA
                *
                form.oLastFocus.before.setFocus()
                *
        return
        *

endclass

*
***
*