Process WebBrowser Client

Raudus Forums Custom components Process WebBrowser Client

This topic contains 1 reply, has 2 voices, and was last updated by  igorklopov 10 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #528

    Leivio
    Participant

    I’m trying to make a component like so: When I click the button triggers a JavaScript processing in ClientWebBrowser and java script that can update the value of another component.

     

    NomeForm := TRaVCLFormCompatible(FOwner).Name;
    AJavascript :=
    ‘var me=’ + FButtom.Name + ‘;’ +
    ‘me.onclick=function Calcula() ‘ +
    ‘{‘ +
    ‘var ValorEditor=document.’ + NomeForm + ‘.’ + FButtom.Name + ‘.value;’ +
    ‘document.’+ NomeForm + ‘.’+ FEditor.Name +’.value=ValorEditor; ‘ +
    ‘}’;

     

    I think I’m doing wrong .. so my doubt?

     

    Leivio

    #539

    igorklopov
    Participant

    Raudus components are not so straightforward as you suppose.
    You know that there is server-side part of component (some TRaExtendable…) and client-side part, that is set up in RaDrawExtend… and other methods. Server-side part is written in Pascal, client-side – in JavaScript. Client-side should not access client-sides of other controls. It should only access it’s server-side counterpart. Client-side sends data to server-side by “me.route()” JavaScript command. Server-side receives data from client-side in RaRoute method. Server-side sends data to client-side using “var AJavascript: String” parameter (it writes JavaScript code there). So, you are quite free to make any possible control, just follow the rules.

    Again – Dont try to access other client-side directly in JavaScript – client-sides of different controls don’t see each other. But their server-side counterparts see each other and can be accessed via their component names.

    In you example, i see that you have a Button and an Edit. Clicking on a Button changes Edit value.

    You need to create two controls – Button and Edit – separately.

    It seems that i should post some code here. But i have an even better idea. In next version i will try to write minimalistic examples of the Edit and the Button.

    Try to study example “80-RxStButton”. It is rather simple.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.