Subject |
Re: AutoDropNot |
From |
Mervyn Bick <invalid@invalid.invald> |
Date |
Mon, 5 Nov 2018 16:38:08 +0200 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
entryfieldtypes1.wfm |
On 2018-11-04 7:58 PM, Tom wrote:
> Hi all,
>
> Been fooling around with this for most of the morning. As you can see,
> numerous code changes still fail to produce a combobox autodrop.
>
> Can you straighten me out.
This has been overtaken by events. :-)
I was working on this this morning but I had to go out for a while. In
the meantime you have solved the problem yourself. Your solution works
because it uses a Windows function to pass an instruction direct to the
combobox. My solution was to use the combobox's keyboard() method to
pass it F4. This probably causes dBASE to use the exact same windows
function internally.
Back to the problem.
A couple of comments.
The object of the exercise appears to be to only show the combobox
"drop" button if the control has focus.
You are going to need a separate combobox for each entryfield. I've
commented out the line in the EFDATE constructor code that assigns the
onGotFocus event handler so that the existing CHOLLA control only
displays over the EFCHARACTER control.
The datasource for each combobox needs to be set up before the form
opens so that the default selection can be displayed in EFCHARACTER when
the form opens. If you don't want to open with a default setting
display something like "Make selection" when the form opens. If you do
this the control must not be datalinked to a field.
When CHOLLA loses focus you need to save the value from CHOLLA back to
EFCHARACTER and write the value to a field if necessary.
A revised version of your form with some comments where I've made
changes is attached.
Mervyn.
| ** END HEADER -- do not remove this line
//
// Generated on 2018-11-05
//
parameter bModal
local f
f = new Entryfieldtypes1Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class Entryfieldtypes1Form of FORM
with (this)
metric = 6 // Pixels
colorNormal = "LightGrey"
height = 352.0
left = 840.0
top = 0.0
width = 280.0
text = ""
endwith
this.EFBOOLIAN = new ENTRYFIELD(this)
with (this.EFBOOLIAN)
height = 22.0
left = 88.0
top = 32.0
width = 39.0
fontSize = 11.0
statusMessage = "Boolian: Allows input and display of TRUE, FALSE, T, F, Y or N in upper or lower case."
speedTip = "Boolian"
value = false
endwith
this.EFNUMERIC = new ENTRYFIELD(this)
with (this.EFNUMERIC)
height = 22.0
left = 88.0
top = 65.0
width = 60.0
picture = "99,999,999.99"
fontSize = 11.0
statusMessage = "Numeric Allows a numeric value including 2 decimal places. Decimal point is required. Commas are automatic."
speedTip = "Numeric"
value = 0.0
endwith
this.EFDATE = new ENTRYFIELD(this)
with (this.EFDATE)
height = 22.0
left = 88.0
top = 98.0
width = 81.0
picture = "99/99/9999"
fontSize = 11.0
statusMessage = "Date: Type two digit month, day and four digit year. No separators are required."
speedTip = "Date"
value = {2007-08-31}
endwith
this.EFINTIGER = new ENTRYFIELD(this)
with (this.EFINTIGER)
height = 22.0
left = 88.0
top = 131.0
width = 56.0
picture = "99,999,999"
fontSize = 11.0
statusMessage = "Integer: Integers only. Commas are automatic."
speedTip = "Intiger"
value = 0
endwith
this.EFCHARACTER = new ENTRYFIELD(this)
with (this.EFCHARACTER)
onGotFocus = class::EFCHARACTER_ONGOTFOCUS
height = 22.0
left = 88.0
top = 164.0
width = 76.0
fontSize = 11.0
statusMessage = "Character: Any typable character."
speedTip = "Character"
value = "Entryfield1"
endwith
this.EFTIME = new ENTRYFIELD(this)
with (this.EFTIME)
height = 22.0
left = 88.0
top = 197.0
width = 66.0
picture = "99:99:99"
fontSize = 11.0
statusMessage = "Time: Military (24 hour) time format of hours, minutes and seconds (hh:mm:ss). No separaters are required."
speedTip = "Time"
value = "10:00:00"
endwith
this.EFDATETIME = new ENTRYFIELD(this)
with (this.EFDATETIME)
height = 22.0
left = 88.0
top = 230.0
width = 140.0
picture = "99/99/9999 99:99:99"
fontSize = 11.0
statusMessage = "DateTime: Two digit mont and day, four digit year, and military time format (hhmm:ss). No separaters are required."
speedTip = "Datetime"
value = {2007-08-31 10:00:00 AM}
endwith
this.CHOLLA = new COMBOBOX(this)
with (this.CHOLLA)
onLostFocus = class::CHOLLA_OLF
onOpen = {;this.height = 23}
systemTheme = false
height = 25.0
left = 88.0
top = -100.0
width = 175.0
fontSize = 11.0
tabStop = false
dataSource = 'array {"Cholla"}'
statusMessage = "Click pushbutton or use <F4> key to display list."
style = 2 // DropDownList
dropDownHeight = 132.0
autoDrop = true
endwith
Function EFCHARACTER_onGotFocus()
* -------------------------------------------------- *
//local aList
aList = new ARRAY()
aList.add("ABC")
aList.add("def")
aList.add("GHI")
aList.add("jkl")
aList.add("MNO")
aList.add("pqr")
aList.add("STU")
aList.add("vwxyz")
form.CHOLLA.dataSource = 'ARRAY aList'
*
form.oNextFocus = this.before
form.CHOLLA.width = this.width+18
form.CHOLLA.top = this.top
***form.CHOLLA.AutoDrop = true
*** form.CHOLLA.visible = true
***form.CHOLLA.pageNo = 1
***form.CHOLLA.AutoDrop = true
form.CHOLLA.setFocus()
/// this.keyboard "{F4}"
// here 'this' is EFCHARACTER (an entryfield object) which doesn't have the
// dropdown feature.
// keyboard is a command but oRef.keyboard() is a method of the object. The
// () is required around the argument submitted to the method.
form.cholla.keyboard("{F4}") // added MB
return
*
Function EFDATE_onGotFocus()
* --------------------------------------- *
//local aList
aList = new ARRAY()
aList.add(Date())
form.CHOLLA.dataSource = 'ARRAY aList'
*
form.oNextFocus = this.before
form.CHOLLA.width = this.width
form.CHOLLA.top = this.top
form.CHOLLA.left = this.left
*** form.CHOLLA.visible = true
***form.CHOLLA.pageNo = 1
form.CHOLLA.setFocus()
return
*
Function Cholla_oLF
* -------------------------*
// this.autoDrop = false
*** this.visible = false
//this.pageNo = 2
this.top = -100
if type("form.oNextFocus") # 'U'
form.oNextFocus.setFocus()
form.oNextFocus = null
endif
form.efcharacter.value = this.value //added MB
return
*
endclass
/*
form.aFlavors.add( this.form.newFlavorText.value ) // Add new flavor
form.flavorCombobox.dataSource += "" // Reassert by adding empty string
*/
|
|