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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...