Link to home
Start Free TrialLog in
Avatar of raheis
raheis

asked on

ItemChanged event

I have to dropdown data windows boxes emp no and emp name
I want to select or type emp no and when I have selected or tab out I want
the emp name displayed in the drop down datawindow. Please send me code to do this I have
got the data retrieve ok just having probs with setItem , i guess I need some instance variables
set up
Avatar of raheis
raheis

ASKER

sorry in the Qustion area
Hi,
 
Use lokkupdisplay () in computed field to display Emp Name (if emp-no field has dropdown dw. )
 
Thanks.
SOrry lookupdisplay() function.
 
Declare an instance variable for your datawindowchild:
datawindowchild      idwc_artist

In the PFC_PREOPEN (or OPEN if you're not using PFC) event define the variable:
dw_header.GetChild('artist', idwc_artist)

Make sure that the dropdown datawindow includes the column with the data you want. If you do not want it to display in the dropdown, you can delete it from the display but you must select it in the query.

Then in the ITEMCHANGED event do something like this:
int            li_data
long            ll_row
string      ls_column, ls_display, ls_msgParms[]

ls_column = dwo.Name

Choose Case ls_column
      Case 'artist'
            ll_row = idwc_artist.GetRow()
            ls_display = idwc_artist.GetItemString(ll_row, 'artist_name')
            this.SetItem(row, 'artist_name', ls_display)
Avatar of raheis

ASKER

Hello Mark,

I think your in the going in the right direction but I got 2 dropdowns
eg
Empid : 123               Emp Name : Smith

When I select 123 in the first dropdown I want to set the second drop down to smith and be able to either type 123 in editable dropdown or just select it.

Thanks,
R.
ASKER CERTIFIED SOLUTION
Avatar of MarkPTX
MarkPTX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of raheis

ASKER

yes I definitely need 2 dropdowns and that is where i need some code snippet because Im having trouble setting the second one
Avatar of raheis

ASKER

Thanks, I used an instance variable set in item changed and used itemfocuschanged to get and set the other dddw it works.