Whats so good about Pure Basic?

Everything else that doesn't fall into one of the other PB categories.
MJPK
New User
New User
Posts: 2
Joined: Tue Aug 16, 2005 4:33 pm
Location: Dorset UK

Whats so good about Pure Basic?

Post by MJPK »

Hi

I currently use Liberty Basic and am having a few problems with output to printers.

Does anyone have experience of LB and can advise if PB is better at database type operations.

I write programs to handle stock lists, accounts and other simple data entry type programs. My difficulty is with outputting to printer and displaying jpg type headers and boxed columns of figures.

Your comments would be appreciated.

Best regards

Mike
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

It sounds to me like you would benefit most from using a tool specifically designed to do the tasks you list. If I were writing an app whose main purpose was database gui, input and output I would probably look past most of the less expensive Basics and choose something like Delphi or Visual Basic, or maybe FoxPro or if you are on a budget, MS Access. All of these tools are well established, robust and more than suitable for the job.

PureBasic, like any language, has its own areas of strength, and unlike most, remarkably few weaknesses. However, it (for now) lacks some of the features necessary for the RAD development of database frontends. For example, a highly customizable data-aware grid control. I would consider that an essential tool for what you're doing, and you should use a dev package that has one. The programmers that use PureBasic are fanatical about it - and with good reason. It is fantastic! But no one tool is the absolute best at everything.

Make no mistake, PB can do what you want - it's just a matter of how much time and effort you are prepared to put in to get your results.
BERESHEIT
Brice Manuel

Post by Brice Manuel »

I currently use Liberty Basic and am having a few problems with output to printers.
Last I knew, LB does not have proper printer support. PureBasic does.
Does anyone have experience of LB and can advise if PB is better at database type operations.
Liberty Basic is the slowest language available for Windows and it has larger runtimes than VB 6. PB is extremely fast and produces tiny exes without the need for runtimes.

If you visit http://www.purearea.net/pb/english/index.htm and go to the "library" and "DLL" section, you will see some ready to use extended database libraries.

If you really want to use LB, you could check out http://alycesrestaurant.com. Alyce may have something to help you (but I am sure you already knew that).
Last edited by Brice Manuel on Tue Aug 16, 2005 7:00 pm, edited 1 time in total.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

There are no built in commands for making reports in purebasic, you have to build each report yourself, but it's has easy has drawing a picture on screen...

Take a look at a snippet:

Code: Select all

;
Procedure Print_file()
  
  result=PrintRequester()
  If result
    If StartPrinting("print_job")
      
      If StartDrawing(PrinterOutput())
        
        FrontColor(0,  0, 0)
        DrawingFont(LoadFont(0,  "Courier New", ycm(0.2)))
        
        DrawingMode(1)
        
        line.s=LSet("client #",12) ;/// Client
        line+LSet("ref. #",32) ;/// reference
        line+LSet("invoice #",12) ;/// invoice
        line+RSet("value",14) ;/// value
        line+RSet("date",12) ;/// date
        
        Locate(xcm(3),  ycm(0.5))
        DrawText (line)
        
        Line(xcm(0.50),  ycm(1), xcm(20.5), ycm(0))
        
        c=1
        b  = 0
        For a  = 0 To CountGadgetItems(#ListIcon_0)-1
          
          ;/// Shaded Boxes
          If c=1
            c=-1*c
            Box(xcm(1.5),  ycm(1.4  + (0.4  * b)),xcm(17),  ycm(1.4  + (0.4  * b)),RGB(210,210,210))
          Else
            c=-1*c
            Box(xcm(1.5),  ycm(1.4  + (0.4  * b)),xcm(17),  ycm(1.4  + (0.4  * b)),RGB(255,255,255))
          EndIf
          
          ;/// Draw Text
          FrontColor(0,  0, 0)
          line.s=LSet(GetGadgetItemText(#ListIcon_0,a,0),12) ;/// Client
          line+LSet(GetGadgetItemText(#ListIcon_0,a,1),32) ;/// reference
          line+LSet(GetGadgetItemText(#ListIcon_0,a,2),12) ;/// invoice
          line+RSet(GetGadgetItemText(#ListIcon_0,a,3),14) ;/// value
          line+RSet(GetGadgetItemText(#ListIcon_0,a,4),12) ;/// date
          Locate(xcm(3),  ycm(1.5  + (0.4  * b)))
          DrawText (line)
          b  + 1
          
          ;/// New page at 68 lines of text
          If b  = 68
            b  = 0
            NewPrinterPage()
            line.s=LSet("Client #",12) ;/// Client
            line+LSet("Ref. #",32) ;/// reference
            line+LSet("Invoice #",12) ;/// invoice
            line+RSet("Value",14) ;/// value
            line+RSet("Date",12) ;/// date
            Locate(xcm(3),  ycm(0.5))
            DrawText (line)
            Line(xcm(0.5),  ycm(1), xcm(20), ycm(0))
          EndIf
          
        Next
        
        StopDrawing()
      Else
        MessageRequester("error!", "there was an error while attempting to print" + Chr(10) + "please verify your printer!", #MB_OK|#MB_ICONWARNING)
      EndIf
      StopPrinting()
    Else
      MessageRequester("error!", "there was an error while attempting to print" + Chr(10) + "please verify your printer!", #MB_OK|#MB_ICONWARNING)
    EndIf
  EndIf
  
EndProcedure
Has for databases you can use one of two options:

An ODBC driver using PB built-in command set or an external DLL for Sqlite or MySql...

Personaly i use Sqlite, but i haven't tested it in Multi-User apps...
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

MJPK,

Take a look at Karbon's KBilling. Download the free trial, its very impressive. This will give you and idea of what PB can do.

http://www.k-billing.com

Karbon uses a PDF generation library.

http://www.isedquickpdf.com

Does Liberty Basic support the use of external dlls? If it does then a pdf library may solve you're problem anyway. Search the web and you'll find plenty of libraries.
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

When I need an app. NOW! (to .exe, folder of files, or to CD/DVD, direct burn) I turn to Autoplay Media Studio. R.A.D. it be.

On the other hand I find it lacks in some areas and that is when I choose to either use PB with AMS or I switch to PB. (PB apps are ultra fast and have a considerablly smaller footprint (.exe wise) and you can Win API... which rocks!)

So, it's for me a chose of using the right tool(s) for the job.

Best of luck...
Intrigued - Registered PureBasic, lifetime updates user
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Will you look at us all, trying to talk the guy out of Purebasic!

Purchase Purebasic, you won't regret it.

You applications will be smaller, leaner and faster.
MJPK
New User
New User
Posts: 2
Joined: Tue Aug 16, 2005 4:33 pm
Location: Dorset UK

Post by MJPK »

Thanks for replies.

It appears that my problems with LB has been as a result of using what I believed to be a mono spaced font that actually was not. There is a web site out there that claims “comic sans ms” is mono spaced, it’s not.

Having looked at Pure Basic I am impressed at the abilities I have seen so intend to explore further.

Answering some of the points made in the replies, I find that there are 3 types of programming tools.

The simple ones where you have to program every instruction yourself. You understand 80% of the language and use it. LB fits this, and I hope PB. (LB is structured very similar to Qbasic was)

The “do some it for you” type that requires you to learn not only how to use, but also how they achieved the results so that when problems arise they can be quickly traced. Probably less than 5% of available code is used with the rest I find difficult to understand. VB and Delphi come to mind.

Finally the “do most of it” type like Access and Excel. Again difficult to follow when problems arise.

My structure is very simple. Code to create new or update random access files that have comma delimiters. Code to create Input forms, query forms and display results. Finally code to produce printed results. In LB this coding takes up less than 50k and an hour to write. The weakness appears to be in the printed output. Files can be read using most database and spreadsheet applications. As a matter of interest I set up two duplicate stock systems, one created in Excel the other using LB. LB’s total storage took up 34Kb of space, Excels 7.8Mb.

Note: LB can call API’s and DLL’s.

Brice, your remark “Last I knew, LB does not have proper printer support. PureBasic does.”
Sorry to sound thick but can you expand on the proper printer support bit.

Thanks again for response and hopefully one day I will be able to contribute to the Pure Basic forum.

Mike
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Printing in PB is very simple. Its basically just a matter of:

StartDrawing(Printer())
Locate(10,10)
DrawText("Header")
DrawImage(#Logo,100,10)
StopDrawing()

etc...
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

PB advantages

Post by PB&J Lover »

PB has many advantages over LB for what you want to do. There is a whole set of database commands (native) that I use to do ODBC queries of FileMaker.

The print functions are great too and pretty easy to use. Here are the main advantages (some of them):

PB is faster and you can use fewer variable since each command can stand in for a variable (not so with LB). For example you can send data directly into or out of a file without variable:

Code: Select all

      If DatabaseQuery(SQL$) And flResult <> #False
          UseFile(flResult)
           NextDatabaseRow()        
             nCols = DatabaseColumns()
                    WriteStringN(Str(nCols))
                  For index = 0 To nCols - 1
                    WriteString("Col: "+Str(index)+" Typ: ")
                    WriteStringN(Str(DatabaseColumnType(index)))
                    WriteStringN(DatabaseColumnName(index))
                    WriteStringN(GetDatabaseString(index))
                  Next index
          CloseFile(flResult)        
        Else
This code dumps ODBC data directly into a file. Putting it in a variable first slows it down quite a bit. To send something to the clipboard it is just SetClipboardText("TEXT") not some lengthy API call.

This is all it takes to print a report from a editorgadget:

Code: Select all

              Case 9  ; Print Current Report
               LineCount.l = 0 : TotalLines.l = CountGadgetItems(Editor)
               If TotalLines
                 If DefaultPrinter()
                  If StartPrinting("Inspection Report: "+FileName$)
                    If StartDrawing(PrinterOutput())
                      DrawingFont(LoadFont(0,"Courier New",70, #PB_Font_Bold))
                         For index = 0 To TotalLines - 1
                           LineCount + 1
                              Locate(10,LineCount*100)
                              DrawText(GetGadgetItemText(Editor,index,0))
                           If LineCount > 60 : NewPrinterPage() : LineCount = 0 : EndIf
                         Next index
                      StopDrawing()
                    EndIf
                    StopPrinting() : Warning(116) ; Document sent to Default Printer!
                  EndIf
                 Else
                    Warning(117) ; No Default Printer Detected!
                 EndIf
               Else
                    Warning(118) ; No Lines to Print!
               EndIf
Most things in PB are straight-forward. When you want text from a text box in PB is it GetGadgetText(#TextBox1) which can stand in for a variable: WriteStringN(GetGadgetText(#TextBox1)). In LB you "print" a message to the textbox and the contents are returned to a variable: print #Textbox, "!contents? Variable$".
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

purebasic is a very easy language with tons of commands to create in a very short time big window applications, games and so on! The compiled programs are running very fast and the filesize is very small indeed! ++++ for PureBasic! ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Post Reply