vdfsplat / AppSrc / cReadOnlyCheckbox.pkg @ 67
History | View | Annotate | Download (1.65 KB)
1 |
//TH-Header |
---|---|
2 |
//***************************************************************************************** |
3 |
// Copyright (c) 2015 Antwise Solutions |
4 |
// All rights reserved. |
5 |
// |
6 |
// $FileName : .\AppSrc\cReadOnlyCheckbox.pkg |
7 |
// $ProjectName : VdfSplat DataFlex Debugger |
8 |
// $Authors : Wil van Antwerpen |
9 |
// $Created : 10.02.2015 18:34 |
10 |
// $Type : GPL v2 |
11 |
// |
12 |
// Contents: As the debugger parts are mostly readonly and there's a lot of checkboxes |
13 |
// this is a control to have a checkbox look like a normal checkbox, but not allow |
14 |
// any changes to it. |
15 |
// |
16 |
// The reasoning here is that disabled checkboxes are a bit hard to read with the |
17 |
// disabled labels. |
18 |
// |
19 |
// I'd say it is a bit of a hack, but it works fine and it at least prevents the |
20 |
// user from accidently changing the value by clicking on it. |
21 |
|
22 |
// Wasn't it also possible with setting default label shadowing? Oh well.. fine for now |
23 |
// and it is probably good that the object can take the focus. |
24 |
//***************************************************************************************** |
25 |
//TH-RevisionStart |
26 |
//TH-RevisionEnd |
27 |
Use Windows.pkg |
28 |
|
29 |
|
30 |
Class cReadOnlyCheckbox is a CheckBox |
31 |
Procedure Construct_object |
32 |
Forward Send Construct_Object |
33 |
|
34 |
Set Skip_State To True |
35 |
|
36 |
Property Boolean pbInPreventChange False |
37 |
End_Procedure |
38 |
|
39 |
|
40 |
Procedure OnChange |
41 |
Boolean bChecked |
42 |
If (Focus(desktop)=Self and pbInPreventChange(Self)=false) Begin |
43 |
Set pbInPreventChange To True |
44 |
Get Checked_State to bChecked // do not change on click! |
45 |
Set Checked_State to (not(bChecked)) |
46 |
Set pbInPreventChange To False |
47 |
End |
48 |
End_Procedure |
49 |
End_Class |
50 |
|