Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you put html code in Vfp9? 18

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
585
PH
Hello everyone... i planning to put an html code in my application, is this possible? thanks...
 
Depends what you plan to do with it. If you're passing it through a shellexe while invoking a browser, you might be able to depending on the intention.
But if you want to use it to format your form, then no.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
The intention is not really clear.

You can display HTML in the webbrowser control (ActiveX).
There are several solutions to let VFP work within a webserver and the best known specialist on it is Rick Strahl, who is West Wind. On the homepage you can sse how man products he offers, which are HTML related. NOt all of them are also VFP related, as he went in the direction of .NET, but you see VFP mentioned in several products.

Chriss
 
I intend to put it a form as a design...(marquee...) Thanks Chriss and Scott24x7... God bless...
 
I still may understand it wrong, do you want to transfer HTML forms to VFP forms or do you explicitly want to have a marquee element even though it was removed from web standards?

As said you could use HTML 1:1 in a Webbrowser control. But that doesn't convert HTML forms to VFP forms, the ActiveX webbrowser control just embeds the main HTML DOM display area of a web browser (IE) onto a VFP form. In that sense you could "transfer" HTML into VFP by simply only having a form sized ActiveX Webbrowser control on the form. But you don't gain anything from that directly. It just embeds this into a VFP form without having an extra browser window. But it's only visual embedding, it still remains a foreign object.

Chriss
 
Mandy,
It won't work in a VFP form.
You have to use VFP code for that...
What are you really trying to achieve? There may be a better way to do it. It sounds like you want to use HTML because that's what you know. It's probably simple as in VFP if you understand it.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCAP, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"I try to be nice, but sometimes my mouth doesn't cooperate.
 
Mandy,

Once again, your meaning is unclear. You said, "I intend to put it a form as a design...(marquee...)". Just think about that for a moment. Do you really expect us to know what it means?

What exactly is a "marquee" in this context? What exactly do you intend to put in(?) in a form? How does all this relate to HTML?

We are really anxious to help you, but please make it easier for us by stating exactly what you want to acheive.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I agree with Mike,

also because there is tooling, that takes VFP to the web, for example foxincloud, but not the inverse.

What did you say? Ah, found it: In another thread you said:
Mandy_crw said:
my company is not paying me for the application, they consider it old.... although i tried selling it... our company is using web based app...

Not sure, but does that mean you're redoing that web based app they use? And redo it as a VFP desktop app? And you now look for ways to convert the HTML of that web app to VFP, after you are already finished almost?

Mandy_crw said:
my project is almost complete... just a little polishing...

It's very late for thinking in that direction, isn't it? That could have helped when you were starting to do a web app to VFP app conversion. Maybe you really only look for a <marquee> replacement.

I don't know, you're still very short about the details of what you need. You might not even know it precisely. You might have realized from the SCAN FOR thread, that your actual problem wasn't thinking about the right VFP code to use, but of the right form design and controls. A set of HTML input type=text elements could be easily repeated for every SCAN FOR result, so that's surely the HTML way of thinking to create a user interface dynamically. In VFP instead you'd not generate textboxes for each record but use a listbox or grid. Just to mention one point once more, in HTML the page size automatically increases if you add more HTML elements and if all grows very large the broswer automatically generates scrollbars. That's automatic in HTML generation. In winform you'd need to take it upon yourself to not only position new textboxes at new top/left coordinates as those aren't automatic, you also need to increase form.height. That alone isn't making HTML form like conversions easy. If one HTML page has 10 records, another has 40, you can forget to use to 10 record layout on one side and you won't like to always go for enough controls for 40 records when only 10 of them are used.

It won't help you to convert HTML to VFP forms in that respect, as repeated inputs in the layout of a grid or table in HTML don't automatically translate to a VFP listbox or grid. The need for that won't easily become apparent to a converter tool. In a 1:1 HMTL to VFP conversion you'd generate many textboxes and so a HTML to VFP converter, even if it would exist, could not help make the right choices of design of a VFP form. That still remains something to learn by yourself.

It's also one of many reasons why I don't see anyone doing HTML to VFP conversion. It's not necessarily straight forward. Also because HTML and desktop work on very different principles with a server side involved, even though many JS frameworks replace the server component locally on a client and HTML apps can act quite like desktop apps. There's no easy 1:1 conversion and VFP to HTML is easier than HTML to VFP even only considering the layout of forms without transforming program logic.

All that aside, if you can easier think in terms of markup language than using a visual form designer, you might like Matt Slays dynamic forms. He didn't base that on HTML but his own markup that's not handled by a browser but used to create VFP forms from it dynamically at runtime:
That doesn't help with HTML to VFP conversion, but you could design VFP forms as a markup notation similar to HTML. One could try to convert HTML to his markup, but I don't think that's feasible. It's also questionable to first need to learn his markup, but it may make it easier once you are used to create forms with HTML markup language it may come easier to you to write out a form than to use the form designer to compose it.

It surely is something to add to VFP when you look at all this as a hobby and want to investigate and learn things. At the same time it's a niche not many of us do use. So it makes getting help for how to program in VFP forms harder.

If you're really after the general topic of HTML and not just the marquee text scrolling element, then I'd say what you should do to get a better feeling for how to design your VFP forms is take a look at all the controls there are and how to use them. The VFP solutions app with code samples will teach you a bit about every control. There are some controls even having multiple examples on their usage.

That's where I'd recommend you go next. Not HTML or dynamic forms. If you don't make the transition to think in terms of desktop forms design, neither html conversion nor dynamic forms will help with that. Matt Slays dynamic forms surely would enable you to have a form growing automatically the more markup you write or let VFP code write, but it also won't know that your 4x20 textboxes are really better done with a grid.

That's why I think you don't get around learning all VFP controls and when to use them. It's not as steep a learning curve as in .NET, where you have a lot more controls. Not talking about the control suites you can add, almost any ActiveX control could be added to VFP, too. I also think that thinking about the right control choices is something you have to know or learn anyway, even in HTML there are design choices to make despite the freedom of any height of UI. In that respect it even becomes a n art in itself to design a web app that's concentrating its UI into one screen size as better UX. And making it responsive, which you can do with VFP forms anchoring techniques, too.

No tool can take the general layout/design task away from you. Even if you think the HTML layout already is perfect, you'd likely do it different in a desktop/winform which VFP forms are.

Chriss
 
Hi Mike.. im sorry for i do not know how to describe it... marquee is a moving text.. for let to right or right to left or top to bottom or from bottom to top... that is a marquee in html programming... because i want a picture to roll from bottom to top over and over in my form... but as Scott said.. it wont work,... Thank you and God bless! Thanks Chriss and Scott...
 
Hi Chris i am not redoing my project/app... i just want to put a marquee in my form... a rolling picture on the side of the form as a design....
 
Thanks for clarifying, so you were actually asking for whether VFP could have a marquee HTML. But even that won't scroll an image, would it?

Any kind of animation would need a control capable to show a video or you just apply an image control showing an animated GIF.

Solutions app shows how to display a video by embedding a Microsoft Multi Media ActiveX control. But that's far fetched for just a little graphical frill. If you want to draw a color gradient and let it scroll or wobble a little as a form background, I'd use an image control with a GIF for that purpose and then look for such a GIF animation or a way to create it with graphics software.

Btw, nobody immediately knows you were just asking for a little graphical frills as all the visual editors in VFP are called designers. Menu designer, form designer, class designer. I immediately thought in that direction. Also as you mention HTML, which is a way to design forms, layout of things. Surely that also involves graphical deign, but terms for that are more like skinning and themes and graphics. Did you really use HTML marquees to scroll graphics? It was mainly used to scroll text as a ticker, wasn't it?

By the way, if you want the graphic scrolling in the background of the form, i.e. behind controls and not just an otherwise empty area, neither the Multi Media Control would help nor the Webbrowser control, which in fact could show HTML. All ActiveX controls are their own windows, which means even if you put them into the background, their area will always show in front of any VFP controls.

Instead using an image control or the form.picture to display a GIF animation.
Before you go for an animation, how about looking for a nice image of a sky with some clouds and setting it as form.picture background image?

PS: GIF animations are not animated when you set them to form.Picture, but you can put an image control, size it to the area you want to cover, and then use "Send To Back" from the Format menu to have that image in the background.

Chriss
 
Mandy, OK,I think I know what you want. You are talking about the sort of scrolling text that you might see moving across the foot of the screen in a TV news broadcast.

So, that has nothing to do with HTML. If you see it on a web page, it is more likely that it is done with JavaScript. As Scott has said, there is no direct way of doing that in VFP.

However, it might be possible to do it with native VFP code - but I'm not sure how effective it would be. You could try something like this:

1. Create a label to hold the text that you want to display.

2. Place the label on a form. Make it the whole width of the form. (Do not set its Autosize to .T.)

3. Add a timer control to the form. Set its Interval to, say, 250 ms. (You will have to experiment to find the best value.)

4. In the timer's Timer event, delete the left-most character of the label, and then add that same character to the right-most end. Perhaps something like this:

Code:
lcText = THISFORM.lblMarquee.Caption
lcChar = LEFT(lcText, 1)
lcText = SUBSTR(lcText, 2) + lcChar
THISFORM.lblMarquee.Caption = lcText

I don't know for sure how that would work, and I don't guarantee that the code is 100 percent, but give it a try and let us know how it goes.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
If you want to use HTML try this sample:

Code:
**********************************************
* marquee using webbrowser control
**********************************************

oform = createobject('marqueeTest')
oform.visible = .t.
read events

define class marqueetest as Form

Height 		= 100
	Width 		= 800
	ShowWindow 	= 2
	AutoCenter	=.T.
	Visible 	= .T.
	MaxButton 	= .f.
	MinButton 	= .t.
	alwaysontop = .t.
	Add Object browser As sexplorer With Height = 298, Width = 798, Visible = .T., Anchor = 15
	id = ''


procedure destroy
clear events

*----------------------------
procedure init
*----------------------------

text to html noshow

<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
</head>

<marquee>
	<h2 style="font-family:Segoe UI Emoji;">
&#129418;&#129418;&#129418; Visual Foxpro can Show and use HTML using webbrowser control...! &#129418;&#129418;&#129418;
	</h2>
</marquee>

</html>

endtext

with this.browser
.silent = .t.
.navigate('about:blank')
.document.open()
.document.write(m.html)
endwith

*******************************************
enddefine
*******************************************

********************************************
Define Class sexplorer As OleControl
********************************************
	OleClass = 'shell.explorer.2'

*------------------------
	Procedure Init
*------------------------
	This.silent = .T.

********************************************
Enddefine
********************************************


Marco Plaza
@nfoxProject
 
Hi Kime, Chriss and Mplaza.... Thanks im gonna try all your suggestiona and see if i can do it in my form... thanks so much...
 
Mandy,

You've had several different solutions (or rather, solutions to several different problems). It would be interesting to know which one (if any) is the right one for you. Please let us know. The information might be useful to others.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes Mike i will… i will just have to try and study it well first to know whatvis beat for my project… thank you Mike for always helping… God bless…
 
You're welcome, Mandy.

And I would add that it makes a nice change to have a polite, friendly discussion on a purely technical issue, free from the rancour, offensive language and name-calling that has infected too many of the threads in this forum recently. Let's all try and keep it that way.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello Mandy,

if I understand you correctly, thats what a "ticker" does.

a sample with pure vfp here :

a sample with VFP using GDI :

another sample with html :

and add one from from VB (OCX), very old thread, I would not use that :


Best regards
Tom

And I hope you found all hidden eastereggs.
Unfortunately our cats did search, too :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top