Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set value of the element (problem) #14

Open
dsdsdfsdfsfsdfsfsdf opened this issue Mar 22, 2022 · 0 comments
Open

Set value of the element (problem) #14

dsdsdfsdfsfsdfsfsdf opened this issue Mar 22, 2022 · 0 comments

Comments

@dsdsdfsdfsfsdfsfsdf
Copy link

I have problem in the my PRG:

*========================================================================================

  • Retrieve HTML from a loaded document
    *========================================================================================
    Public goForm
    Set Procedure To CefSharpBrowser.fxp ADDITIVE
    goForm = CreateObject ("DemoForm")
    goForm.Show ()

Define Class DemoForm as Form

Height = 440
Width = 860

Add Object oleBrowser as OleControl With ;
	 OleClass = "fpDotNet.DotNetContainer" ;
	,Top = 5 ;
	,Left = 5 ;
	,Height = 395 ;
	,Width = 850 ;
	,Anchor = 15
	
Add Object cefSharpBrowser as CefSharpBrowser 

Add Object cmdGetHtml as CommandButton with ;
	 Caption = "Get HTML" ;
	,Top = 405 ;
	,Left = 5 ;
	,Height = 25 ;
	,Anchor = 6

index_html = ""

Procedure Init
TEXT TO This.index_html NoShow


Text 1:

Text 2:




ENDTEXT

This.CefSharpBrowser.BindtoHost ( ;
	 This.oleBrowser ;
	,"https://myApp/index.html" ;
	,This ;
)

Procedure cmdGetHtml.Click
Local lcResult

    ** Set New Value
lcResult = Thisform.EvaluateScript ( ;
	[document.getElementById('text1').value="New Value1"] ;
)

   ** Get HTML
lcResult = Thisform.EvaluateScript ( ;
	"document.getElementById('myform').innerHTML" ;
)
MessageBox (m.lcResult)	

Procedure EvaluateScript (tcScript)

Local loBridge, loBrowser, loFrame
loBridge = This.CefSharpBrowser.DotNet ()
loBrowser = loBridge.InvokeMethod (This.CefSharpBrowser.oChromium, "GetBrowser")
loFrame = loBridge.GetProperty (m.loBrowser, "MainFrame")

Local loTask, loResponse, luResult
loTask = loBridge.InvokeMethod (m.loFrame, "EvaluateScriptAsync" ;
	,m.tcScript ;
	,"about:blank" ;
	,1 ;
	,null ;
	,.F. ;
)
loResponse = loBridge.GetProperty (m.loTask, "Result")
luResult = loBridge.GetProperty (m.loResponse, "Result")

Return m.luResult

Procedure QueryUnload
This.ReleaseRefrences ()

Procedure Release
This.ReleaseRefrences ()

Procedure ReleaseRefrences
This.RemoveObject ("oleBrowser")
This.RemoveObject ("CefSharpBrowser")

EndDefine
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant