January Seventeenth 2008 From: Bob Zale, President PowerBASIC, Inc. PowerBASIC Gazette #58 ====================== Subject: Add ScrollBars to a Graphic Window =========================================== Graphics in general is a great topic for PowerBASIC programmers. Thay add spice and "pizazz" -- your code comes alive! That's why we added an extensive set of GRAPHIC functions to both PB/CC and PowerBASIC for Windows. They're fast, complete, and they handle all those messy Windows details for you... automatically! It's good to know that graphics in PowerBASIC are persistent. You create it once... and forget it. You'll never need to worry about redrawing or "double buffering" with PowerBASIC. When your graphic is temporarily covered, or when the window is minimized, PowerBASIC handles all the messy details automatically! When the window is again made visible, PowerBASIC restores the graphic instantly. It's just that simple. Very nice. First things first. To create a graphic, you'll need a "canvas". That's a special DDT workspace where you can draw your work of art. For the moment, we'll assume you're using a GRAPHIC WINDOW, which is available in PowerBASIC for Windows, or the PowerBASIC Console Compiler. However, the same techniques can be applied to a GRAPHIC CONTROL on a PowerBASIC Dialog. A GRAPHIC WINDOW is a separate window which can be placed at most any position on your desktop. You can create any number of them, and PowerBASIC will see to it that they all co-exist gracefully. You create a new GRAPHIC WINDOW with: GRAPHIC WINDOW caption$, x&, y&, wide&, high& TO hWin??? The first parameter caption$ specifies the text to be displayed in the title or caption bar of the Graphic Window. If caption$ has a length of zero, the window is displayed with no title bar at all, so the appearance is different and the window can not be dragged by the user. Next, x& and y& specify the location of the new window, in pixels, relative to the upper left corner of the screen. Then, wide& and high& specify the actual size of the new window, given in pixels. Finally, hWin??? is a DWord variable which receives the handle of the newly created window. This handle is used to identify this window with other PowerBASIC statements. If the window can not be created, then hWin??? is set to zero to advise you of the failure. Now that you have a window, you can use other GRAPHIC functions to display text in any font, any size, any color. You can draw lines, circles, polygons, ellipses, rounded rectangles and more. You can add bitmaps of any complexity -- stretch them or shrink them -- whatever suits your needs. But, what if you need to display a GRAPHIC which is larger than the GRAPHIC WINDOW? Now, we have a solution for that, too! Just add a vertical scrollbar, a horizontal scrollbar, or both of them! To be perfectly honest, Windows doesn't make it easy. Scrollbars need quite a bit of care to ensure they'll do exactly what you want and need, and here's the code to do it. Just GOTO http://www.powerbasic.com/support/downloads/files/grsb.zip and download this small ZIP file. You find the complete source, and a demo executable, to add scrollbars to a PowerBASIC GRAPHIC WINDOW. There's even a nice BitMap file, to show off these new capabilities. So, get it now... I'm pretty sure you'll be favorably impressed. Built with PowerBASIC ===================== Do you have a software product created with PowerBASIC? It could be a commercial product, shareware, even freeware. Do you have a web site to promote it? If so, I'd like to offer you some extra promotion, and it's absolutely free! We added a new web page, called "Built with PowerBASIC". Here, we showcase information about dozens of products created with one of the PowerBASIC compilers. We want to add your product, too! It can be any type of software product... accounting, development, financial, scientific, graphics and games, almost anything. Check out the current page right now. Just GOTO http://www.powerbasic.com/bw/ Ready to share your program with the world? Just send your product name, company name and address, web and email address, a product description, price, and a graphic (your logo or even a screenshot) to webmaster@powerbasic.com. Review our fictional listing page at http://www.powerbasic.com/bwsample/sample.html for some additional information and guidelines. But, please note that text description space is limited. Summarize your product description in a single paragraph of 150 words or less with no "bullet points". Make every word count in a way that entices readers to click through to your web site for all the spicy details. If you can't supply a graphic, that's ok, too. We'll just use a generic "Built With PowerBASIC" logo for your listing. Plain text for all information is preferred. Links to www.powerbasic.com =========================== Since we're talking about links, we'd appreciate your help, as well. If you have a web site, on most any topic, we'd sure appreciate a link to our site from yours. You can choose one of our graphics from http://www.powerbasic.com/banners to link to us. When your link is up and running, please let us know? We'd love to take a peek at your work! PowerBASIC Forums ================= Be sure to visit us soon on the web! Remember, the PowerBASIC Forums are brand spanking new! All new forum software, with a fabulous search facility, private message, graphic attachments, and so much more. The all new PowerBASIC forums now sport more than 273,000 messages from good programmers just like you. They ask questions, they get answers, and so can you. Just click... http://www.powerbasic.com/support/pbforums/index.php We'd love to see some of your latest code! We'd love to see your questions and answers. So would thousands of others, and they'll respond in kind! Lots more to follow on the web... and the next PowerBASIC Gazette! Tell a friend about PowerBASIC? =============================== Would you help spread the word about PowerBASIC? You know, you're the world's best advertisement. And every time we add a PowerBASIC customer, it helps PowerBASIC, and it helps you, too. Every new user is an investment in the future... with more users, we'll create better products, deliver them sooner, and keep the pricing right for you. How about it? Will you tell a friend about PowerBASIC? I hope so. We'll make it easy for you to "Share the Power"! Here's the plan... You give us a name (or a few names), and we'll send just one short, informative e-mail, using both your name and ours. We won't follow it up. In fact, we'll never use their e-mail again, unless they choose to sign up for The Gazette. So, Share the Power! Just GoTo... http://www.powerbasic.com/bin/ps.exe You'll see the text of the message and add a contact name! The message is harmless, yet informative. And just think of the compilers we could build for you if everyone brought just one new PowerBASIC user! PowerBASIC Documentation Online =============================== Do you still have questions about PowerBASIC? Care to look over the exact syntax and specification of our products? An instant solution: Visit today at http://www.powerbasic.com -- then click HELP DESK... You'll find the complete help file and documentation for PowerBASIC Console Compiler 4, PowerBASIC 8 for Windows, and PowerBASIC FORMS! Every statement and function defined. Every page of the User's Guide. The index and table of contents. Everything you need to gain o very good grasp of our compilers. All created in the latest forms of HTML help files. You really should check it out today... Visit today at http://www.powerbasic.com -- then click HELP DESK... Time for a "Hard Break" {smile} =============================== Since I have your attention, can I take take a small commercial break? Just in case you haven't yet upgraded both compilers, now is the time! How can you join in the fun without the new versions? Get them now, while you can take advantage of Upgrade Pricing! PowerBASIC 8 for Windows is priced at $199, but the upgrade from PBWin 7 is just $99. PowerBASIC Console Compiler 4 is priced at $169, and the upgrade from PBCC 3 is just $89. PowerBASIC Forms, our visual designer, is $99, but the upgrade from version 1.0 is just $39. With prices like these, how can you go wrong? We don't believe in BloatWare, and we don't believe in $2,000 compilers. We just "Compile Without Compromise". You'll get Graphics... Lines, Arcs, Fills, Ellipses, Polygons, and more. Proportional text in any font, any size, any style, any color. Custom scaling systems, even with fractional floating point coordinates. Copy and stretch bitmaps, even to a printer page. Perhaps most important -- we'll extract Device-Independent Bitmaps you can manipulate yourself for incredible power and speed. Then there's USB printing. All the power of screen graphics transferred to the printer. Any font, any size, style, or color. Graphic primitives, Bitmaps, and more. Printer selection and setup dialogs. Everything you need to print your latest work of art, or your latest business form. And it's just as easy as the old LPRINT. You'll get graphics that are truly extensible. Using the Device Context (DC) from PowerBASIC, you can call the Windows API, your own custom code, even third-party code for special graphic functions. And with the new GRAPHIC GET/SET BITS, you can even manipulate the bitmap directly... each pixel is stored in succession as a long integer color value. You'll get new variable types. Just for that "special situation". BIT and SIGNED BIT variables in TYPES and UNIONS. Each may be from 1 to 31 bits wide, packed one after another. Perfect for bit coding, or even translation from C code. For "Thread Local Storage", you'll get the new THREADED variables... each thread gets a unique copy of your data. And FIELD variables? They work with the new FIELD statement, just like you had in DOS. A FIELD is a string, mapped to a specific section of a file buffer, or another string. They're allocated at run-time, so they can be changed as needed. Much like a TYPE that can be altered under program control. Best of all, a new internal design makes them fast, fast, fast! Pointers are great, but sometimes the syntax is daunting, particularly for very simple tasks. So we implemented Dynamic Pointers, using the original PEEK/POKE as a model: xx# = PEEK(DOUBLE,addr&) This retrieves the double precision value stored at addr&, assigning it to xx#. Very straightforward and it works for all data types. And unlike the old PEEK and POKE, it's just as fast as a pointer variable! Speaking of simplification, DIM, LOCAL, STATIC, GLOBAL, and RESET can use a list of variables, like: STATIC abc, bcd, xyz AS STRING. ARRAY ASSIGN lets you assign values to every element of an array in a single statement! More tools for error processing? RESUME lets you retry the statement which failed, while RESUME NEXT just skips to the statement which follows it. And, for a great debugging tool, ERL returns the line number which precedes the error. For PB/CC, you'll get new console functions: define a screeen buffer larger than the screen, then treat the console as a moveable view port. Move the console window on the desktop, get its size, even set the focus. END is back for DOS compatibility, while KEY and KEY$() assign strings to the function keys. Even INPUT is back with multiple variables. Just think how easy DOS conversion will be. PB/WINDOWS gets some specialties, too. Dialogs, and their controls, now have a PIXEL option -- just in case you want more precision than dialog units, while DIALOG SET CLIENT lets you resize to a specific client area size, regardless of styles. There's even a new GRAPHIC control for all your special designs. Both compilers offer even more... Multiple ALIAS declarations. DESKTOP functions to get all the sizes, #COMPILER to specify which compiler should be used. JOIN$, PARSE, and PARSE$ offer binary options for better, faster packing. LEFT$, MID$, and RIGHT$ support negative lengths to return LEN(x$)-n bytes. Then there's BGR and an ENVIRON statement, too. FILEATTR enumerates file numbers currently in use, while HI, LO, MAK, and BITS are greatly expanded. We even have NUL$, and SHELL with a HANDLES option. The PowerBASIC IDE (for both compilers) had a serious makeover. You'll really like the results. First, the editor has BLOCK INDENT/OUTDENT and BLOCK COMMENT/UNCOMMENT! Then add more undo buffer space, bookmarks in the editor, and source file templates for that tiresome boilerplate code. There's faster debug load/unload, and file save with tab compression for even smaller source files. The debugger and editor are unified, so you can set breakpoints in advance, even in include files. How many times have you wondered "Is there an array bounds error somewhere?" or "Where's that pointer error?" Well, here's how you find it! Just set the debugger "BREAK ON ERROR"! Your program runs normally, in the debugger, but halts as soon as any error is generated -- even if you have no error handlers installed. The new watch windows are moveable and resizable -- and all dialogs remember the last used size and location. Help files for add-ons are supported, and there's a direct link to Win32 API help, too. With all this, debugging might now be fun! More information? Sure, it's very simple. Just click to go to each or all of the PowerBASIC product pages... PB/CC 4.0: http://www.powerbasic.com/products/pbcc/ PB/WINDOWS 8.0: http://www.powerbasic.com/products/pbdll32/ PowerBASIC FORMS: http://www.powerbasic.com/products/pbforms/ PowerSHIRT 1.0: http://www.powerbasic.com/products/pbshirt/ PB/WIN 8 is attractively priced at $199, while PB/CC 4 is just $169. Upgrades from versions 7 and 3 are just $99 and $89 respectively. PowerBASIC Forms is priced at $99, while the upgrade to version 1.5 is $39. You can order by replying to this email. You can call us today at (800)780-7707 or (941)408-8700, place an e/order on our secure web site https://www.powerbasic.com/shop/ or even mail it in. But no matter what method you choose, please do it today with confidence. Every product PowerBASIC shipped for physical delivery is offered with a money-back guarantee for a full 30 days from the transaction date. Best regards, Bob Zale, President PowerBASIC Inc. p.s. Don't forget PowerSHIRT version 1.0! The new PowerBASIC T-Shirt! It's a high quality, black T-Shirt, emblazoned with "PowerBASIC.COM", and a personal motto "I Compile Without Compromise". You couldn't be more stylish! The PowerSHIRT 1.0 is available in sizes M/L/XL, and priced at just $19.95. http://www.powerbasic.com/products/pbshirt/ =================================================================== PowerBASIC Price List ------------------------------------------------------------------- PB/CC Console Compiler 4.0 - Full Product $169.00 PB/CC Console Compiler 4.0 - Upgrade from ver 3 89.00 PB/CC Console Compiler 4.0 - Upgrade from ver 2/earlier 119.00 Add Printed Documentation 39.00 ------------------------------------------------------------------- PowerBASIC for Windows 8.0 (GUI) - Full Product $199.00 PowerBASIC for Windows 8.0 - Upgrade from ver 7 99.00 PowerBASIC for Windows 8.0 - Upgrade from PB/DLL 6/earlier 129.00 Add Printed Documentation 39.00 PowerBASIC FORMS Visual Designer fro PB/Win 99.00 ------------------------------------------------------------------- PowerSHIRT 1.0 T-Shirt (M/L/XL) $19.95 ------------------------------------------------------------------- PowerBASIC for DOS 3.5 - Full Product $99.00 PowerBASIC for DOS 3.5 - Upgrade from prior versions 49.00 Add Printed Documentation (2 book set) 29.00 ------------------------------------------------------------------- PowerTree B+Tree Manager for DOS and Windows $99.00 PB/Vision for DOS 20.00 PB/Xtra III for DOS and Windows 49.00 ------------------------------------------------------------------- Console Tools Standard: 49.95 Console Tools Professional: 99.95 SQL Tools Standard Version: 99.95 SQL Tools Professional Version: 199.95 Graphics Tools Standard ver 2: $69.95 Graphics Tools Professional ver 2: 139.95 ------------------------------------------------------------------- Shipping/Handling costs: Software & Each Any Software 1 or 2 books Addl Book Email $6 N/A N/A UPS Ground/Mail US $10 $10 $8 Express 2-day US $16 $16 $8 Express 1-day US $28 $28 $8 Air Mail Canada/Mex $12 $22 $8 Air Mail Intl $16 $28 $8 DHL Express Intl $34 $44 $8 PowerSHIRT T-Shirts are shipped by postal mail for one shipping fee, regardless of quantity. North America: $6 Elsewhere: $12 ------------------------------------------------------------------- Order online at https://www.powerbasic.com/shop/ or just send an email with all pertinent information to sales@powerbasic.com We'll take it from there! ------------------------------------------------------------------- Most PowerBASIC products (those without printed books) can now be delivered by electronic mail. No wait for a package to arrive... No high shipping costs... For just $6 per order, no matter how many products, we'll deliver directly to your computer. If you're outside the U.S., savings might be greater. You won't pay taxes or duties to a freight company or postal service, because they aren't involved in the delivery. Check your tax code to be sure, but some countries charge no tax at all on transactions of this type. It could just be your lucky day! ==================================================================== Is your PowerBASIC Gazette Electronic Edition subscription coming to you at home or work? If you don't want to miss a single issue, why not subscribe from both email addresses? Send your subscription request to email@powerbasic.com and please include your name and all email addresses you'd like to add as well as your Zip or Postal Code. If you know someone else who would enjoy this newsletter please forward a copy to them so they can subscribe. ==================================================================== All contents Copyright (c) 2008 PowerBASIC Inc All Rights Reserved. PowerBASIC, PB/CC, PB/DLL, PowerBASIC Forms, and PowerTREE are trademarks of PowerBASIC Inc. Other names are trademarks or registered trademarks of their owners. ==================================================================== PowerBASIC Gazette - Electronic Edition Volume 1 - Issue 58 PowerBASIC, Inc. (800) 780-7707 Sales 2100 S. Tamiami Trail (941) 408-8700 Voice Venice, FL 34293 (941) 408-8820 Fax Visit us on the World Wide Web at www.powerbasic.com Email PowerBASIC Sales at sales@powerbasic.com This newsletter is only sent to email addresses in our subscription list. If you have received this newsletter by mistake or no longer wish to receive it, please send a simple unsubscribe request to support@powerbasic.com with your name and zip/postal code. This newsletter is best viewed with a fixed-width font. ====================================================================