PB2Web -- A PureBasic to JavaScript-Converter
Re: PB2Web -- A PureBasic to JavaScript-Converter
A new version (2014-01-16) is online: http://pb2web.de/download/
Add: EventMenu() (see MenuTest.pb in the examples-folder)
Add: BindGadgetEvent() for ButtonImageGadget()
Add: OpenFileRequester()
OpenFileRequester() opens a file-upload-dialog and starts immidiately the
upload when the user press the ok-button. On server-side there must be
a component (php, asp, ...) which is able to receive the uploaded file(s).
ServerCode is not able to receive files yet.
OpenFileRequester() is not tested on mobile devices (Android, iOS, etc).
For more informations see: OpenFileRequesterTest.pb in the examples folder
(there is also a 'upload.php' - file available for a simple demonstration).
Fixed: Shorthand-Operators (posted by [blendman])
Fixed: Select-Case-Bug (posted by [blendman] and falsam)
Greetings ... Kiffi
Add: EventMenu() (see MenuTest.pb in the examples-folder)
Add: BindGadgetEvent() for ButtonImageGadget()
Add: OpenFileRequester()
OpenFileRequester() opens a file-upload-dialog and starts immidiately the
upload when the user press the ok-button. On server-side there must be
a component (php, asp, ...) which is able to receive the uploaded file(s).
ServerCode is not able to receive files yet.
OpenFileRequester() is not tested on mobile devices (Android, iOS, etc).
For more informations see: OpenFileRequesterTest.pb in the examples folder
(there is also a 'upload.php' - file available for a simple demonstration).
Fixed: Shorthand-Operators (posted by [blendman])
Fixed: Select-Case-Bug (posted by [blendman] and falsam)
Greetings ... Kiffi
Hygge
Re: PB2Web -- A PureBasic to JavaScript-Converter
Thanks ++++++ Where is your paypal button ? 

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
- [blendman]
- Enthusiast
- Posts: 297
- Joined: Thu Apr 07, 2011 1:14 pm
- Location: 3 arks
- Contact:
Re: PB2Web -- A PureBasic to JavaScript-Converter
Great news !
Thank you very much
. Kiffi, you're just a master (of the univers, of course, like Fred ^^)!
I will try it today, and improve my painting program. I will create a little game too in some days.
EDIT :
I have tried to create an "offline" version with pb2web.
Why ? to use it offline on Chromebook, proprietay system/PC like Hercule Ecafe, or to create Application multi-platform without compile on all platform ^^ and it works great !
On my netbook Hercule Ecafe (system based on ubuntu, modified by hercules), it works on chromium, but not in firefox (7.0.1 I think).
I have those error :
I don't know if it's usefull for you, Kiffi
.
Purepaint - version 0.1 Offline (I have change some lines on some files to use it offline) 1.8 Mo :
http://www.dracaena-studio.com/purebasi ... ffline.zip
EDIT :
OpenFileRequester()
I have tried, but I have an error with your example :
debug error :
I have place the upload.php in the folder of pb2web, is that correct ?
How I do to open for example an image or a text file ?
The code :
EventMenu() and BindGadgetEvent() for ButtonImageGadget() Works fine, thanks
.
Thank you very much

I will try it today, and improve my painting program. I will create a little game too in some days.
EDIT :
I have tried to create an "offline" version with pb2web.
Why ? to use it offline on Chromebook, proprietay system/PC like Hercule Ecafe, or to create Application multi-platform without compile on all platform ^^ and it works great !
On my netbook Hercule Ecafe (system based on ubuntu, modified by hercules), it works on chromium, but not in firefox (7.0.1 I think).
I have those error :
Code: Select all
Purepaint :
uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMCanvasRenderingContext2D.fillStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://www.dracaena-studio.com/purebasic/paint/libraries/pb2web/pb2web.js :: <TOP_LEVEL> :: line 7757" data: no]
Canvas on Pb2web.de :
uncaught exception: [Exception... "Could not convert JavaScript argument - 0 was passed, expected object. Did you mean null? arg 0 [nsIDOMCanvasRenderingContext2D.strokeStyle]" nsresult: "0x80570035 (NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL)" location: "JS frame :: http://pb2web.de/demos/canvasgadget/libraries/pb2web/pb2web.js :: <TOP_LEVEL> :: line 229" data: no]

Purepaint - version 0.1 Offline (I have change some lines on some files to use it offline) 1.8 Mo :
http://www.dracaena-studio.com/purebasi ... ffline.zip
EDIT :
OpenFileRequester()
I have tried, but I have an error with your example :
debug error :
Code: Select all
12:57:51.040: PB_Event_Upload_Complete: <?php
if (isset($_FILES['P2W_Upload'])) {
echo "Message From PHP:\n";
echo "Following file(s) received:\n";
print_r($_FILES['P2W_Upload']);
}
?>
12:57:51.036: PB_Event_Upload_Error: ERROR: unable to upload files
12:57:50.898: PB_Event_Upload_BeforeSend:
How I do to open for example an image or a text file ?
The code :
Code: Select all
XIncludeFile "..\p2w.pbi"
P2W_Converter_SetProfile("pb2webtest")
UseJPEGImageDecoder()
UsePNGImageDecoder()
Procedure OpenFileRequesterCallback(UploadEvent, Message.s)
Select UploadEvent
Case #PB_Event_Upload_BeforeSend
Debug("PB_Event_Upload_BeforeSend: " + Message)
Case #PB_Event_Upload_Complete
Debug("PB_Event_Upload_Complete: " + Message)
Case #PB_Event_Upload_Error
Debug("PB_Event_Upload_Error: " + Message)
Case #PB_Event_Upload_Success
Debug("PB_Event_Upload_Success: " + Message)
Case #PB_Event_Upload_UploadProgress
Debug("PB_Event_Upload_UploadProgress: " + Message)
;Message -> position + ";" + total + ";" + percentComplete
Protected Position.s = StringField(Message, 1, ";")
Protected Total.s = StringField(Message, 2, ";")
Protected PercentageComplete.s = StringField(Message, 3, ";")
Debug "Position: " + Position
Debug "Total: " + Total
Debug "PercentageComplete: " + PercentageComplete + "%"
Debug "---"
EndSelect
EndProcedure
Procedure OpenOpenFileRequester()
; 1. Parameter: Ignored
; 2. Parameter: Upload-URL ;"http://localhost/pb2webtest/upload.php",
; 3. Parameter: Mime-Type (see: http://www.webmaster-toolkit.com/mime-types.shtml)
; 4. Parameter: MaxFileSize in bytes
; 5: 0 or #PB_Requester_MultiSelection (works only in browser with HTML5-Support)
; 6: A callback to get the upload events
OpenFileRequester("",
"upload.php",
"image/*",
10000,
#PB_Requester_MultiSelection,
@OpenFileRequesterCallback())
EndProcedure
LoadFont(0, "Arial", 14)
TextGadget(0, 10, 10, 250, 30, "Please copy 'upload.php' to your webserver before uploading.")
SetGadgetFont(0, 0)
FreeFont(0)
ButtonGadget(1, 10, 50, 250, 30, "OpenFileRequester()")
BindGadgetEvent(1, @OpenOpenFileRequester())

Re: PB2Web -- A PureBasic to JavaScript-Converter
i will take a look...[blendman] wrote:Code: Select all
Purepaint : uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMCanvasRenderingContext2D.fillStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://www.dracaena-studio.com/purebasic/paint/libraries/pb2web/pb2web.js :: <TOP_LEVEL> :: line 7757" data: no]
you must copy the 'upload.php'-Script to your webserver (your Server-Path in[blendman] wrote:OpenFileRequester()
the profile). The server must able to execute PHP-Scripts. What kind of server
do you have? IIS? Apache?
The 'upload.php'-Script ist very simple. It only shows informations about the
file(s) you have selected in the OpenFileRequester().
After clicking OK in the OpenFileRequester() the selected file(s) were sending[blendman] wrote:How I do to open for example an image or a text file ?
to the Script you specified. This script must copy the uploaded files to the server.
After that you can access the Image with LoadImage().
Greetings ... Kiffi
Hygge
Re: PB2Web -- A PureBasic to JavaScript-Converter
Small feedback:
Javascript is enabled.
I tested a code containing a canvas. (Application A) and a code that allows you to enter data and save them in a file. (Application B)
Windows XP and Windows 7 Windows8 (Application A) and (Application B) no problem.
Android 2.2 (Application A) and (B Application) does not work: Window invisible.
Android 4.X (Application A) fixed windows. (Application B) No problem.
(Application A): Windows RT Surface drawings are done with the mouse. (Application B) no problem.
Javascript is enabled.
I tested a code containing a canvas. (Application A) and a code that allows you to enter data and save them in a file. (Application B)
Windows XP and Windows 7 Windows8 (Application A) and (Application B) no problem.
Android 2.2 (Application A) and (B Application) does not work: Window invisible.
Android 4.X (Application A) fixed windows. (Application B) No problem.
(Application A): Windows RT Surface drawings are done with the mouse. (Application B) no problem.
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
Re: PB2Web -- A PureBasic to JavaScript-Converter
With the new version of pb2web, it is possible to download a file. The condition is to put a "ugly php code" (c) Kiffi that you give with this new version. This code does not allow to upload files.
We must complete this code? I think the answer is yes
I will propose a code and tell me what you think.
We must complete this code? I think the answer is yes

I will propose a code and tell me what you think.
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
- [blendman]
- Enthusiast
- Posts: 297
- Joined: Thu Apr 07, 2011 1:14 pm
- Location: 3 arks
- Contact:
Re: PB2Web -- A PureBasic to JavaScript-Converter
OK, It work on my website (dracaena-studio)Kiffi wrote:you must copy the 'upload.php'-Script to your webserver (your Server-Path in
the profile). The server must able to execute PHP-Scripts. What kind of server
do you have? IIS? Apache?

For the "local mode", I use another technics ^^.
Is there a way in JS to open a sort of openfilerequester() but without PHP-Server installed ?
I have to create a PHP-script to copy the file received on my server ?After clicking OK in the OpenFileRequester() the selected file(s) were sending
to the Script you specified. This script must copy the uploaded files to the server.
After that you can access the Image with LoadImage().
Re: PB2Web -- A PureBasic to JavaScript-Converter
yes.[blendman] wrote:I have to create a PHP-script to copy the file received on my server ?
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
Re: PB2Web -- A PureBasic to JavaScript-Converter
Demonstration of Open File Requester.
Test OpenFileRequester
-Click the Test button OpenFileRequester ()
-Choose one or more images.
-Once the download is complete, click an image name in the list to see the corresponding image.
My presentation is visually ugly, but it works
Windows [X] - Windows RT [X] - Android [ ]

-Click the Test button OpenFileRequester ()
-Choose one or more images.
-Once the download is complete, click an image name in the list to see the corresponding image.
My presentation is visually ugly, but it works

Windows [X] - Windows RT [X] - Android [ ]
Last edited by falsam on Fri Jan 17, 2014 7:49 pm, edited 1 time in total.
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: PB2Web -- A PureBasic to JavaScript-Converter
Yes works great 
Congratulation FALSAM !!! you are too strong in HTML/JAVASCRIPT

Congratulation FALSAM !!! you are too strong in HTML/JAVASCRIPT


Not a destination
Re: PB2Web -- A PureBasic to JavaScript-Converter
javascript ? What is this? :p Pb & Kiffi onlyKwaï chang caïne wrote:Yes works great
Congratulation FALSAM !!! you are too strong in JAVASCRIPT

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: PB2Web -- A PureBasic to JavaScript-Converter
Yes i know....have you see the --> "
"
Thanks to the kind KIFFY, now every PB coder can be the king of JS


Thanks to the kind KIFFY, now every PB coder can be the king of JS



Not a destination
Re: PB2Web -- A PureBasic to JavaScript-Converter
i'll try to implement 'local' upload. Stay tuned...[blendman] wrote:Is there a way in JS to open a sort of openfilerequester() but without PHP-Server installed ?
Greetings ... Kiffi
Hygge
Re: PB2Web -- A PureBasic to JavaScript-Converter
@Kiffi : Can you test the 4th parameter (MaxFileSize in bytes) of your procedure OpenFileRequester ? I loaded files > 10000 bytes
Code: Select all
OpenFileRequester("","upload.php", "image/*",10000, #PB_Requester_MultiSelection, @OpenFileRequesterCallback())
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
Re: PB2Web -- A PureBasic to JavaScript-Converter
@all PB2Web-User:
Fred asked me to stop posting things about PB2Web. I accept that and would
like to draw attention to the PB2Web-Forum: http://pb2web.de/forum/
See you there...
Greetings ... Kiffi
Fred asked me to stop posting things about PB2Web. I accept that and would
like to draw attention to the PB2Web-Forum: http://pb2web.de/forum/
See you there...
Greetings ... Kiffi
Hygge