none
Small Basic Print/Save RRS feed

  • Question

  • Sorry, I am a very beginner in programming SmallBasic.Version 0.9 has been downloaded into my computer.

    How can I save and print the content of the GraphicsWindow and Textwindow (e.g. the painting I created, or the result of a mathem.program)?

    The Introduction to Programming (downloaded together with the program) is very useful but poor in details. Is there any booklet etc. publishing more details?

    Thanks in advance

    Frank

    Wednesday, September 1, 2010 2:48 PM

Answers

  • Yes, you can print images files and text files and images from ImageList using Data Extension.

    Here is small sample:

    GraphicsWindow.Show()
    FileToPrint = Dialogs.AskForFile("Text File (*.txt) |*.txt")'Ask for file with .txt file filter
    If FileToPrint = "" Then 'If user don't select file close program
      Dialogs.ShowMessegeBox("You must select file","Error","OK","Error")'Show error messege
      Program.End()'And end program
    EndIf
    PrintFont = Printing.CreatePrintFont("Arial",21,"Black")'Create printfont for printing
    Printing.SetFontUsingDialog(PrintFont)'set value of printfont with font dialog
    Printing.Print(FileToPrint,PrintFont)'And finally print selected file with selected font

     

    If you want save or load data you can use File.Writeline() and File.Readline()

    Images you can edit and save with my PictureTools


    Sorry My Bad English
    • Proposed as answer by Oskariok Wednesday, September 1, 2010 5:59 PM
    • Marked as answer by litdevModerator Wednesday, October 13, 2010 8:07 PM
    Wednesday, September 1, 2010 5:56 PM

All replies

  • Here. :) this is probably the best extension around here.
    Check out my website: http://k-dev.webs.com/
    Wednesday, September 1, 2010 4:52 PM
  • HungarianFrank,

    The only way to print in Small Basic is to add an extension.  The extension that you need was written by Oskariok.  If you look through the forum titles look for 0.9.0.9 this should get you to the extension that you need.

    For documentation look at other user's programs to see how they created their programs.  Also, when you get stuck search the forum for answers to what you need.  Also, ask questions.  Other users are always real helpful in problem resolution.

    Good luck,

    Jricestk

     

    Wednesday, September 1, 2010 5:05 PM
    Answerer
  • Yes, you can print images files and text files and images from ImageList using Data Extension.

    Here is small sample:

    GraphicsWindow.Show()
    FileToPrint = Dialogs.AskForFile("Text File (*.txt) |*.txt")'Ask for file with .txt file filter
    If FileToPrint = "" Then 'If user don't select file close program
      Dialogs.ShowMessegeBox("You must select file","Error","OK","Error")'Show error messege
      Program.End()'And end program
    EndIf
    PrintFont = Printing.CreatePrintFont("Arial",21,"Black")'Create printfont for printing
    Printing.SetFontUsingDialog(PrintFont)'set value of printfont with font dialog
    Printing.Print(FileToPrint,PrintFont)'And finally print selected file with selected font

     

    If you want save or load data you can use File.Writeline() and File.Readline()

    Images you can edit and save with my PictureTools


    Sorry My Bad English
    • Proposed as answer by Oskariok Wednesday, September 1, 2010 5:59 PM
    • Marked as answer by litdevModerator Wednesday, October 13, 2010 8:07 PM
    Wednesday, September 1, 2010 5:56 PM
  • Thanks a lot but as a tried to download the extension I got a message from my computer telling that this file could demage the computer....

    Best regards,

    Frank

     

    Thursday, September 2, 2010 4:24 PM
  • Thanks, I will try.

    Regards,

    Frank

    Thursday, September 2, 2010 4:27 PM
  • Thanks, see the remark of moderator "litdev" : "try not to create extensions that could harm the operation system".

    Regards,

    Frank

    Thursday, September 2, 2010 4:38 PM
  • Do you mean that yellow line in live store when you download and messege box from windows when you open the installer?

    Just remember this:

    This extension uses .NET. Every other program that use .NET can do same things than functions in my extension.


    Sorry My Bad English
    Thursday, September 2, 2010 4:49 PM
  • HungarianFrank,

    I think this is a standard warning; it is generally true that anything installed could potentially be damaging, it doesn't mean there is anything specifically dangerous about this.  I don't think there is. 

    You are right to be careful, even SmallBasic without extensions can write code to delete files and directories.

    My warning was directed at the possibility to write extensions to do potentially damaging things (even if they are well intentioned, they may be used by inexperienced users who don't understand the risks of some commands).

    I don't believe this or any other extension I have come across are dangerous in this way, they just add fun features.  Most extensions on this forum have been used/decompiled etc by a number of people and are pretty safe - they do what they say they do.

    Always read the intellisense description before using a command for the first time, then test with a simple case to check it works as you expect. 

    Also, always visually check through any code you import before running it.

    Good luck.

    Thursday, September 2, 2010 6:00 PM
    Moderator
  • Sorry, I was not able to download Data.exe, my computer did not open MIME Type: application/x - msdownload. Should I give up?

    Frank

     

    Friday, September 3, 2010 12:24 PM
  • Oskariok,

    I was not able to run the program you proposed, the messages were: Cannot find object 'Dialogs' and 'Printing'

    Frank

    Sunday, September 5, 2010 10:03 AM
  • Hello!

    Thanks a lot for your answer.

    I Tried to access the address you gave to me and i receive the message below:

     

    We're sorry, this site is frozen.

    If you are the site owner, please

    click here to contact us

    regarding the status of your website.

    I'm very sorry.

    Are you Hungarian? I have some friends in Hungary. 

    Saturday, January 20, 2018 2:00 PM
  • This topic is more then seven years old. No wonder the links are dead.

    You can start on the SmallBasic website: http://smallbasic.com/


    Jan [ WhTurner ] The Netherlands

    Saturday, January 20, 2018 3:56 PM
    Answerer
  • About your question on How can I get a listing of a program made with Small Basic

    To print out your code listing:

    1. Save your code to a .sb file

    2.a. Then visit the folder (where you saved it) and select that .sb file -> Rightclick and 'Print' or SendTo->Printer

    or open your saved .sb file in Notepad, Wordpad or any text editing application and print it from there (usually 'Ctrl+P' or File->Print...)

    2.b. To print your saved .sb file programmatically, you can download and install LitDev extension from HERE (read the instructions there). After that you can print your code listing from a program, by using the command:

    LDFile.PrintFile("path\to\file.sb")

    PS: The site http://k-dev.webs.com/ is down and empty on the archives too.

    Saturday, January 20, 2018 6:17 PM
    Answerer