Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refreshhing Browser Control in a code
Message
From
12/03/2004 00:01:52
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Refreshhing Browser Control in a code
Miscellaneous
Thread ID:
00885475
Message ID:
00885475
Views:
59
When browser control placed onto form visually and this form runs, issuing navigate method even for the same local file ( assuming it was refreshed with the new content ) refreshes browser control without any problem. However, in a code below removing and adding subclassed browser control is required , otherwise we are in a loop for readystate. I am aware of CreateObject( "internetexplorer.application" ) which works properly with navigate method without need to instantiate it each time, but I need an alternative way for someone. My main concern is that the method below is very slow.

Thanks
Michael
oparser = CREATEOBJECT('HTMLParser' )
SCAN
    ltext = oparser.getInnerText(htmlfield )
ENDSCAN


DEFINE CLASS HTMLParser AS FORM

    FUNCTION getInnerText
    LPARAMETERS tcHTML
    ltext = ''
    TRY
        lcTemp =  ADDBS(SYS(5)+CURDIR())+ SYS(2015)+ '.htm'
        STRTOFILE(tcHTML,lcTemp ,0)

* required to avoid to achieve readystate

        IF VARTYPE(THIS.oie) = 'O'
            THIS.REMOVEOBJECT( "oIE" )
        ENDIF
        THIS.ADDOBJECT( "oIE" , "fbrowser" )
***
        WITH THIS.oie
            .Navigate2(lcTemp)
            DO WHILE .ReadyState # 4 
                WAIT WINDOW "" TIMEOUT .01
            ENDDO
        ENDWITH
        ltext =  THIS.oie.DOCUMENT.body.innertext
    CATCH  TO loexception
        ltext = ''
    ENDTRY
    RETURN ltext
    ENDFUNC
ENDDEFINE
Next
Reply
Map
View

Click here to load this message in the networking platform