HMGSCRIPT 2012: Programming For The Web in The Right Way :)

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

rathinagiri wrote: I have uploaded hmgscript in hmgscript. So, we can test the behavior immediately.
In the way you've published it, only works with your local server if it is running. It's not really online.

If you are running the server on a home/office windows machine you will need to connect that machine to some service, like no-ip, forward the port 2000 and give it a domain name. Then change this line:

socket = new WebSocket( "ws://localhost:2000/harbour" );

To:

socket = new WebSocket( "ws://something.no-ip.org:2000/harbour" );
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Rossine wrote:Hi Roberto,

Here a more detailed example:
Thanks again!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rathinagiri »

Roberto Lopez wrote:
rathinagiri wrote: I have uploaded hmgscript in hmgscript. So, we can test the behavior immediately.
In the way you've published it, only works with your local server if it is running. It's not really online.

If you are running the server on a home/office windows machine you will need to connect that machine to some service, like no-ip, forward the port 2000 and give it a domain name. Then change this line:

socket = new WebSocket( "ws://localhost:2000/harbour" );

To:

socket = new WebSocket( "ws://something.no-ip.org:2000/harbour" );
Yes. I do agree Roberto. All the demo html files are working except server demo because of no wsserver running behind. If it is in a LAN system and the machine name running the server is 'machine1', then

Code: Select all

      socket = new WebSocket( "ws://machine1:2000/harbour" );

or 

      socket = new WebSocket( "ws://10.0.0.1:2000/harbour" );

will be enough. Right?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

rathinagiri wrote:
Roberto Lopez wrote:
rathinagiri wrote:
Yes. I do agree Roberto. All the demo html files are working except server demo because of no wsserver running behind. If it is in a LAN system and the machine name running the server is 'machine1', then

Code: Select all

      socket = new WebSocket( "ws://machine1:2000/harbour" );

or 

      socket = new WebSocket( "ws://10.0.0.1:2000/harbour" );

will be enough. Right?
If you plan to use the application inside the LAN, it should work.

But, if you plan to use the application over the Internet, you must proceed as explained in the previous post.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Roberto Lopez wrote: But, if you plan to use the application over the Internet, you must proceed as explained in the previous post.
In the case that you have a fixed ip, you can omit the no-ip thing and use that address directly.

And, if you have cablemodem Internet (like me in my home now) you'll could not be able to make a server work at all (depending on your provider policies).
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rathinagiri »

I understand well now. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Hi All,

The R006 with LOTS of improvements in communication with the server.
HMGSCRIPT 2012 FUNCTION REFERENCE (R006)


WINDOW:

Element: DIV

You can use all the properties, events and methods availables for it via DOM.

Syntax:

Window( cId , cCaption , nWidth , nHeight )



BUTTON:

Element: INPUT (Type: BUTTON)

You can use all the properties, events and methods availables for it via DOM.

Syntax:

Button( cId , cParentId , nRow , nCol , cCaption , cOnClick )



LABEL:

Element: SPAN

You can use all the properties, events and methods availables for it via DOM.

Syntax:

Label( cId , cParentId , nRow , nCol , cValue )



TEXTBOX:

Element: INPUT (Type: TEXT)

You can use all the properties, events and methods availables for it via DOM.

Syntax:

TextBox( cId , cParentId , nRow , nCol , cValue )



IMAGE:

Element: IMAGE

You can use all the properties, events and methods availables for it via DOM.

Syntax:

Image( cId , cParentId , nRow , nCol , cSrc )



MSGINFO:

Syntax:

MsgInfo( cMessage , cCaption )



RELEASE:

Releases a window.

Syntax:

Release( cId )


CONNECT:

Creates a websocket connection.

Syntax:

Connect()


SENDMESSAGE:

Send a message to a websocket server via the current open connection.

Syntax:

SendMessage( cText )


GETMESSAGE:

Get a message from a websocket server via the current open connection.

Syntax:

cAnswer = GetMessage()

Enjoy!
Attachments
hmgs006.zip
(595.29 KiB) Downloaded 297 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Well...

We got basic GUI functionality, remote access to a .dbf files via the internet and Harbour remote procedures, so, we have HMG (some sort of :) ) running on web browsers!

So, HMGSCRIPT is a reality!

Most of the pending work is easy, excepting for GRID... but, I'm sure that sooner or later we will do it.

Thanks for your support!

I'll rest a little tomorrow (I really need it!).
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Roberto Lopez wrote:Hi All,

The R006 with LOTS of improvements in communication with the server.
A tip about updated server.

The message that you send via the SendMessage() function is directly macro substituted and its result is asigned to a variable that will be send back to your browser via GetMessage().

Please consider that both ( send and received) messages must be character type.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Roberto Lopez wrote:Hi All,

The R006 with LOTS of improvements in communication with the server.
A tip about updated server.

The message that you send via the SendMessage() function is directly macro substituted and its result is asigned to a variable that will be send back to your browser via GetMessage().

Please consider that both ( send and received) messages must be character type.

So, you could replace button_1 in server demo with:

Code: Select all

   Button( 'button_1' , 'win' , 240 , 110 , "Exec. dtoc(date()) " , "SendMessage( 'dtoc(date())' )" );  
And you will get the current date as answer.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply