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... ==================================================================== 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-2009 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. (888) 659-8000 Sales 2061 Englewood Road (941) 473-7300 Voice Englewood, FL 34223 (941) 681-3100 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. ====================================================================