Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: gajender_99Posted on 2007-01-10 at 06:18:41ID: 18283944
Hi ,
ru
ch")
********** ********** ********** ********** ****/ ********** ********** ********** ********** ****/ h_cnt].tex tcol = vs_textcol h_cnt].dw) h_cnt].dw. SetTransOb ject(SQLCA ) h_cnt].src hcol = vs_srchcol h_cnt].dat acol = vs_datacol
********** ********** ********** ********** ********** ********** **/ ********** ********** ********** ********** ********** ********** **/ tcol = ls_col then ********** ********** ********** ********** */ ********** ********** ********** ********** */ hcol + ", " + String(li_len) & Find(ls_sr chtext,0, istr_ddkeysrch[li_idx].dw. RowCount() )
********** ********** ********** ********** ********** ********** / ********** ********** ********** ********** ********** ********** / dw.Describ e(istr_ddk eysrch[li_ idx].datac ol + ".coltype") ].dw.Descr ibe(istr_d dkeysrch[l i_idx].dat acol + ".coltype"), 4) = "char" GetItemStr ing(ll_row , istr_ddkeysrch[li_idx].dat acol)
].dw.Descr ibe(istr_d dkeysrch[l i_idx].dat acol + ".coltype"), 4) = "deci" dx].dw.Get Itemnumber (ll_row, istr_ddkeysrch[li_idx].dat acol))
Describe (istr_ddkeysrch[li_idx].da tacol + ".coltype") = "number" GetItemNum ber(ll_row , istr_ddkeysrch[li_idx].dat acol)
Describe (istr_ddkeysrch[li_idx].da tacol + ".coltype") = "date" GetItemDat e(ll_row, istr_ddkeysrch[li_idx].dat acol) Describe (istr_ddkeysrch[li_idx].da tacol + ".coltype") = "datetime" GetItemDat eTime(ll_r ow, istr_ddkeysrch[li_idx].dat acol) Describe (istr_ddkeysrch[li_idx].da tacol + ".coltype") = "time" GetItemTim e(ll_row, istr_ddkeysrch[li_idx].dat acol)
********** ********** ********** ********** ********** ********/ ********** ********** ********** ********** ********** ********/
Save the following script as u_basedw.sru and then import into PB
$PBExportHeader$u_basedw.s
$PBExportComments$USED WITH THE DROPDOWN SEARCH
forward
global type u_basedw from datawindow
end type
end forward
type us_ddkeysrch from structure
string textcol
datawindowchild dw
string srchcol
string datacol
string prevtext
end type
global type u_basedw from datawindow
int Width=494
int Height=360
int TabOrder=1
boolean LiveScroll=true
event ue_ddkeysrch pbm_custom01
event ue_dwnkey pbm_dwnkey
end type
global u_basedw u_basedw
type variables
Private:
us_ddkeysrch istr_ddkeysrch[]
Protected:
boolean ib_ddkeysrch = false
integer ii_ddkeysrch_cnt
end variables
forward prototypes
public subroutine uf_setddkeysrch (string vs_textcol, string vs_srchcol, string vs_datacol)
public subroutine uf_ddkeysrch ()
end prototypes
event ue_ddkeysrch;if ib_ddkeysrch then uf_DDKeySrch()
end event
event ue_dwnkey;//IF KeyDown(KeyEnter!) THEN
this.PostEvent("ue_ddkeysr
//end if
end event
public subroutine uf_setddkeysrch (string vs_textcol, string vs_srchcol, string vs_datacol);ib_ddkeysrch = true
ii_ddkeysrch_cnt++
/*************************
/* Add an entry to the array of columns that are currently setup */
/* for dynamic key searching. Obtain a pointer to the child */
/* datawindow of the column and set the transaction object for it. */
/* Also keep track of the search column and data column so we */
/* know which columns to search and retrieve when a value is typed. */
/*************************
istr_ddkeysrch[ii_ddkeysrc
this.GetChild(vs_textcol, istr_ddkeysrch[ii_ddkeysrc
istr_ddkeysrch[ii_ddkeysrc
istr_ddkeysrch[ii_ddkeysrc
istr_ddkeysrch[ii_ddkeysrc
end subroutine
public subroutine uf_ddkeysrch ();//string ls_col, ls_srch, ls_found
//integer li_idx, li_len
string ls_col, ls_srch, ls_found
integer li_idx, li_len
long ll_row, ll_found
date ld_found
datetime ldt_found
time lt_found
STRING ls_srchtext,LD
Yield()
/************************/
/* Ignore movement keys */
/************************/
CHOOSE CASE true
CASE KeyDown(keyDelete!), KeyDown(keyBack!), KeyDown(keyTab!) , KeyDown(keyEnter!)
return
CASE KeyDown(keyDownArrow!), KeyDown(keyUpArrow!), KeyDown(keyLeftArrow!), KeyDown(keyRightArrow!)
return
END CHOOSE
/*************************
/* Since multiple columns could be setup for dynamic key searching, there is an array */
/* of the columns currently setup. Search the array for the entry that matches the */
/* current column. */
/*************************
ls_col = this.GetColumnName()
FOR li_idx = 1 TO ii_ddkeysrch_cnt
if istr_ddkeysrch[li_idx].tex
/*************************
/* Get the typed value from the edit box and find a match for it */
/* in the dropdown list. */
/*************************
ls_srch = Lower(this.GetText())
li_len = Len(ls_srch)
if li_len < 1 then Return
ls_srchtext="lower(left(" + istr_ddkeysrch[li_idx].src
+ ")) = '" + ls_srch + "'"
ll_row = istr_ddkeysrch[li_idx].dw.
if ll_row < 1 then Return
/*************************
/* Find the datatype of the data column in the dddw. Use the correct GetItem... call */
/* to retrieve the value and then use SetText to place it in the edit box. */
/*************************
// LD=istr_ddkeysrch[li_idx].
CHOOSE CASE True
CASE Left(istr_ddkeysrch[li_idx
ls_found = istr_ddkeysrch[li_idx].dw.
//this.SetText(ls_found)
CASE Left(istr_ddkeysrch[li_idx
ls_found = string(istr_ddkeysrch[li_i
//this.SetText(ls_found)
CASE istr_ddkeysrch[li_idx].dw.
ll_found = istr_ddkeysrch[li_idx].dw.
this.SetText(String (ll_found))
CASE istr_ddkeysrch[li_idx].dw.
ld_found = istr_ddkeysrch[li_idx].dw.
this.SetText(String (ld_found))
CASE istr_ddkeysrch[li_idx].dw.
ldt_found = istr_ddkeysrch[li_idx].dw.
this.SetText(String (ldt_found))
CASE istr_ddkeysrch[li_idx].dw.
lt_found = istr_ddkeysrch[li_idx].dw.
this.SetText(String (lt_found))
END CHOOSE
/*************************
/* Select the text from the current position to the end. */
/* The next keystroke will erase the selection and substitute the typed character. */
/*************************
//if li_LEN = len(ls_found) THEN
// Move the cursor to the end
// this.SelectText (Len (ls_found)+1, 0)
//else
// Hightlight the portion the user has not actually typed.
//this.SelectText (li_len + 1, 150)
//end if
EXIT
end if
NEXT
end subroutine
on u_basedw.destroy
end on