Discussion forum about PANORAMIC language
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeHome  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  
Latest topics
» What happened with the panoramic language ?
by Wed Jan 03, 2024 4:09 pm

» Hello world.
by Wed May 09, 2018 11:53 pm

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

 

 LPRINT?

Go down 
4 posters
AuthorMessage
Joerg




Number of posts : 19
Registration date : 2009-07-11

LPRINT? Empty
PostSubject: LPRINT?   LPRINT? EmptyMon Oct 27, 2014 3:34 pm

Hi everyone,

BASIC has the "LPRINT" command to send text to a printer. Does Panoramic has something similar?

Thanks!!
Joerg
Back to top Go down
papydall

papydall


Number of posts : 39
Age : 73
Localisation : TUNISIA
Registration date : 2013-03-16

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 6:21 am

Hello everybody
Panoramic does not possess command LPRINT.
But we can launch a program of printing since the program Panoramic.

Try the following code:

Code:

label clic

memo 10 : top 10, 20 : left 10,100 : width 10, 400 : height 10,200 : font_bold 10
item_add 10,"This is a text to be sent to the printer."
item_add 10,"Click the button LPRINT to send it to the printer."
item_add 10, "Click the button END to end."

button 20 : top 20,250 : left 20,200 : caption 20,"LPRINT" : on_click 20,clic
button 30 : top 30,250 : left 30,300 : caption 30,"END"    : on_click 30,clic

end
rem ============================================================================

clic:

   if dir_exists ("C:\temp") <> 1 then dir_make "C:\temp"
   select number_click
      case 20
           file_save 10,"C:\Temp\test.txt"
           execute_wait "cmd /c write.exe /p C:\Temp\test.txt"
           message "Done"
           file_delete "C:\Temp\test.txt"
      case 30
           if message_information_yes_no("You really want to leave ?")=1 then terminate
   end_select
return
rem ============================================================================


NB: I did not test this code because I do not possess a printer!

Please excuse my bad English ! Embarassed
Back to top Go down
Joerg




Number of posts : 19
Registration date : 2009-07-11

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 6:57 am

papydall,

that's a good workaround and it works perfectly. Thanks for sharing this!

By the way, your English is much better, then my French Wink and I was glad to read your post in the English forum. Although I like the language and have been to France, I'm not very good in it...

merci!
Joerg
Back to top Go down
papydall

papydall


Number of posts : 39
Age : 73
Localisation : TUNISIA
Registration date : 2013-03-16

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 7:53 am

I am not French. I am Tunisian
And the French language is not my language but I master it well enough.
English, I understand it just a little  more that I speak it. Laughing
Back to top Go down
Joerg




Number of posts : 19
Registration date : 2009-07-11

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 8:54 am

... I know. But I noticed, you are very active in the french forum...
Back to top Go down
Jack
Admin
Jack


Number of posts : 99
Registration date : 2007-07-01

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 3:49 pm

As Papydall told you, there is no LPRINT with Panoramic for the moment.
Maybe in the future I will code such a statement.
Back to top Go down
https://panoramic.forumotion.com
papydall

papydall


Number of posts : 39
Age : 73
Localisation : TUNISIA
Registration date : 2013-03-16

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 4:42 pm

A LPRINT command will be very useful.
Thank you Jack.
Back to top Go down
kawe




Number of posts : 18
Registration date : 2010-11-07

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 5:24 pm

Jack wrote:
As Papydall told you, there is no LPRINT with Panoramic for the moment.
Maybe in the future I will code such a statement.

If using a (FREEBASIC-)DLLs is an option like Papydall suggested in the "round numbers" thread, you may also use external print functions of course.

An example:
Code:
dim channel%, ret_val%
dim device_name$, text$, form_feed$
device_name$="LPT1:EMU=TTY"
form_feed$=chr$(12)
text$ = "Any text you like ..."
dll_on "c:\temp\print.dll"
channel% = dll_call1("open_for_print", adr(device_name$))
if channel% = 0 then print "Ooops."
ret_val% = dll_call2("print_text", channel%, adr(text$))
ret_val% = dll_call2("print_text", channel%, adr(form_feed$))
ret_val% = dll_call1("close_channel", channel%)
if ret_val% = channel% then print "So far, so good."
dll_off
wait 3000
terminate

using a FREEBASIC-DLL, e.g.:
Code:
Extern "Windows-MS"

Function open_for_print(byRef device_str as ZString ptr) as Integer Export
 Var channel = FreeFile( )
 If channel Then
 Var failure = Open Lpt (*device_str As #channel)
 If failure Then Return 0
 EndIf
 Return channel
End Function

Function print_text(ByVal channel as Integer, ByRef text_str as ZString Ptr) as Integer Export
  Print #channel, *text_str
  Return 0
End Function

Function close_channel(ByVal channel as Integer) as Integer Export
 If Close (#channel) Then Return 0
 Return channel
End Function

end Extern

located in "c:\temp\".

Klaus has also generated a "Print.dll" in his "DLLdivers"-Package. but I didn't use it so far.

As a lot of people ask for only "externally" available functions (mostly by compiling a DLL using FREEBASIC):

@Jack:
Why not think about doing it the other way round?
Why not try to make PANORAMIC also available from within FREEBASIC (a "panoramic.dll")?

PANORAMIC is good for fast creating event driven GUIs and is little resource consuming.
However, other languages like FREEBASIC will alway outperform PANORAMIC in many -but never all! - respects.

While it is often more fun to realise "complexer" algorithms in complexer languages it is also true that it is often more fun to realise interactive GUIs in languages following a different concept.

Most of us have no problem with this I guess.
IMHO, Klaus' phantastic libraries are inspired by the idea "both together are more than both apart".

So I would encourage Jack to primarily stick with and optimise the "Windows Objects" and "Event" handling what is the "core competence" of PANORAMIC and much harder to realise in other languages.
Therefore, it might be more important to implement a more powerful interface between other languages and PANORAMIC (and the other way round!!!) than to add this or that particular feature.

What I mean is for example a much more "natural" way to use external ("DLL"-)functions and subs in PANORAMIC (e.g. by using function/sub aliases once a DLL has been "imported").
This may also imply a data type "Any" what is technical merely more than a String but not zero-terminated and manually dimensioned.
And maybe also a "casted dereference option".

e.g.:

Code:
dim something?
something? = Any(16)  
dll_call1("function_using_struct", something?) ' call a function expecting a struct of size 16.
dim element%
element% = something?(0) ' fill element% by the bytes read from something? starting from the beginning
Print Cast%(something?(4)) ' read an "integer" from something? starting at position 4.
Print Cast$(something?(5, 3)) ' read bytes 5 ... 7 from something? as String.

...

If you could also assign references to this cells:

e.g.:

Code:
dim something?
something? = Any(16)  
Ref first_int% = something?(0)
Ref second_int% = something(4)
....

You could quickly build up a very basic but working "struct" in PANORAMIC that would not only allow to speak easier to many DLLs but could also be used internally to give a sip of object orientation.

Or this:

Code:
dim something?
dim dummy%
something?=Any(4)
Ref func§ = something(0)
dummy% = dll_call1("get_func_pointer, something?) ' retrieve a function to to e.g. "multiply (a, b)"
Print func§(5, 5)

....
Back to top Go down
Joerg




Number of posts : 19
Registration date : 2009-07-11

LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? EmptyFri Oct 31, 2014 7:21 pm

Thanks Jack,

this would be great!

Joerg
Back to top Go down
Sponsored content





LPRINT? Empty
PostSubject: Re: LPRINT?   LPRINT? Empty

Back to top Go down
 
LPRINT?
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Help?-
Jump to: