pfc_default


pfcdwsrv.pbl   >   pfc_w_restorerow   >   pfc_default   

Full name pfc_w_restorerow.pfc_default
Access public
Extend of
Return value
Prototype event pfc_default()

Name Datatype
No Data

Name Datatype
lb_done boolean
li_rc integer
ll_currrow long
ll_focusrow long
ll_idx long
ll_originalrow long
ll_restored long
ll_row long
ll_rowcount long
ll_rowid long
ll_rowidmax long
ll_selectedrow long

event pfc_default;call super::pfc_default;//////////////////////////////////////////////////////////////////////////////
//
//	Event:  pfc_default
//
//	Description:  
//	Restore selected rows to the primary buffer
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

long	ll_row
long	ll_rowidmax
long	ll_rowid
long	ll_selectedrow
long	ll_focusrow
long	ll_restored
long	ll_originalrow
long	ll_currrow
long	ll_rowcount
long	ll_idx
integer	li_rc
boolean lb_done

SetPointer (hourglass!) 

// Validate required references.
If IsNull(idw_parm) Or Not IsValid(idw_parm) Then
	inv_return.ii_rc = -1
	CloseWithReturn (this, inv_return) 	
End If

// Get the original - current row.
ll_originalrow = idw_parm.GetRow()

// Loop around as long as there is a highlighted row.
DO
	// Get the first highlighted row.
	ll_selectedrow = dw_delete.GetSelectedRow (0)
	If ll_selectedrow > 0 Then
		// Get the original location prior to any Sorting or Filtering.
		ll_rowidmax = dw_delete.GetRowIdFromRow (ll_selectedrow)
		ll_row = ll_selectedrow
	
		// Process needs to undelete from bottom-up.
		DO
			// Get the other selected rows and check for largest ll_rowid.
			ll_selectedrow = dw_delete.GetSelectedRow (ll_selectedrow)
			If ll_selectedrow > 0 Then
				// Get the original location prior to any Sorting or Filtering.
				ll_rowid = dw_delete.GetRowIdFromRow (ll_selectedrow)
				If ll_rowid > ll_rowidmax  Then
					// A new bottom row has been found.
					ll_rowidmax = ll_rowid
					ll_row = ll_selectedrow
				End If
			End If
		LOOP UNTIL  ll_selectedrow <= 0

		// Undelete the row from the real datawindow.  Remove from the restorerow window.
		li_rc =	idw_parm.RowsMove (ll_rowidmax, ll_rowidmax, delete!, &
					idw_parm, idw_parm.RowCount() + 1 , primary!)
		dw_delete.DeleteRow(ll_row)
		
		// Validate the Undelete  was successful.
		if li_rc = 1 then
			idw_parm.SelectRow (idw_parm.RowCount(), False)
			ll_restored++
			// Make sure a search for the next row to undelete is performed
			ll_selectedrow = 1			
		else
			exit
		end if	

	End If
LOOP UNTIL ll_selectedrow <= 0

If ll_restored > 0 Then
	// Get the current row.
	ll_currrow = idw_parm.GetRow()

	// Scroll to first restored row
	ll_focusrow = idw_parm.RowCount() - ll_restored + 1
	li_rc = idw_parm.ScrolltoRow (ll_focusrow) 
	li_rc = idw_parm.SetRow (ll_focusrow)
	li_rc = idw_parm.SelectRow (0, False)

	// If the SetRow did not, Make sure notification of rowfocuschanged is sent. 
	If ll_restored > 0 And ll_currrow = ll_focusrow Then
		idw_parm.Event rowfocuschanged(ll_focusrow)
	End If
End If

// Return the number of rows restored
inv_return.ii_rc = ll_restored
CloseWithReturn (this, inv_return) 

end event

     
Name Owner
pfc_w_restorerow.cb_ok.clicked cb_ok

     
Name Owner
datawindow.deleterow datawindow
datawindow.getrow datawindow
datawindow.getrowidfromrow datawindow
datawindow.getselectedrow datawindow
datawindow.rowcount datawindow
datawindow.rowsmove datawindow
datawindow.scrolltorow datawindow
datawindow.selectrow datawindow
datawindow.setrow datawindow
systemfunctions.closewithreturn systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.setpointer systemfunctions
datawindow.rowfocuschanged datawindow
pfc_w_response.pfc_default pfc_w_response

     
Full name
pfc_w_restorerow

     
Name Scope
No Data