Jump to content

[2.9.9.67] TW3 Components event CSS handlers


Recommended Posts

Hi, 

Bug #1 - tw3panel vs tw3button

I've encountered a discrepancy with how the css is applied to different components. 
In this example the :active selector in the css doesn't work on the button but does work for other selectors like :hover. :active also works on tw3panel for example.

:active -> green
:hover -> red
normal -> blue

Bug #2 - toggle button

As a work around of not being able to use :selected in the past I was using two css classes and switching the StyleClass of the component onClick to create essentially a Toggle Button. This has now broken for some reason in the latest patch on android but not iOS devices. The android issue can be recreated on a computer as well using the demo link and chrome mobile dev tools.

It seems to be that to get the onclick to fire properly and switch the css as intended one must hold down on the button for some time, tapping doesn't work, this is not an issue on iOS or Desktop use.

An example of the onclick:

procedure TNWToggleButton.CheckBoxClick(Sender: TObject);
begin     // sets css class and checked boolean to Mark toggle status
  if TNWToggleButton(Sender).Checked then begin           // On
    TNWToggleButton(Sender).StyleClass := OffCssClass;
    Checked := False;
  end
  else begin
    TNWToggleButton(Sender).StyleClass := OnCssClass;    // Off
    Checked := True;
  end;
end;

Please also let me know if there is a better way of achieving what i'm trying to do here.

Demo
Source

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...