Mainly to display query data in Grid mode, including the following features:
1. Click on the list to sort (optional);
2. When the character position is not displayed, it will automatically use the micro-help display (optional);
3, Chinese prompt when the database is wrong;
Includes the following objects (in order to import):
1, GF_DBERRORMSG
GLOBAL TYPE GF_DBERRORMSG from Function_ObjectTerecTend Type
Forward PrototypeSGlobal Function Integer GF_DBERRORMSG (Long Sqldbcode, String SQlerrtext, Long Row, String As_TY) End Prototype
global function integer gf_dberrormsg (long sqldbcode, string sqlerrtext, long row, string as_ty); // error related data window: Choose Case SQLDBCode Case 1400 If as_ty = "freeform" Then MessageBox ( "message", "look for an empty entry And fill in the content to save! ") Else MessageBox (" Tips Information "," Please find the " String (Row) ", and fill in the content to save! ") Endiff case 1 if as_ty = "freeform" Then MessageBox ("Tip Information", "This record already exists, can not repeat!") Else MessageBox ("Tip Information", "Please check the number string (row) " line, modify Some columns or delete duplicate rows can be saved! ") End if case 3114 MessageBox (" Tips "," No database, it is recommended to re-run the application! ") Case -193 if as_ty =" freeform "the messagebox (" Tip " Information "," This record already exists, you can't repeat! ") Else MessageBox (" Tip Information "," Please check the " string (ROW) " line, modify a column or delete the repetition line can save! ") End if case -195 // Required value is null. If as_ty =" freeform "the MessageBox (" Tips "," Please find the empty item, and fill in the content, to save! ") Else MessageBox (" Tips Information "," Please find the " String (ROW) " line air column, and fill in the content can be saved! ") End if case -3 messagebox (" note information "," the original data has been modified by other users, please After retriere, save it! ") Case 2601 MessageBox (" Note Information "," Primary Key Record Duplicate, Cannot Save! ") Case 233 MessageBox (" Note Information "," Primary Key Record is empty, can not save! ") Case 1105 / / Sybase ?? MessageBox ("Note Information", "Database Logging, Please inform System Administrator Qing Dynasty!") Case 2627 MessageBox ("Note Information", "Your new record already exists, insert failure! Maybe it is a network conflict, please a little Before doing this.
") Case -932 MessageBox (" Payer Information "," Please check if the network is working fine! ") Case 10004 MessageBox (" Note Information "," Please check if the database is working fine! ") Case 999 MessageBox (" note information ", "Please check if the server is working properly!") Case Else MessageBox ("Database Tips:", "Error Row:" String (Row) ", Error Information:" SQlerrtext "Sqldbcode:" String (Sqldbode)) End Choosereturn 1
END FUNCTION
2, N_CST_DWSRV_GRIDSORT
Forwardglobal Type n_cst_dewsrv_gridsort from NonvisualObject Teyend Forward
global type n_cst_dwsrv_gridsort from nonvisualobjectevent type long ue_lbuttondown (unsignedlong flags, integer xpos, integer ypos) event type long ue_lbuttonup (unsignedlong flags, integer xpos, integer ypos) end typeglobal n_cst_dwsrv_gridsort n_cst_dwsrv_gridsort
Type PrototypeSfunction Ulong SetCapture (Ulong Hwnd) library "user32.dll" Function Boolean ReleaseCapture () library "user32.dll"
End protoypes
type variablesPrivate: DataWindow idw_requestor string i_str_oldcolumn // last click to sort the column name string i_str_newcolumn // this sort click a column name string i_str_arrowname // Sort the small triangle symbol name string i_str_sort used = 'A' // sort is the last time Ascending (a) or descending (b) string i_Str_flag = '0' // Whether the correct mouse has been executed (0- No, 1- Y)
End variables
Forward PrototypeSpublic Function Integer of_SetRequestor (DataWindow Adw_Requestor) End Prototypes
Event Type Long UE_LButtondown (Unsignedlong Flags, Integer Xpos, Integer Ypos); String Str_Band, Str_Object, Str_Title, Str_Columnint Li_X
STR_BAND = IDW_REQUESTOR.GETBANDATPOINTER () // Get the belt str_band = left (Str_Band, (POS (Str_BAND, '~ T') - 1)) IF STR_BAND <> 'Header' TEN RETURN 0 / / Click the non-head area, exit STR_Object = IDW_REQUESTOR.GETObjectatpointer () // Get the name STR_Object = Left of the current mouse referred to (Str_Object, (POS (Str_Object, '~ t') - 1))))))) ife / o je = 'or' OR ISNULL (STR_OBJECT) THEN RETURN 0 // Not received, exit if right (str_object, 4) = '_lag' THEN / / Click on a small triangle symbol object, indicating that the last click of the column STR_TILE = Left (Str_Object, (Len (STR_OBJECT) - 4)) Else // First click on the column str_title = str_objectenD IF // Get column object name (default is column name _t as column headings) STR_COLUMN = Left (str_title, (len (str_title) - 2) ) // Determine if the name is column name if idw_requestor.describe (STR_COLUMN ") = '!' Ten Return 0 // is not column name, that is, the title is not named according to the normal law. // columns junction, be possible to adjust the width of columns Status li_x = integer (idw_requestor.Describe (str_object ". X")) if String (idw_requestor.Object.DataWindow.HorizontalScrollSplit) = '0' then if xpos integer (idw_requestor . Object.dataWindow.horizontalscrollPosition - li_x <= 6 Then Return 0 end ifendiff
I_STR_NEWCOLUMN = STR_COLUMN / / Get the currently clicked column IDW_REQUESTOR.MODIFY (STR_TITLE ". Border = '5') // Set Diagnostics I_STR_FLAG = '1' // Start Click Event // Set Mouse Capture SetCapture (Handle (IDW_Requestor) // Transfer the motion of the mouse to the specified DW window Return 0
End Event
event type long ue_lbuttonup (unsignedlong flags, integer xpos, integer ypos); String str_title, str_object, str_tmp, str_column, str_sortLong lng_posy, lng_left, lng_top, lng_right, lng_bottom
LNG_POSY = YPOSSTR_OBJECT = IDW_REQUESTOR.GETOBJECTATPOINTER () ReleaseCapture () // must first release the mouse to be captured by the data window
str_title = i_str_newcolumn '_ t'If i_str_flag =' 1 'Then lng_left = Long (idw_requestor.Describe (str_title ". x")) lng_top = Long (idw_requestor.Describe (str_title ". y")) lng_right = lng_left Long (idw_requestor .Describe (str_title ". width")) lng_bottom = lng_top Long (idw_requestor.Describe (str_title ". height")) str_object = Left (str_object, (Pos (str_object, '~ t') - 1)) If Not ( Str_Object = '' or isnull (STR_Object)) THEN / / Get Click Object if Right (Str_Object, 4) = '_lag' THEN / / Click on the arrow object, indicating that the last hit Str_TMP = Left (STR_OBJECT (LEN (STR_OBJECT) - 4)) ELSE // First click this column STR_TMP = STR_Object End if if str_tmp = STR_TITLE THEN / / Description is to discharge the mouse // to judge whether or not the last click of the column on the column column, and Sort I_STR_OLDCOLUMN = I_STR_NEWCOLUMN THEN / / The last click is also the column if i_str_sort = 'A' TEN STR_SORT = 'D' STR_TMP = '6' else str_sort = 'a' STR_TMP = '5' end if else // last time Click not to this column str_sort = 'a' str_tmp = '5' end if // Does there is no full removal arrow object IDW_Requestor.Modify ("Destroy" i_STR_ARROWNAME) i_STR_ARROWNAME = STR_TITLE '_ lag' // Generate new Arrow Object Name = Title_Lag Str_TMP = 'Create Text (Band = Header Alignment = "0" TEXT = "' Str_TMP '" Border = "0" Color = "16711680" x = " string (LNG_LEFT) '"y =" string (LNG_TOP) ' "Height =" ' string (LNG_BOTTOM - LNG_TOP) ' "Width =" 10 "Name = ' i_STR_ARROWNAME Visible =" 1 "
Font.face = "WebDings" font.height = "- 12" font.weight = "400" font.family = "1" font.pitch = "2" font.charset = "2" background.mode = "1" background.color = "553648127") 'idw_requestor.Modify (str_tmp) str_tmp = i_str_newcolumn ' ' str_sort idw_requestor.SetSort (str_tmp) idw_requestor.Sort () i_str_oldcolumn = i_str_newcolumn i_str_newcolumn =' 'i_str_sort = str_sort End If End IfEnd Ifidw_requestor.Modify (str_title ". border = '6'") i_Str_flag = '0'Return 0nd Event
Public Function Integer of_SetRequestor; if isnull (adw_requestor) or not isvalid (adw_requestor) Then Return -1END IF
IDW_REQUESTOR = Adw_Requestorreturn 1END FUNCTION
ON N_CST_DWSRV_GRIDSORT.CREATECALL SUPER :: Createtriggerevent (this, "constructor") End on
ON N_CST_DWSRV_GRIDSORT.DESTROYTRIGEREVENT (this, "destructor") Call Super :: destroynd on
Event constructor; // Click the column title to sort the column End Event
3, NVO_ToolTIPS
forwardglobal type nvo_tooltips from nonvisualobjectend typetype point from structure within nvo_tooltipsend typetype msg from structure within nvo_tooltipsend typetype rect from structure within nvo_tooltipsend typetype toolinfo from structure within nvo_tooltipsend typeend forward
Type Point from Structure Long X Long Yend Type
Type Msg from Structure Long HWND Long Message Long WParam Long LPARM Long Time Point Ptend Type
Type Rect from Structure Long LEFT Long Top Long Right Long Bottomend Type
Type Toolinfo from Structure Long Cbsize Long Uflags Long HWND Long Uid Rect Rect Long Hinstance String Lpsztextend Typeglobal Type NVO_Tooltips from NonvisualObject AutoInstantiateEnd Type
type prototypes // ToolTips function SubRoutine InitCommonControls () library "comctl32.dll" Function long CreateWindowExA (ulong dwExStyle, string ClassName, & long WindowName, ulong dwStyle, ulong X, ulong Y, ulong nWidth, & ulong nHeight, ulong hWndParent, ulong hMenu, ulong hInstance, & ulong lpParam) library "user32.dll" Function integer DestroyWindow (long hWnd) library "user32.dll" Function integer ToolTipMsg (long hWnd, long uMsg, long wParam, & REF TOOLINFO ToolInfo) library "user32. dll "Alias For" SendMessageA "Function integer RelayMsg (long hWnd, long uMsg, long wParam, & REF MSG Msg) library" user32.dll "Alias For" SendMessageA "Function uLong SendMessageString (uLong hwnd, uLong Msg, uLong wParam, Ref String lpzString) Library "user32.dll" Alias For "SendMessageA" fUNCTION ulong ShowWindow (ulong hwnd, ulong nCmdShow) LIBRARY "user32.dll" // memory management functions // function long LocalAlloc (long Flags, long Bytes) library "kernel32 .dll "// Function Long Localfree (Long Memhandle) Library" kene "kerne L32.dll "// Function Long Lstrcpy (long desination, string source) library" kernel32.dll "
Function Ulong IswindowVisible (Ulong Hwnd) library "user32.dll" end prototypes
Type Variables // Private constant private:
// Miscellaneous constant CONSTANT string TOOLTIPS_CLASS = 'tooltips_class32'CONSTANT ulong CW_USEDEFAULT = 2147483648CONSTANT long WM_USER = 1024CONSTANT long WS_EX_TOPMOST = 8CONSTANT long WM_SETFONT = 48
// ToolTip MessagesConstant long TTM_ADDTOOL = WM_USER 4Constant long TTM_DELTOOL = WM_USER 5Constant long TTM_NEWTOOLRECT = WM_USER 6Constant long TTM_RELAYEVENT = WM_USER 7Constant long TTM_POPUP = WM_USER 34 Constant long TTM_UPDATE = WM_USER 29Constant long TTM_UPDATETIPTEXT = WM_USER 12Constant long TTM_TRACKACTIVATE = WM_USER 17Constant long TTM_TRACKPOSITION = WM_USER 18Constant long TTM_SETMAXTIPWIDTH = 1048Constant long TTM_GETMAXTIPWIDTH = WM_USER 25Constant long TTM_SETTIPBKCOLOR = WM_USER 19Constant long TTM_SETTIPTEXTCOLOR = WM_USER 20Constant long TTM_SETTITLEA = WM_USER 32 // Tooltip flagsConstant integer TTF_CENTERTIP = 2Constant integer TTF_RTLREADING = 4Constant integer TTF_SUBCLASS = 16Constant integer TTF_TRACK = 32Constant integer TTF_ABSOLUTE = 128Constant integer TTF_TRANSPARENT = 256Constant integer TTF_DI_SETITEM = 32768Constant integer TTS_BALLOON = 64 // Title ConstantsConstant integer TTI_NONE = 0Constant integer TTI_INFO = 1C OnStant Integer TTI_WARNING = 2Constant Integer TTI_ERROR = 3 // Public Variables and constants public: long hwndt = 0 // Tooltip control window handlelong Toolid = 1 // Tooltip Internal ID
Constant Integer Style_normal = 0constant Integer Style_balloontip = 1integer TipStyle
End variables
forward prototypespublic subroutine setfont (long hfont) public subroutine settipposition (integer x, integer y) public subroutine settrack (dragobject object, integer uid, boolean status) public subroutine updatetiprect (dragobject object, long uid, long left, long top, long right, long bottom) public function integer addtool (dragobject object, string tiptext, integer flags) public subroutine hidetip (dragobject controlobject) public subroutine settiptext (dragobject object, long uid, string tiptext) public subroutine setmaxwidth (long al_maxwidth) public function integer removetool (dragobject ado_object, integer ai_toolid) public subroutine settiptitle (integer ai_icon, string as_title) public subroutine settipbkcolor (long aul_color) public subroutine relaymsg (dragobject object) public function boolean tipvisible () public subroutine relaymsg (dragobject object, long wordparm, integer longparm) end prototypespublic Subroutine setFont (long hfont); // This function is used to set the font of the Tooltips window, the code is as follows:
Send (HWNDTT, WM_SETFONT, HFONT, 1)
End subroutine
Public Subroutine Settipposition (Integer X, Integer Y); // This function is used to set the location of the tooltips, the code is as follows:
Send (hwndt, ttm_trackposition, 0, long (x, y))
End subroutine
Public Subroutine SetTrack (Dragobject Object, Integer Uid, Boolean Status); // This function is used to activate or cancel the Tooltips window to set new text. The code is as follows: // When the parameter status is activated, cancel when false
ToolInfo ToolInfo
Toolinfo.cbsize = 40toolinfo.hwnd = Handle (Object) Toolinfo.uid = UID
IF status dam h e e e e e e e e e e e e e e e e i e
End subroutine
Public Subroutine UpdateTipRect (Dragobject Object, Long Uid, Long Bottom); // This function is used to update the Tooltips rectangular box, the code is as follows: ToolInfo ToolInfo
TOOLINFO.HWND = Handle (Object) Toolinfo.uid = UID
Toolinfo.rect.Rect.top = TopToolinfo.Rect.Right = righttoolinfo.Rect.bottom = bottom
Tooltipmsg (HWNDTT, TTM_NewToolRect, 0, ToolInfo)
End subroutine
public function integer addtool (dragobject object, string tiptext, integer flags); // This function is used to display control register ToolTips code is as follows: If hWndTT <= 0 Then If TIPSTYLE = STYLE_BALLOONTIP Then hWndTT = CreateWindowExA (WS_EX_TOPMOST, TOOLTIPS_CLASS, 0, TTF_CENTERTIP TTS_BALLOON, & CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, & 0, 0, Handle (GetApplication ()), 0) Else hWndTT = CreateWindowExA (WS_EX_TOPMOST, TOOLTIPS_CLASS, 0, TTF_CENTERTIP, & CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, & 0, 0, Handle (GetApplication ()), 0) End IFEND IF
ToolInfo ToolInfo
TOOLINFO.cbSize = 40TOOLINFO.uFlags = FlagsTOOLINFO.hWnd = Handle (Object) TOOLINFO.hInstance = 0TOOLINFO.uID = ToolIDToolID TOOLINFO.lpszText = tiptext // LStrCpy (ToolInfo.lpszText, Left (tiptext, 80))
TOOLINFO.Rect.Left = 0TOOLINFO.Rect.Top = 0TOOLINFO.Rect.Right = UnitsToPixels (Object.Width, XUnitsToPixels!) TOOLINFO.Rect.Bottom = UnitsToPixels (Object.Height, YUnitsToPixels!)
If Tooltipmsg (HWNDTT, TTM_ADDTOOL, 0, TOOLINFO) = 0 THEN // MessageBox ("Error", "You cannot register" (-1) end if
//Localfree (ToolInfo.lpsztext) // Release the allocated memory return (Toolid - 1)
END FUNCTION
public subroutine hidetip (dragobject controlobject); MSG MSGMSG.hWnd = Handle (ControlObject) MSG.Message = 513 // WM_LBUTTONDOWNMSG.WParam = Message.WordParmMSG.Lparam = Message.LongParmRelayMsg (hWndTT, TTM_RELAYEVENT, 0, MSG)
End subroutine
Public Subroutine Settiptext (Dragobject Object, long Uid, String Tiptext); // This function is used to set new text for the Tooltips window, the code is as follows:
ToolInfo ToolInfo
TOOLINFO.HWND = Handle (Object) Toolinfo.uid = uidtoolinfo.lpsztext = Tiptext
Tooltipmsg (HWNDTT, TTM_UPDATETIPTEXT, 0, TOOLINFO)
End subroutine
Public subs (long al_maxwidth); / **************************************************** *******************************************
Function: of_setmaxwidth
Description: Sets the maximum tooltip width. If the text is longer it will splitted over more than one line.
Returns: (NONE)
Arguments: long al_maxwidth
Use: Call to set the maximum width.
-------------------------------------------------- -----------------------------
Auteur: AART ONNHOUT
Revision History ------------------- Date Version 15-05-2000 1.0 Initial Version
*********************************************************** *************************** /
Send (HWNDTT, TTM_SETMAXTIPWIDTH, 0, UnitStopixels (al_maxwidth, xunitstopixels!))
Returnend Subroutine
Public Function Integer Removetool (Dragobject ADO_Object, Integer Ai_Toolid); / ***************************************************** ************************************************
Function: of_removetool
Description: Unregisters a Control Withnin The Tooltip Control
Returns: (NONE)
Arguments: Dragobject Ado_Object Object To Unregister Withnin The Tooltip Control Integer Ai_Toolid Tool ID (Returned By_Addtool)
USE:
-------------------------------------------------- ---------------------------- Auteur: AART ONNWENHOUT
Revision History ------------------- Date Version 29-06-2001 1.0 Initial Version
*********************************************************** *************************** /
Toolinfo Toolinfointeger Li_Width, LI_HEIGHT
Toolinfo.cbsize = 40toolinfo.uflags = 16 // flags toolinfo.hwnd = Handle (ado_object) ToolInfo.Hinstance = 0 // not buy toolinfo.uid = AI_TOOLID
Tooltipmsg (HWNDTT, TTM_DELTOOL, 0, TOOLINFO)
Return 1
END FUNCTION
Public subrutine settitle (integer ai_icon, string as_title); / ************************************************ ***********************************************
Function: of_settiptitle
Description: Sets the title of the tooltip
Returns: (NONE)
Arguments: Integer Ai_ICON VALUES: TTI_NONE = 0 TTI_INFO = 1 TTI_WARNING = 2 TTI_ERROR = 3 string as_title
Use: Call with the desired title and icon.
-------------------------------------------------- -----------------------------
Auteur: AART ONNHOUT
Revision History ------------------ Date Version 10-05-2001 1.0 Initial Version
*********************************************************** *************************** /
SendMessageString (HWNDTT, TTM_SETTILEA, AI_ICON, AS_TILE) End Subroutine
Public Subroutine settipkcolor (long aul_color); / *************************************************** *******************************************
Function: OF_SETTIPBKCOLOR
Description: sets the backgroundcolor of the tooltip-window
Returns: (NONE)
Arguments: ulong aul_color
Use: Call with the desired color
-------------------------------------------------- -----------------------------
Auteur: AART Onkenhoutrevision History ------------------- Date Version 10-05-2001 1.0 Initial Version
*********************************************************** *************************** /
Send (HWNDTT, TTM_SETTIPBKCOLOR, AUL_COLOR, 0) End Subroutine
Public Subroutine RelayMSG (DragObject Object); // This function is used to send control messages to the display Tooltips window, the code is as follows: MSG MSG
Msg.hwnd = Handle (Object) // WM_MouseMovemsg.Message = 512msg.wParam = message.wordparmmsg.lparam = message.longparm
Relaymsg (HWNDTT, TTM_RELAYEVENT, 0, MSG)
End subroutine
Public function boolean tipvisible (); if iswindowvisible (hwndt)> 0 THEN RETURN TRUE
Return False
END FUNCTION
Public Subroutine RelayMSG (Dragobject Object, Long WordParm, Integer Longparm); // This function is used to send control messages to the display Tooltips window, the code is as follows: MSG MSG
Msg.hwnd = handle (object) // wm_mousemovemsg.Message = 512msg.wparam = wordparmmsg.lparam = longparm
Relaymsg (HWNDTT, TTM_RELAYEVENT, 0, MSG)
End subroutine
On NVO_Tooltips.createCall Super :: Createtriggerevent (this, "constructor") End on
ON NVO_TOOLTIPS.DESTROYTROYTRIGEREVENT (this, "destructor") Call Super :: destroynd ON
Event constructor; // Structure Point For transmitting coordinate // Structure MSG Used to transmit message // Structure RECT for transmitting a position // structure for transmitting a rectangle box for transmitting messages related to ToolTips
// Usage // / Define instance variables: // nca_tooltips invo_tooltip
// WINDOW OPEN Event: // Register To display the control //invo_tooltip.addtool //invo_tooltip.addtool //invo_tooltip.addtool (SLE_TOOLTIP.ADDTOOL (SLE_PASSWORD, "Please enter the login password", 0) / / Need to prompt, in custom UE_MOUSEMOVE event (PBM_MOUSEMOVE): //invo_tooltip.relaymsg (this) //
INITCOMMONCONTROLS ()
End Event
Event destructor; if hwndtt> 0 Then DestroyWindow (HWNDT) End Event
4, N_CST_DWSRV_AUTOHINT
forwardglobal type n_cst_dwsrv_autohint from nonvisualobjectend typetype logfont from structure within n_cst_dwsrv_autohintend typetype textsize from structure within n_cst_dwsrv_autohintend typeend forwardtype logfont from structure long lfHeight long lfWidth long lfEscapement long lfOrientation long lfWeight character lfItalic character lfUnderline character lfStrikeOut character lfCharSet character lfOutPrecision character lfClipPrecision character lfQuality character lfPitchAndFamily string lfFaceNameend Type
Type Textsize from Structure Long L_cx long l_cynd type
global type n_cst_dwsrv_autohint from nonvisualobjectevent type long ue_mousemove (unsignedlong flags, integer xpos, integer ypos) event type long resize (unsignedlong sizetype, integer newwidth, integer newheight) end typeglobal n_cst_dwsrv_autohint n_cst_dwsrv_autohint
type prototypesFUNCTION ulong GetDC (ulong hwnd) LIBRARY "user32.dll" FUNCTION ulong ReleaseDC (ulong hwnd, ulong hdc) LIBRARY "user32.dll" FUNCTION ulong SelectObject (ulong hdc, ulong hObject) LIBRARY "gdi32.dll" FUNCTION ulong DeleteObject ( ulong hObject) LIBRARY "gdi32.dll" FUNCTION ulong CreateFontIndirect (ref LOGFONT lpLogFont) LIBRARY "gdi32.dll" ALIAS FOR "CreateFontIndirectA" FUNCTION ulong GetTextExtentExPoint (ulong hdc, ref string lpszStr, ulong cchString, ulong nMaxExtent, ref ulong lpnFit, ref ulong alpDx, ref textSIZE lpSize) LIBRARY "gdi32.dll" ALIAS FOR "GetTextExtentExPointA" FUNCTION ulong GetTextExtentPoint32 (ulong hdc, ref string lpsz, ulong cbString, ref textSIZE lpSize) LIBRARY "gdi32.dll" ALIAS FOR "GetTextExtentPoint32A" Function long MulDiv (Long nnumber, long nndenator) library "kernel32.dll" Function Ulong getDevicecaps (Ulong HDC, Ulong Nindex) library "gdi32.dll" end prototype
TYPE VARIABLESPRIVATE: DATAWINDOW IDW_REQUESTOR NVO_TOOLTIPS TOOLTIP STRING IS_PRIOR_DWO
End variables
forward prototypespublic function long of_gettextwidth (string as_colname, string as_text) public subroutine of_replacestring (ref string as_src, string as_oldstr, string as_newstr) public function integer of_setrequestor (datawindow adw_requestor) end prototypes
Event Type Long UE_MOUSEMOVE (unsignedlong flags, integer xpos, integer ypos); string ls_dwo, ls_col, ls_textlong ll_rowint li_posls_dwo = IDW_REQUESTOR.GETOBJECTATPOINTER ()
IF is_prior_dwo = ls_dwo the return 0ELSE IS_PRIOR_DWO = LS_DWOEND IF
If Tooltip.tipvisible () or Flags <> 0 Tooltip.hidetip (IDW_REQUESTOR) END IF
Li_POS = POS (LS_DWO, "~ T") IF Li_POS <= 0 THEN RETURN 0LS_COL = Left (ls_dwo, li_pos - 1) LL_ROW = long (MID (Ls_DWO, LI_POS 1)))
If idw_requestor.describe (ls_col ". Type") <> "column" Then Return 0 // is not a column object
Long ll_width, ll_needWidth, ll_xString ls_editStyll_width = Long (idw_requestor.Describe (ls_col ". Width")) ll_x = Long (idw_requestor.Describe (ls_col ". X")) ls_editSty = idw_requestor.Describe (ls_col ". Edit.Style")
If ls_editSty = "editmask" Then // There mask Int li_colNum String ls_mask li_colNum = Integer (idw_requestor.Describe (ls_col ". ID")) ls_mask = idw_requestor.Describe (ls_col ". EditMask.Mask") If Left (idw_requestor. Describe (LS_COL ". ColType"), 4) = "char" THEN // Character mask // characters can be converted to numbers (String directly (s, "##") is below_replacestring (ls_mask, " # "," @ ") Ls_text = string (idw_requestor.object.data [ll_row, li_colnum], ls_mask) ELSE / Other type mask MessageBox (", ls_mask) ls_text = string (idw_Requestor.Object.data [ll_row, LI_COLNUM], LS_MASK) End ifelse // Current Row Column (Easy DDDW, DDLB Get Display Value) LS_Text = IDW_REQUESTOR.DESCRIBE ("Evaluate (" EvaluPdisplay) ', " String (LL_ROW) ") " ) End IF
// Need a width ll_needwidth = of_gettextwidth (ls_col, ls_text)
If ls_editsty = "checkbox" or ls_editsty = "radiobuttons" the // These two types need to add an additional value ll_needwidth = 86END IF
// column width is not enough or is located in the rightmost column of the display, only the display part If ll_width
End Event
event type long resize (unsignedlong sizetype, integer newwidth, integer newheight);! If sizetype <> 1 Then Tooltip.updatetiprect (idw_requestor, Tooltip.ToolID - 1, 0,0, & UnitsToPixels (idw_requestor.Width, XUnitsToPixels), UnitsToPixels ( IDW_REQUESTOR.HEIGHT, YUNITSTOPIXELS!) End IF
Return 0
End Event
public function long of_gettextwidth (string as_colname, string as_text); // The column name and text, the text resulting display width of the font information // Int li_charsetli_charset = Integer (idw_requestor.Describe (as_colName "Font.CharSet.")) Int li_Escapementli_Escapement = Integer (idw_requestor.Describe (as_colName ". Font.Escapement")) String ls_Facels_Face = idw_requestor.Describe (as_colName ". Font.Face") Int li_Familyli_Family = Integer (idw_requestor.Describe (as_colName ". Font.Family")) Int li_heightli_height = Integer (idw_requestor.Describe (as_colName ". Font.Height")) Int li_Italicli_Italic = Integer (idw_requestor.Describe (as_colName ". Font.Italic")) Int li_Pitchli_Pitch = Integer (idw_requestor.Describe (as_colName ". Font.Pitch ")) Int li_Strikethroughli_Strikethrough = Integer (idw_requestor.Describe (as_colName ". Font.Strikethrough ")) Int li_Underlineli_Underline = Integer (idw_requestor.Describe (as_colName ". Font.Underline ")) Int li_Weightli_Weight = Integer (idw_requestor.Describe (as_colName " .FONT.WEIGHT ") INT Li_WIDTHLI_WIDTH = INTEGER (IDW_REQ UESTOR.DESCRIBE (AS_COLNAME ")") Long LL_NewFont, LL_OLDFONT, LL_HDCLOGFONT LST_FONT
lst_Font.lfWeight = li_Weightlst_Font.lfWidth = li_WidthIf li_Italic = 1 Then lst_Font.lfItalic = Char (255) Else lst_Font.lfItalic = Char (0) End IfIf li_Underline = 1 Then lst_Font.lfUnderline = Char (1) Else lst_Font.lfUnderline = Char (0) End IfIf li_Strikethrough = 1 Then lst_Font.lfStrikeOut = Char (1) Else lst_Font.lfStrikeOut = Char (0) End If // DEFAULT_CHARSETlst_Font.lfCharSet = Char (li_charset) lst_Font.lfOutPrecision = Char (0) lst_Font.lfClipPrecision = Char (0) LST_FONT.LFQUALITY = Char (0) LST_FONT.LFPITCHANDFAMILY = Char (0) LST_FONT.LFFACENAME = LS_FACELL_HDC = GETDC (Handle (IDW_Requestor)) // Take the right to transition into the right of the device into the device Logic Size // Logpixelsy = 90 // Muldiv: ABS (LI_HEIGHT) * GetDeviceCaps (LL_HDC, 90) /72LST_FONT.LFHEIGHT = - MULDIV (ABS (LI_HEIGHT), GETDEVICECAPS (LL_HDC, 90), 72) // Specified attribute Create logical fonts ll_newfont = createfontindirect (LST_FONT) // Select LL_OLDFONT = SELECTOBJECT (LL_HDC, LL_NEWFONT)
TextSize lstr_Size // determine the size of the string GetTextExtentpoint32 (ll_hdc, as_text, Len (as_text), lstr_Size) // restore SelectObject (ll_hdc, ll_oldFont) // release resources DeleteObject (ll_newFont) ReleaseDC (Handle (idw_requestor), ll_hdc)
// Return the width (Unit unit) Return Pixelstounits (lstr_size.l_cx, xpixelstounits!)
END FUNCTION
Public Subroutine of_ReplaceString (Ref strout as_src, string as_oldstr); int start_pos = 0 // Find the first pcurrence of old_str.start_pos = POS (as_src, as_oldstr)
// Only enter the loop if you find old_str.Do While start_pos> 0 // Replace old_str with new_str. As_src = Replace (as_src, start_pos, & Len (as_oldstr), as_newstr) // Find the next occurrence of old_str. Start_pos = POS (as_src, as_oldstr, & start_pos len (as_newstr)) loop
End subroutine
Public Function Integer of_SetRequestor; if isnull (adw_requestor) or not isvalid (adw_requestor) Then Return -1END IF
IDW_REQUESTOR = Adw_Requestor
Tooltip.addtool (Adw_Requestor, ", 0) Return 1
END FUNCTION
ON N_CST_DWSRV_AUTOHINT.CREATECALL SUPER :: Createtriggerevent (this, "constructor") End on
ON N_CST_DWSRV_AUTOHINT.DESTROYTRIGEREVENT (this, "destructor") Call Super :: destroynd ON
5, UO_DW_QUERY
Forwardglobal Type UO_DW_QUERY from DataWindowend TypeEnd Forward
global type uo_dw_query from datawindowinteger width = 1797integer height = 712integer taborder = 1boolean hscrollbar = trueboolean vscrollbar = trueboolean livescroll = trueborderstyle borderstyle = stylelowered! event mousemove pbm_mousemoveevent ue_mouseup pbm_lbuttonupevent ue_lbuttondown pbm_lbuttondownevent ue_mousemove pbm_mousemoveend typeglobal uo_dw_query uo_dw_query
Type PrototypeSfunction Ulong SetCapture (Ulong Hwnd) library "user32.dll" Function Boolean ReleaseCapture () library "user32.dll" function ulong getcapture () library "user32.dll"
End protoypes
Type variablespublic: boolean sortafterclickonhead = true boolean autohint = falseprivate: n_cst_dewsrv_gridsort inf_gridsort n_cst_dwsrv_autohint inv_antohintend variables
Event UE_MOUSEUP; if SortafterClickonHeader and isvalid (Inv_Gridsort) THEN INV_GRIDSORT.EVENT UE_LBUTTONUP (Flags, XPOS, YPOS) Endiff
End Event
Event ue_lbuttondown; if sortafterclickonheader and isvalid (INV_GRIDSORT) THEN INV_GRIDSORT.EVENT UE_LBUTTONDOWN (Flags, XPOS, YPOS) endiff
End Event
Event UE_MOUSEMOVE; if Autohint and isvalid (INV_ANTOHINT) THEN INV_ANTOHINT.EVENT UE_MOUSEMOVE (Flags, XPOS, YPOS) End ifend evenet
ON UO_DW_QUERY.CREATEEND ON
ON UO_DW_QUERY.DESTROYEND ON
Event constructor; setTransObject (SQLCA)
If SortAfterClickOnHeader Then inv_gridSort = Create n_cst_dwsrv_gridSort inv_gridSort.of_SetRequestor (This) End IfIf AutoHint Then inv_antohint = Create n_cst_dwsrv_autoHint inv_antohint.of_SetRequestor (This) End If
End Event
Event rowfocuschanged; //
End Event
Event clicked; if row <> 0 dam .setrow (row) end fnd evenet
Event dberror; if sqldbcode = -1 Then INT Li_RTN // Reconnects successfully, return Li_RTN = setTransObject (SQLCA) if Li_RTN = 1 THEN RETURN 1END IF
// display different message according the datawindow is freeform or notIf This.Object.datawindow.processing = "0" Then gf_dberrormsg (SQLDBCode, SQLErrText, row, "freeform") Else gf_dberrormsg (SQLDBCode, SQLErrText, row, "") End Ifsqlca .Sqlcode = -1return 1
End Event
EVENT DESTRUCTOR; if isvalid (Inv_Gridsort) Then Destroy INV_GRIDSORTEND IF
IF isvalid (INV_ANTOHINT) THEN DESTROY INV_ANTOHINTEND IF
End Event
Event ITEMERROR; STRING LS_COLUMN, LS_MESSAGE
if trim (data) = "" then return 3 end ifls_column = dwo.namels_message = this.describe (ls_column ".validationmsg") if trim (ls_message) <> "?" then messagebox ( "message", ls_message) return 3ELSE MessageBox ("Tips Information", "This data is not legal!") Return 3 IF
/ * Each return value: 0-Reject this value, display error message 1 - Reject this value, but does not display error message 2 - Accept this value. 3 - Reject this value, but allow changing the focus, replacing the new value with the original value * / Event