The ol’ Hidden Item in the Dddw Problem
I have a dddw which hides certain items by setting the row height for these hidden rows to 0. This allows the column for other rows to still display the non-selectable dddw rows. But by using the arrow key or hotkeys (first letter of the description) the user can still select these rows which have a height of zero.
To get around this, create a user-event and map it to pbm_command. In the example below, check if the column is bd_ty_cd. Then see if the dddw rfc event fires (IntHigh(message.wordparm) = 2048 ). Then do what you need to do to skip over an unselectable column.
Note: there is another way to deal with this issue without using row hiding or needing the pbm_command dddw event. This will be detailed in a future post. The Ol’ Hidden items in the dddw problem part II
//////////////////////////////////////////////////////////////////////////////
// Event: ue_command for dw_bd_job (pbm_command)
//
// Description: User event for trapping dddw events
//
// Arguments: long hwndchild
// unsignedinteger childid
//
// Returns: none
//
//////////////////////////////////////////////////////////////////////////////
// Revision History
//
// Date By Vers Task Description/Comments
// -------- --- ----- ---- ---------------------------------------
// 10/25/04 fjs 98094 Initial Version
//
//////////////////////////////////////////////////////////////////////////////
datawindowchild ldwc_bind_style
integer li_rc = SUCCESS, li_curr_dddw_row, li_bind_style, li_prev_bind_style
if li_rc = SUCCESS then
if this.GetColumnName() <> "bd_tp_cd" then
li_rc = NO_ACTION
end if
end if
if li_rc = SUCCESS then
// Verify that the event is RowFocusChanged
if IntHigh(message.wordparm) <> 2048 then
li_rc = NO_ACTION
end if
end if
if li_rc = SUCCESS then
// is the selected bind style visible in the bind_style dddw
this.GetChild("bd_tp_cd", ldwc_bind_style)
li_prev_bind_style = this.GetItemNumber(this.GetRow(), "bd_tp_cd" )
li_curr_dddw_row = ldwc_bind_style.GetRow()
li_bind_style = ldwc_bind_style.GetItemNumber(li_curr_dddw_row, "job_cntrl_cd" )
// If the user is trying to select an item which should not be selectable,
// with the arrow key or hotkey, select the next best acceptable item.
if li_bind_style = 626 or li_bind_style = 629 then
if NOT KeyDown(KeyUpArrow!) and NOT KeyDown(KeyDownArrow! ) then
this.SetItem(this.GetRow(), "bd_tp_cd", li_prev_bind_style)
end if
if KeyDown(KeyUpArrow!) then
li_bind_style = ldwc_bind_style.GetItemNumber(li_curr_dddw_row - 2, "job_cntrl_cd" )
this.SetItem(this.GetRow(), "bd_tp_cd", li_bind_style)
end if
if KeyDown(KeyDownArrow!) then
li_bind_style = ldwc_bind_style.GetItemNumber(li_curr_dddw_row + 2, "job_cntrl_cd" )
this.SetItem(this.GetRow(), "bd_tp_cd", li_bind_style)
end if
end if
end if
1 Comment »
Leave a comment
-
Archives
- May 2009 (1)
- March 2009 (1)
- January 2009 (2)
- December 2008 (1)
- November 2008 (2)
- September 2008 (1)
- August 2008 (1)
- July 2008 (24)
- June 2008 (22)
- May 2008 (69)
- April 2008 (25)
-
Categories
-
RSS
Entries RSS
Comments RSS
[...] are a couple ways to deal with this. The first way I learned is described here The Ol’ Hidden Item in the dddw Part I. But I much prefer a technique I learned a long time ago in a PBDJ article written by a fellow [...]
Pingback by The Ol’ Hidden Items in the Dddw Problem Part II « Schultz’s PowerBuilder Notes | November 16, 2008 |