Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 36 total
Thread Some Questions About TCheckBox
Thu, Feb 1 2018 6:14 PMPermanent Link

Frederick Chin

Hi,

I am using EWB 2.06b11 and I wonder if someone has answers to the following questions.

1.   Is there a way for the caption to be left aligned?

2.   I use the ENTER key to move from field to field and when the focus lands on the TCheckBox, pressing the ENTER key changes the SelectionState. Is it possible to trap the ENTER key and prevent it from changing the state? I would like the state to change only if the user presses the SPACE bar or clicks the box.

3.   I wonder if the SelectionState is meant to represent the selection status or to set the initial state. Reading earlier forum messages seem to indicate that the TCheckBox has the Checked property.

--
Frederick
Fri, Feb 2 2018 3:57 AMPermanent Link

Matthew Jones

Frederick Chin wrote:

> 1.   Is there a way for the caption to be left aligned?

It is. What do you mean exactly?

> 2.   I use the ENTER key to move from field to field and when the focus lands on the TCheckBox, pressing the ENTER key changes the SelectionState. Is it possible to trap the ENTER key and prevent it from changing the state? I would like the state to change only if the user presses the SPACE bar or clicks the box.

No idea, but probably set by the browser. You might be able to use OnKeyDown to intercept and change behaviour.

> 3.   I wonder if the SelectionState is meant to represent the selection status or to set the initial state. Reading earlier forum messages seem to indicate that the TCheckBox has the Checked property.

It is both initial and then current. Because of the indeterminate state, it had to change from a boolean, so that is old info.

--

Matthew Jones
Fri, Feb 2 2018 4:05 AMPermanent Link

Frederick Chin

"Matthew Jones" wrote:

/*
It is. What do you mean exactly?
*/

Please see attached image.

/*
No idea, but probably set by the browser. You might be able to use OnKeyDown to intercept and change behaviour.
*/

Unfortunately, the TCheckBox does not have the OnKeyDown event.

--
Frederick



Attachments: checkbox.png
Fri, Feb 2 2018 4:46 AMPermanent Link

Matthew Jones

Frederick Chin wrote:

> Please see attached image.

Ah, right. You can probably do that easily by changing the interface file, and the layout order.


> Unfortunately, the TCheckBox does not have the OnKeyDown event.

I was presuming that you'd do it in the form, and deny the key continuing if the current control was the check box. I don't know if it will work, but it is where I'd start for simplicity. After that, I'd look at the code for the checkbox, and perhaps make a custom version, and after that I'd give up. 8-)

--

Matthew Jones
Sun, Feb 4 2018 5:16 PMPermanent Link

Frederick Chin

"Matthew Jones" wrote:

/*
Ah, right. You can probably do that easily by changing the interface file, and the layout order.
*/

I have a policy of not fiddling with the internals of the programming tool I use.

/*
I was presuming that you'd do it in the form, and deny the key continuing if the current control was the check box. I don't know if it will work, but it is where I'd start for simplicity. After that, I'd look at the code for the checkbox, and perhaps make a custom version, and after that I'd give up. 8-)
*/

I don't see how the problem can be resolved since the check box sits within a TGroupPanel and although this object has an OnKeyDown, there is no ActiveControl property. When I press ENTER on the check box, it automagically changes the SelectionState AND moves to the next object. The latter is desired but the former is not because it is now working like my Windows applications.

--
Frederick.
Mon, Feb 5 2018 3:10 AMPermanent Link

Uli Becker

Frederick,

<<
I have a policy of not fiddling with the internals of the programming tool I use.
>>

Modifying an interface has nothing to do with internals of EWB. There is no need to change the original interface. Just copy it to your procect directory or any folder in your search path and modify it so that it fits your needs.
It will apply just for this project.

Uli
Mon, Feb 5 2018 3:43 AMPermanent Link

Matthew Jones

Uli Becker wrote:

> Modifying an interface has nothing to do with internals of EWB. There is no need to change the original interface. Just copy it to your procect directory or any folder in your search path and modify it so that it fits your needs.
> It will apply just for this project.

Indeed, this is the whole point of interfaces - you can "theme" your app exactly as you require using all the usual CSS that you might want.

--

Matthew Jones
Mon, Feb 5 2018 11:25 AMPermanent Link

Frederick Chin

Uli,

/*
Modifying an interface has nothing to do with internals of EWB. There is no need to change the original interface. Just copy it to your procect directory or any folder in your search path and modify it so that it fits your needs.
It will apply just for this project.
*/

So, I could have a single directory of my modified interfaces and any project can reference it while a new build of EWB will not not affect it?

What happens if Tim creates a new TCheckBox version with Alignment and XYZ properties and I also have mine with just the Alignment property? How should I reconcile a situation where I want to keep my alignment property but want the XYZ property?

--
Frederick
Mon, Feb 5 2018 12:24 PMPermanent Link

Uli Becker

Frederick Chin,

> So, I could have a single directory of my modified interfaces and any project can reference it while a new build of EWB will not not affect it?

Correct. I do that with *all* my apps.

> What happens if Tim creates a new TCheckBox version with Alignment and XYZ properties and I also have mine with just the Alignment property? How should I reconcile a situation where I want to keep my alignment property but want the XYZ property?

In that case you may want to modify the new interface again (modifying the alignment is done very quickly).

Uli
Mon, Feb 5 2018 2:05 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Unfortunately, the TCheckBox does not have the OnKeyDown event. >>

That's an oversight on my part.  In the WebBtns unit, just add these two published properties for the TCheckBox (and for any other button controls that you want key events for):

  TCheckBox = class(TStateButtonControl)
     private
        FInputElement: THiddenInputElement;
     protected
        function GetInterfaceClassName: String; override;
        procedure CreateInterfaceElements; override;
        procedure InitializeProperties; override;
        procedure InitializeValues; override;
        function GetInputElement: TInputElement; override;
        function DoClick: Boolean; override;
     published
        property Top;
        property Left;
        property Height;
        property Width;
        property AlwaysOnTop;
        property Animations;
        property AutoWidth;
        property Caption;
        property Constraints;
        property Cursor;
        property DataColumn;
        property DataSet;
        property DisplayOrder;
        property Enabled;
        property Font;
        property Hint;
        property Layout;
        property LayoutOrder;
        property Margins;
        property ReadOnly;
        property SelectionState;
        property TabOrder;
        property TabStop default True;
        property Tag;
        property ValueSelected default BOOL_TRUE;
        property ValueUnselected default BOOL_FALSE;
        property Visible;
        property OnAnimationComplete;
        property OnAnimationsComplete;
        property OnShow;
        property OnHide;
        property OnMove;
        property OnSize;
        property OnKeyDown; <<<<<<<<<<<<<
        property OnKeyUp; <<<<<<<<<<<<<
        property OnClick;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
        property OnMouseEnter;
        property OnMouseLeave;
        property OnTouchStart;
        property OnTouchMove;
        property OnTouchEnd;
        property OnTouchCancel;
        property OnEnter;
        property OnExit;
        property OnChange;
     end;

I've done the same here with the EWB units.

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 4Next Page »
Jump to Page:  1 2 3 4
Image