Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi-select dddw assistance required =) 1

Status
Not open for further replies.

wsmall73

Programmer
May 23, 2002
261
US
I am attempting to create a dddw that will allow me to select multiple
entries ( ie divisions) to be passed to a stored procedures for
reporting. What I have attempted is to add a checkbox field that is
toggled on an off when a row is selected.... it works pretty well but
I have coded this toggle in the itemchanged event and when you toggle
say row 2 and then try to toggle that same row 2 back this obviously
doesn't work cause the itemchanged event is not fired. The clicked
event only fires when I click the down arrow... not sure if there is a
user event that I can map to and accomplish what I am looking for.

I am not using PFC and I am on 7.0.3 build 10312
Any ideas or suggestions would be greatly appreciated.
 
Hi Wsmalls,

In clicked event you toggle the checkbox and then call AcceptText function.

Abhijit.
 
This issue was that the clicked event was for the parent datawindow and not the child and didn't fire until after the fact.
The following is what I ended up using... for anyone that attempts this later.

I created a user event mapped to pbm_command

in the event (courtesy of Boris Gasin and others) as part of other initiatives... I mapped by code in the rowfocused changed event of the child datawindow which works well other than the initial rowfocuschanged event that fires upon retrieval. I set up a shared boolean to keep the event from firing on the initial population of the dropdown. I hope this is of use for someone else in the future.

DataWindowChild dwc
Long iDDDWHandle, ll_row

this.GetChild('vend_db_id',dwc)
iDDDWHandle = Handle ( dwc )

IF hwndchild = iDDDWHandle THEN

CHOOSE CASE notificationcode
CASE 2048
// DDDW RowFocusChanged
IF sb_initial THEN
sb_initial=FALSE
ELSE
ll_row=(dwc.GetRow())
IF dwc.GetItemNumber(ll_row,'rate') =1 THEN
dwc.SetItem(ll_row,'rate',0)
ELSE
dwc.SetItem(ll_row,'rate',1)
END IF
dwc.AcceptText()
END IF
CASE 1281
// DDDW Clicked
CASE 2314
// DDDW RightMouseButtonDown
CASE 2314
// DDDW RightMouseButtonDown
CASE 2313
// DDDW LeftMouseButtonUp
CASE 2311
// DDDW Mouse Move
CASE 769
// DDDW Retrieve End
END CHOOSE
END IF
 
A DDDW is meant for selecting a single row. By default, the selected row is the row that has the data-value in its parent dw's column. All the events that fire for a DDDW 'actually' fire in the parent dw - the reason why is it not triggering for the second time when you toggle the checkbox. A DDDW is a 'STRUCTURE' (Not: a UserObject) but it has all the functions of the datawindow/datastore pre-defined. It does not have any events because they 'happen' in the main dw. So, your implementation is impossible - at least using PowerScript.

It may also be user-unfriendly to implement multi-row selection in a DDDW (if at all it is possible) because for each row to be selected, the user has to drop the DDDW down. The best and the simplest way to implement multi-selection (as per the GUI conventions) is to use the 'datawindow' control itself (that has 'events') with a tabular/grid style dataobject.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
True to an extent...but I have been able to obtain the functionality by trapping the notificationcode of the pbm_command event and you can trap for the clicked (notificationcode 1281) of the child datawindow and obtain the current row... so I have been able to obtain the functionality from the code I posted above with a few minor tweaks to keep the list open using showlist until all selections are complete.
 
But how would you make the ItemChanged! happen on the DataWindowChild that is a STRUCTURE? All the events that fire for a DDDW 'actually' fire in the parent dw because a DDDW does not have any events. Your implementation will still be not as complete as it can be if using a DataWindow.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
I realize that the events are being fired from the parent datawindow but I am able to get the functionality that I a looking for in this manner. I agree that the implementation may not be all that user-friendly but the customer likes the functionality having had this functionality using an infragistic control. I would prefer to use the datawindow but with 3 of these types of controls on the screen, they take up way too much real estate.
 
When you 'drop' a DDDW down, the PBM_DWNDropDown event triggers. You may like to map this event to your event (ue_DropDown) and trigger it yourself:

dw.Event ue_DropDown()

You could also place whatever script in the ue_DropDown to accomplish your task.

However, if this is working for you:

CASE 1281
// DDDW Clicked

and you are trying to trigger ItemChanged! event on the main dw, you could try:

dwObject dwo
//
dwo = dw.Object.<col>
dw.Event ItemChanged( dw.GetRow(), dwo, dw.GetText())

You can pass a 1 for the first argument and any text for the third argument.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
I will give that a try ... thanks for responding...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top