0

I am using a Delphi TweBrowser to load a php form with a WYSIWYG editor from TinyMCE with a plugin for the image uploading.

The WYSIWYG editor renders properly in both browsers(I.E,chrome,etc) and the TweBrowser in Delphi, but the File Manager Popup does not render properly, nor does the functions work properly.

It does display the images. But when I click on the image, it does not insert the image. The button also is not there and some of the labels seem to have disappeared. Is there a reason for this?

Is there anyway to fix it?

Delphi version Delphi Version Chrome Version Chrome Version

UPDATE:

With some help I have figured out, the problem is Delphi is using IE7 compatibility... Is there anyway to force Delphi to use another version of IE which it will be compatible with?

I know the page is compatible with anything IE8 and up...

Marcel
  • 874
  • 1
  • 14
  • 28
  • 1
    You are aware that the embedded browser is by default in IE7 mode? Look [here](http://stackoverflow.com/a/5357205/800214) for more info. – whosrdaddy Jun 18 '15 at 07:15
  • @whosrdaddy Ok, so Delphi's TWebbrowser is compatible with anything that IE7 is compatible with, If I am understanding you right? Would the solution then be to make the php compatible with IE7? – Marcel Jun 18 '15 at 10:50
  • If you are in control of the webpage, you can add a metatag to force the browser in edge mode. (``). Details are available in the linked answer. – whosrdaddy Jun 18 '15 at 10:56
  • @whosrdaddy What will that do? – Marcel Jun 18 '15 at 11:12
  • Force the browser in its native mode (ie if you have IE10, page will run in IE10 mode, if you have IE11, page will run in IE11 mode). You can simulate your problem with IE and F12 function and select emulation tab (Ctrl-8) – whosrdaddy Jun 18 '15 at 11:15
  • @whosrdaddy ok, but what version is delphi XE7's TWebbrowser running? or in comparisson with? – Marcel Jun 18 '15 at 12:44
  • @whosrdaddy i see what you mean. Changed IE to IE7 emulation and the same problem accurs. But the code you gave me does not fix the problem... – Marcel Jun 18 '15 at 12:52
  • Then you need to add the registry key as outlined in the linked answer I gave you. – whosrdaddy Jun 18 '15 at 13:17
  • @whosrdaddy I see the registry changes, but there must be a simpler way. Changing the registry on every pc with this software is going to be an issue... Isn't it possible to get the TWebbrowser to use chrome instead of IE? – Marcel Jun 18 '15 at 14:07
  • no, the TWebbrowser component is nothing but a wrapper for microsoft's activex control. Adding the registry key is not an issue, as you can add it from your program at startup, and you can use HKCU, so security is not an issue. If you want an alternative, look for TChromium (chrome embedded browser). But then you need to distribute extra DLL's with your application. – whosrdaddy Jun 18 '15 at 14:22
  • Anyway, now that you understand the issue, I'm going to vote this question to close as a dupe. – whosrdaddy Jun 18 '15 at 14:25
  • @whosrdaddy you were right. The registry entry was the easiest... I just have to figure out how to check if it exists on startup, and if not. Create it... But thank you very much :) if you post it as an answer I will accept. – Marcel Jun 18 '15 at 14:58
  • no need, question will be closed a dupe. Glad I could help you :) – whosrdaddy Jun 18 '15 at 15:02

1 Answers1

0

If you are in control of the markup then the quick and dirty simplest solution would be to add this meta data <meta http-equiv="X-UA-Compatible" content="IE=8" /> you can specify the lowest level you need (IE8 in this case) you can try latest available using <meta http-equiv="X-UA-Compatible" content="IE=edge" />, but be aware that you may have rendering speed issues.

Although being aware of newer styles,this basic solution will also have scaling issues with different DPI (try using a high DPI computer and you will see some nasty formatting), that needs a more complex solution. You will need to research implementing IDocHostUIHandler and IOleClientSite on your form. DelphiDabbler.com has some info on that. But to be brief you will need to pass DocHostUIInfo structure and set the DOCHOSTUIFLAG_DPI_AWARE flag.

Jasper Schellingerhout
  • 1,070
  • 1
  • 6
  • 24