Changeset 1679 for cprs/trunk/CPRS-Lib/ORFn.pas
- Timestamp:
- May 7, 2015, 12:34:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Lib/ORFn.pas
r829 r1679 36 36 function LowerOf(i, j: Integer): Integer; 37 37 function StrToFloatDef(const S: string; ADefault: Extended): Extended; 38 function RectContains(Rect: TRect; Point: TPoint): boolean; 38 39 39 40 { String functions } … … 41 42 function ContainsAlpha(const x: string): Boolean; 42 43 function ContainsVisibleChar(const x: string): Boolean; 44 function ContainsUpCarretChar(const x: string): Boolean; 43 45 function ConvertSpecialStrings(const x: string): String; 44 46 function CRCForFile(AFileName: string): DWORD; … … 118 120 119 121 { Misc functions } 122 function CPRSInstances: integer; 120 123 { You MUST pass an address to an object variable to get KillObj to work } 121 124 procedure KillObj(ptr: Pointer; KillObjects: boolean = FALSE); … … 124 127 procedure CallWhenIdle(CallProc: TORIdleCallProc; Msg: String); 125 128 procedure CallWhenIdleNotifyWhenDone(CallProc, DoneProc: TORIdleCallProc; Msg: String); 129 126 130 procedure menuHideAllBut(aMenuItem: tMenuItem; butItems: array of tMenuItem); 127 131 function TabIsPressed : Boolean; 128 132 function ShiftTabIsPressed : Boolean; 129 133 function EnterIsPressed : Boolean; 134 procedure ScrollControl(Window: TScrollingWinControl; ScrollingUp: boolean; Amount: integer = 40); 130 135 131 136 implementation // --------------------------------------------------------------------------- … … 387 392 end; 388 393 394 function RectContains(Rect: TRect; Point: TPoint): boolean; 395 begin 396 Result := ((Point.X >= Rect.Left) and 397 (Point.X <= Rect.Right) and 398 (Point.Y >= Rect.Top) and 399 (Point.Y <= Rect.Bottom)); 400 end; 401 389 402 { String functions } 390 403 … … 415 428 Result := False; 416 429 for i := 1 to Length(x) do if x[i] in ['!'..'~'] then // ordinal values 33..126 430 begin 431 Result := True; 432 break; 433 end; 434 end; 435 436 function ContainsUpCarretChar(const x: string): Boolean; 437 { returns true if the string contains the ^ character } 438 var 439 i: Integer; 440 begin 441 Result := False; 442 for i := 1 to Length(x) do if x[i] = '^' then // ordinal values 33..126 417 443 begin 418 444 Result := True; … … 2022 2048 *) 2023 2049 2050 function CPRSInstances: integer; 2051 // returns the number of CPRS sessions open 2052 var 2053 AHandle: hWnd; 2054 LengthText, LengthConst, counter: Integer; 2055 CharText: array [0..254] of Char; 2056 TitleText, TitleCompare: string; 2057 const 2058 TX_IN_USE = 'VistA CPRS in use by: '; // use same as in fFrame 2059 begin 2060 counter := 0; 2061 LengthConst := length(TX_IN_USE); 2062 AHandle := FindWindow(nil, nil); 2063 while AHandle <> 0 do begin 2064 LengthText := GetWindowText(AHandle, CharText, 255); 2065 if LengthText > 0 then 2066 begin 2067 TitleText := CharText; 2068 TitleCompare := copy(TitleText, 1, LengthConst); 2069 if TitleCompare = TX_IN_USE then 2070 counter := counter + 1; 2071 end; 2072 AHandle := GetWindow(AHandle, GW_HWNDNEXT); 2073 end; 2074 Result := counter; 2075 end; 2076 2024 2077 { You MUST pass an address to an object variable to get KillObj to work } 2025 2078 procedure KillObj(ptr: Pointer; KillObjects: boolean = FALSE); … … 2197 2250 end; 2198 2251 2252 procedure ScrollControl(Window: TScrollingWinControl; ScrollingUp: boolean; Amount: integer = 40); 2253 var 2254 Delta: integer; 2255 2256 // This is needed to tell the child components that they are moving, 2257 // The TORCombo box, for example, needs to close a dropped down window when it moves. 2258 // If Delphi had used standard scroll bars, instead of the customized flat ones, this 2259 // code wouldn't be needed 2260 procedure SendMoveMessage(Ctrl: TWinControl); 2261 var 2262 i: integer; 2263 begin 2264 for i := 0 to Ctrl.ControlCount - 1 do 2265 begin 2266 if Ctrl.Controls[i] is TWinControl then with TWinControl(Ctrl.Controls[i]) do 2267 begin 2268 SendMessage(Handle, WM_MOVE, 0, (Top * 65536) + Left); 2269 SendMoveMessage(TWinControl(Ctrl.Controls[i])); 2270 end; 2271 end; 2272 end; 2273 2274 begin 2275 Delta := Amount; 2276 if ScrollingUp then 2277 begin 2278 if Window.VertScrollBar.Position < Delta then 2279 Delta := Window.VertScrollBar.Position; 2280 Delta := - Delta; 2281 end 2282 else 2283 begin 2284 if (Window.VertScrollBar.Range - Window.VertScrollBar.Position) < Delta then 2285 Delta := Window.VertScrollBar.Range - Window.VertScrollBar.Position; 2286 end; 2287 if Delta <> 0 then 2288 begin 2289 Window.VertScrollBar.Position := Window.VertScrollBar.Position + Delta; 2290 SendMoveMessage(Window); 2291 end; 2292 end; 2293 2199 2294 initialization 2200 2295 FBaseFont := TFont.Create;
Note:
See TracChangeset
for help on using the changeset viewer.