我在 powerbuilder 中具有下拉数据窗口样式的数据窗口中有 3 个名称为 country_id 、 states_id 和 city_id 的列

问题描述 投票:0回答:1

我在 powerbuilder 中具有下拉数据窗口样式的数据窗口中有 3 列名称为 country_id 、 states_id 和 city_id 。 我在 itemchange 事件中使用下面的代码,但是当重新选择国家时,州和城市列显示国家行 ID 和州行 ID。

this.accepttext( )
long ll_country_id, ll_state_id,ll_city_id
DATAWINDOWCHILD ldwc_state, ldwc_city, ldwc_country

this.getchild('country_id',ldwc_country)
this.getchild('state_id',ldwc_state)
this.getchild('city_id',ldwc_city)

if dwo.name = 'country_id' then
    ldwc_state.reset()
    ldwc_city.reset( )
    this.setitem(this.getrow(),'state_id', ' ' )
    this.setitem(this.getrow(),'city_id',  ' ' )
    ldwc_country.accepttext( )
    ll_country_id = ldwc_country.getitemnumber(ldwc_country.getrow(),'country_id')
    ldwc_state.settransobject(sqlca)
    ldwc_state.accepttext( )    
    ldwc_state.retrieve(ll_country_id)
end if

if dwo.name = 'state_id' then
    ldwc_city.reset( )
    this.setitem(this.getrow(),'city_id',  ' ' )
    ll_country_id = ldwc_country.getitemnumber(ldwc_country.getrow(),'country_id')
    ll_state_id = ldwc_state.getitemnumber(ldwc_state.getrow(),'state_id')
    ldwc_city.settransobject(sqlca)
    ldwc_city.accepttext( )
    ldwc_city.retrieve(ll_state_id,ll_country_id)
end if

当重新选择国家然后州和城市列显示国家行 ID 和州行 ID 为什么?

powerbuilder powerbuilder.net
1个回答
0
投票

您应该创建一个单独的事件(可能带有行号参数),然后在 country_id 或 state_id 更改时发布它。这样,在这些字段中输入的值将可用于此发布的事件。

© www.soinside.com 2019 - 2024. All rights reserved.