Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
returning 'plain text' when using EWB as a 'console web app' .. suggestions? |
Fri, Mar 24 2017 12:40 AM | Permanent Link |
R&D team @ Environment Canada | Hi
I am trying to get a EWB console web application to return 'plain text' to the calling client Returning something for the browser to see is pretty easy, for example, this returns 'hi Bob' : //return some text, right in the main body! setElementText(getBodyElement,'hi Bob'); However, this naturally returns all the <HTML> dressing, which I don't want for this application.. I want quite simply the text only // I'm no expert in the world of DOM.. but, after browsing through the 'webdom.wbs' source.. I tried things like.. removeAllHTMLElements(getHeadElement); createTextElement('hi Bob'); But.. well.. it did not work.. I'd be super grateful for any hints! thanks.. Bruno |
Fri, Mar 24 2017 4:31 AM | Permanent Link |
Matthew Jones | Steven/Phil/Nathan/Bruno @ Environment Canada wrote:
> I am trying to get a EWB console web application to return 'plain text' to the calling client I've never understood what the non-visual mode does, but the description seems to imply that there are no forms or elements or anything. So if you are doing element stuff, then I am not surprised to hear it has all the HTML parts too. Is there a non-visual sample anywhere? Bruno, what are you using to run the code that is output? -- Matthew Jones |
Fri, Mar 24 2017 8:02 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bruno,
<< I am trying to get a EWB console web application to return 'plain text' to the calling client Returning something for the browser to see is pretty easy, for example, this returns 'hi Bob' : //return some text, right in the main body! setElementText(getBodyElement,'hi Bob'); However, this naturally returns all the <HTML> dressing, which I don't want for this application.. I want quite simply the text only >> You're always going to have the outer html block, as well as the body. The head element is optional in HTML5. However, more importantly, with EWB you're going to need the OnLoad/OnUnload bits so that the JS is bootstrapped properly. The rest can be stripped out of the HTML. Anyways, what you want is your last example: setElementText(getBodyElement,'hi Bob'); If you could explain what you're trying to do,I can give you further advice on how to proceed. Whatever it is, it seems intriguing... Tim Young Elevate Software www.elevatesoft.com |
Fri, Mar 24 2017 8:30 AM | Permanent Link |
Bruno Larochelle | thanks Matthew, Tim.. I'm learning a bit more here, and I'll try to explain what I'm trying to do
////////// Matthew.. a super simple example of a 'console' webapp would be this (New -> Project -> Non visual) : project hellobob; uses WebCore, webDom; begin setElementText(getBodyElement,'hi Bob'); end. Note that I've added 'webDom' to the uses clause, that is not there otherwise. You can 'run' that directly in the EWB embedded browser and you will see, quite simply, 'hi Bob' If you 'inspect' it via a browser.. you will see the 'hi Bob' with <HTML> "dressing" If you 'view source' in a browser.. you will see the html with reference to the JS /////////// Tim and Matthew.. What am I trying to do? I would like to be able to have the 'document' that is displayed in the browser contain only the plain text 'hi Bob' with nothing else. My 'real world' example is of course much more complex, with lots of 'processing' going on, but in the end, a short text 'answer' is the result. Call it an 'engine' if you like. But a 'front-loader', instead of 'back-hoe' Why am I trying to do this? Although I can do this type of stuff 'server side' with PHP (and it would return 'hi Bob', and nothing else), I'm interested in leveraging EWB/Object Pascal .. keeping the code in the EWB 'world' if possible. An added benefit (I think) is that the processing is 'distributed' among the 'users' (web clients), instead of 'loading' the server with all the tasks. But mostly, I'm really interested in coding almost everything in EWB. If I could make my sandwich in EWB, I would! Will I be able to do this? I have to get my head around some of this HTML stuff, and the DOM -- thanks for the hints Tim. But I can see that it is possible that I might need a supporting PHP script to do the transfer of plain text to the browser, and that won't be the end of the world. ///////////////// again, much thanks to you both, and I think I have some paths to try already .. Bruno (at home, but my head at work) Tim Young [Elevate Software] wrote: Bruno, << I am trying to get a EWB console web application to return 'plain text' to the calling client Returning something for the browser to see is pretty easy, for example, this returns 'hi Bob' : //return some text, right in the main body! setElementText(getBodyElement,'hi Bob'); However, this naturally returns all the <HTML> dressing, which I don't want for this application.. I want quite simply the text only >> You're always going to have the outer html block, as well as the body. The head element is optional in HTML5. However, more importantly, with EWB you're going to need the OnLoad/OnUnload bits so that the JS is bootstrapped properly. The rest can be stripped out of the HTML. Anyways, what you want is your last example: setElementText(getBodyElement,'hi Bob'); If you could explain what you're trying to do,I can give you further advice on how to proceed. Whatever it is, it seems intriguing... Tim Young Elevate Software www.elevatesoft.com |
Fri, Mar 24 2017 8:31 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Matthew,
<< I've never understood what the non-visual mode does, but the description seems to imply that there are no forms or elements or anything. >> Yep, the "non-visual" is a bit of a misnomer, but it essentially means that EWB is not going to do any sort of UI controls for you at all. However, you're free to create UI elements and populate the DOM in order to do "low-level" manipulation of the browser. A basic non-visual application that uses the WebCore, WebDOM, and WebUI units weighs in at around 200k compressed. So, if you really need something basic and lightweight, then it might be a good option. You can do things like this: project Project1; uses WebCore, WebDOM, WebUI; begin with InterfaceManager do begin RootElement.BeginUpdate; try with CreateElement('Test',RootElement) do begin Height:=300; Width:=300; Background.Fill.Color:=clRed; end; finally RootElement.EndUpdate; end; end; end. IOW, you can work with the DOM elements almost in the same way that you work with the control properties in EWB. No worrying about CSS style names/values, or HTML attributes. Just straight code, and with all of the layout functionality, animation, event handling, etc. that EWB provides. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, May 23, 2024 at 03:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |