Jump to content

JS Coding on client side


paul.coshott

Recommended Posts

Hi All,

As I'm new to uniGUI, I wrote my first web app using just pascal. Now i have the app hosted, it's easy to see where the interface needs speeding up. So I need to replace some pascal event handlers with JS code. Other than asking on these forums what JS code is needed to replace the pascal code, is there anywhere else I can learn the JS calls I can use in uniGUI?

For today though, I have 2 panels that allow the user to choose between AM and PM. When they click the panel, it changes color to the selected color, and changes the other panel's color to the unselected color. How and where do I do the following in JS?

procedure TfTimeEditor.pAMClick(Sender: TObject);
begin
  panelAM.Color := $0048B9F7;
  panelAM.Tag := 1;
  panelPM.Color := $00F1F0F0;
  panelPM.Tag := 0;
end;

Thanks for any help,

Paul

Delphi 10.2 Pro, uniGUI 1.9.0.1502 Complete Professional, Windows 10 Pro

Link to comment
Share on other sites

Hi,

For your case, you can try to use the following JS code.

5 hours ago, paul.coshott said:

When they click the panel, it changes color to the selected color, and changes the other panel's color to the unselected color. How and where do I do the following in JS?

UniPanel2.ClientEvents.ExtEvents -> function click(sender, eOpts)

function click(sender, eOpts)
{
    sender.setBodyProp("background-color","#008000");
    MainForm.UniPanel1.setBodyProp("background-color","red");
}

 

Link to comment
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...