Jump to content

add runtime css to component created at runtime


robinhodemorais

Recommended Posts

 

 

I'm creating an image in progress and I would like to add a css that I created in it too, but there is an error when adding the css

dsName: = UniServerModule.FilesFolderPath + '/ odontogram /' + txCamImagem.Text;
dsNameComp: = StringReplace (StringReplace (txCamImagem.Text, '. png', '', [rfReplaceAll]), '_', '', [rfReplaceAll]);
with TUniImage.Create (Self) as TUniImage
start
if txX.Text <> '' then
Left: = StrToInt (txX.Text)
left most: = 26;
if txY.Text <> '' then
Top: = StrToInt (txY.Text)
else Top: = 60;
Father: = pnOdontogram;
Transparent: = true;
Name: = dsNameComp;
Draggable.Enabled: = True;
Cursor: = crDrag;
OnEndDrag: = AnyComponentsEndDrag;
Picture.LoadFromFile (dsName);
end;

// the error occurs here
UniSession.AddJS ('$ (' '#' + TUniImage (FindComponent ('dsNameComp')). JSId + '' '). AddClass (' 'notStarted' ')');

css

.naoInitiado {
  filter: brightness (0.5) sepia (1) saturate (5) hue-rotate (160deg);
}

error

First chance exception at $007AF8C0. Exception class $C0000005 with message 'access violation at 0x007af8c0: read of address 0x00000444'. 

 

Link to comment
Share on other sites

2 hours ago, robinhodemorais said:

// the error occurs here UniSession.AddJS ('$ (' '#' + TUniImage (FindComponent ('dsNameComp')). JSId + '' '). AddClass (' 'notStarted' ')');

1. FindComponent ('dsNameComp') - you use a string instead of a variable.

Correct: FindComponent (dsNameComp)

2. AddClass - JS case sensitive.

Correct: addClass 

 

  • Like 1
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...