pfc_clicked


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_sort   >   pfc_clicked   

Full name pfc_n_cst_dwsrv_sort.pfc_clicked
Access public
Extend of integer
Return value integer
Prototype event integer pfc_clicked(integer,integer,long,ref dwobject)

Name Datatype
No Data

Name Datatype
li_headerlen integer
li_rc integer
li_suffixlen integer
ls_colname string
ls_headername string
ls_sortstring string

event pfc_clicked;call super::pfc_clicked;//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		pfc_clicked
//
//	Access:    		Public
//
//	Arguments:  	(passed arguments of dw Clicked event)
//  xpos (integer)  		 	The x-position of the mouse
//  ypos (integer)  			The y-position of the mouse
//  row (long) 				The row number clicked on, if any
//	 dwo (dwobject)   		The dwobject clicked on )
//	 cntl_clicked (boolean) Indicates that the user pressed Ctnl/Click
//
//	Returns:   		Integer
//   					 1 if it succeeds.
//						 0 if no action was required.
//						-1 if an error occurs.
//
//	Description:  	Causes sorting when the user clicks on the header
//					  	of a datawindow, emulating the WIN95 style.
//					  	Click causes new sort (alternately Asc/Desc if same column).
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.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.
//
//////////////////////////////////////////////////////////////////////////////

string	ls_headername
string 	ls_colname
integer	li_rc
integer	li_suffixlen
integer	li_headerlen
string	ls_sortstring

// Validate the dwo reference.
IF IsNull(adwo_obj) OR NOT IsValid(adwo_obj) THEN	 
	Return -1
END IF 

// Check if the service is set to sort on column headers.
IF NOT of_GetColumnHeader() THEN Return 0

// Only valid on header column.
If adwo_obj.Name = 'datawindow' THEN Return 0
IF adwo_obj.Band <> "header" THEN Return 0

// Get column header information.
ls_headername = adwo_obj.Name
li_headerlen = Len(ls_headername)
li_suffixlen = Len(is_defaultheadersuffix)

// Extract the columname from the header label 
// (by taking out the header suffix).
IF Right(ls_headername, li_suffixlen) <> is_defaultheadersuffix THEN 
	// Cannot determine the column name from the header.	
	Return -1
END IF 	
ls_colname = Left (ls_headername, li_headerlen - li_suffixlen)

// Validate the column name.
If IsNull(ls_colname) or Len(Trim(ls_colname))=0 Then 
	Return -1
End If

// Check the previous sort click.
IF is_sortcolumn = ls_colname THEN	
	// Second sort click on the same column, reverse sort order.
	IF is_sortorder = " A" THEN 	
		is_sortorder = " D"
	ELSE
		is_sortorder = " A"
	END IF 
ELSE
	// Clicked on a different column.
	is_sortcolumn = ls_colname
	is_sortorder = " A" 
END IF 

// Build the sort string.
IF of_GetUseDisplay() And of_UsesDisplayValue(ls_colname) THEN
	ls_sortstring = "LookUpDisplay(" + ls_colname + ") " + is_sortorder 
ELSE
	ls_sortstring = is_sortcolumn + is_sortorder
END IF 

// Perform the SetSort operation (check the rc).
li_rc = of_SetSort (ls_sortstring) 
If li_rc < 0 Then Return li_rc

// Perform the actual Sort operation (check the rc).
li_rc = of_Sort()
If li_rc < 0 Then Return li_rc	
	
Return 1

end event

     
Name Owner
pfc_u_dw.clicked pfc_u_dw

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.left systemfunctions
systemfunctions.len systemfunctions
systemfunctions.right systemfunctions
systemfunctions.trim systemfunctions
pfc_n_cst_dwsrv_sort.of_getusedisplay pfc_n_cst_dwsrv_sort
pfc_n_cst_dwsrv_sort.of_setsort pfc_n_cst_dwsrv_sort
pfc_n_cst_dwsrv_sort.of_sort pfc_n_cst_dwsrv_sort
pfc_n_cst_dwsrv_sort.of_usesdisplayvalue pfc_n_cst_dwsrv_sort
pfc_n_cst_dwsrv_sort.of_getcolumnheader pfc_n_cst_dwsrv_sort

     
Full name
No Data

     
Name Scope
No Data