Results 1 to 10 of 43

Thread: Luna Game Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quote Originally Posted by piradyne View Post
    Ok, I got it reading from the zip file. Seem to work ok. The one problem i'm seeing is that I can not get the index items to collapse. Not sure what's going there, but everything else seems to be working.
    I'm not sure but not being able to collapse index tree might be due the fact that by default pages that are being displayed in TWebBrowser component or whenever any third part program is using IWebBrowser interface are being opened in backward compatibility mode. In order to avoid that your program must be registered as a Web Browser. See the link bellow for more information
    https://stackoverflow.com/a/25843958

    Any way with the help of your posted code I can now display and navigate Platform eXtended documentation properly as it consists of just bunch of self contained HTML files (no use of frames). So I don't even need the code in OnNewWindow3 event.

  2. #2
    Oh sweet! You got it working. NICE!!

    Ok, I will check out the link. Thanks.

  3. #3
    Oh oh! To use the frames, you simple have to do this:

    Code:
    procedure TForm2.WebBrowser1NewWindow3(ASender: TObject; var ppDisp: IDispatch;
      var Cancel: WordBool; dwFlags: Cardinal; const bstrUrlContext,
      bstrUrl: WideString);
    var
      s: string;
    begin
      // cancel new window operation
      Cancel := True;
      WebBrowser1.Navigate(bstrURL, '', 'hmcontent');
    end;
    Just specify the frame name and it will "just work" without all the extra loading I was doing before.

    Code:
    begin  // remove any slashes from the front
      while (aURL <> '') and (aURL[1] = '/') do
        Delete(aURL, 1, 1);
      // remove any slashes from the back
      while (aURL <> '') and (aURL[Length(aURL)] = '/') do
        Delete(aURL, Length(aURL), 1);
    
    
      // check for index.html/
      if aURL.Contains('index.html/') then
      begin
        // remove from url
        aURL := aURL.Replace('index.html/', '');
      end;
    
    
      // if empty its the room else endpoint is a file
      if aURL.IsEmpty then
        aURL := 'index.html';
    
    
      // get mime type of file
      aMIMEType := FindMimeType(aURL);
    
    
      // load the file
      WriteOutFile(GenFilename(aURL));
    end;

    Now, on to javascript issues. Oh, I tried the emulation and some other stuff, not working so far. Grrrr!

  4. #4
    Could you provide sample of your help webpages you use. After searching my computer I have no webpages which would be utilizing Frames, so I can't see and diagnose problems you are facing. Therefore I can't actually help but only speculate of what might be wrong.

  5. #5
    Hi, yea sure. Thanks. This link!

  6. #6
    Just tested your help and it seems that there is a problem in FindMimeType function becouse it always returns empty string when it is checking Mime Type of Java Scripts (.js files). Consequently no Java Scripts are loaded properly. I guess.

  7. #7
    I'm getting 'text/plain' for everything except the image files. I just added this:

    Code:
    if TPath.GetExtension(aURL) = '.js' then
        aMIMEType := 'application/javascript';
    Still get those errors.

    Interestingly, if you do this: WebBrowser1.Navigate('file:///' + TPath.Combine(TPath.GetDirectoryName(ParamStr(0)), 'HTML\index.html')), it all works as expected. So the Twebbrowser component can execute the javascript, there is something missing here that we need to do when running it through the protocol handler.

    I've been goodling/bing'ing for hours, trying different things.... nothing so far. Sigh.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •