From kde-devel Fri Jul 02 11:20:40 1999 From: Simon Hausmann Date: Fri, 02 Jul 1999 11:20:40 +0000 To: kde-devel Subject: Re: Easy to use components X-MARC-Message: https://marc.info/?l=kde-devel&m=93091624217783 On Fri, 2 Jul 1999, Lars Knoll wrote: > On Thu, 01 Jul 1999, Kurt Granroth wrote: > >I used an ActiveX component for the first time yesterday (I had to > >get the product working in under and hour and it had to be a Windows app (in > >the project-requirements)). I almost hate to say it, but I was > >impressed! > > > >What I needed to do was embedd a web browser into my app. Mind you, an HTML > >widget would *not* have worked as the browser needed to take care of such > >things as the proxy and downloading the pages as well as displaying them. > >I used the MS Internet Explorer ActiveX component to do this. Here are > >all the steps I took to do so in VC++5: > > > >1) Click on Project->Add Components. Select WebBrowser control from HUGE list > > of components (all with descriptions). Decide on name for the wrapper > > class (CWebBrowser) > > > >2) Go to the dialog editor (my app was dialog based). I see a cute icon on my > > tools bar for the browser component. I select it and do a click-n-drag > > to put it on my dialog in the size that I want. > > > >3) I go to the class-wizard and associate a member variable for that component > > (CWebBrowser m_browser) > > > >Mind you, I have not written one *single* line of code, yet. > > > >4) I go into my dialog class (CGpsDemoDlg) and add this to the init function > > m_browser.Navigate("http://www.pobox.com/~kurt_granroth", ..). > > > >5) I compile and run. Voila! I see my home page displayed in my app. > > > >Wow! One line of code to have an entire embedded web browser! Of course, > >there are tons more options that you can set (and I did, later), but the fact > >that you can do sooo much with so little effort is incredible. > > > >Just some food for thought when we think about using KOM/OP. Can we get it to > >be that easy? > > I think, we can get it almost that easy even without using KOM/OP. I once had a > thought about implementing a browser class in khtml, which does almost > everything for the user. But for that khtml will need to link against libkio. > Then one could perhaps do something like: > > KHTMLBrowser m_browser; > m_browser.load(my_url); > m_browser.show(); > > to get a HTML window in you app. The question is then, howmuch should it do by > itself? Should it follow links if a user clicks onto it, etc... > > Another possibility is to use konqueror for showing your page, but you probably > wanted to embed it into some widget... I think Torben's KBrowser class in Konqueror is what you're looking for. But: Why not use the full-fledged HTMLView component from Konqueror directly? IMHO this is what components are for, and embedding a remote KonqHTMLView can be done in about 10 LOC. Advantages are: - Use all features from Konqy, including Plugins (see tool-issue thread on kfm-devel) - KonqHTMLView has nice features, just like "save document as..." for example . Either call the method directly or use the GUI (next point) - Just send the HTMLView a special event with a reference to a OpenPartsUI::Menu and it fills it with it's menu entries. I think this is the 100% equivalent thing to the ActiveX component or IE. Bye, Simon