RapidQ Documentation Project

Release 09 (January 5, 2005)

I. | Documentation
II. Index
  1. Alphabetical
  2. By Category
III. | Custom Components
IV. | Frequently Asked Questions
V. | Known Bugs
VI. | IDE's
VII. | Links & Examples
VIII. About
  1. RapidQ
  2. RPDQ

CHM Conversion by Mikko Hollmén Olesen
CHM Version: 9.05.01.22


RQDP-Preface

Rapid-Q Documentation Project (RQDP) | Release 09 21.01.05
http://groups.yahoo.com/group/rapidq/ | Main Rapid-Q discussion group
http://groups.yahoo.com/group/Rapid-Q/files/Rqdp.zip http://www.wildgardenseed.com/RQDP/RQDP.ZIP - mirror | ZIP Archive of this site
Rich Edit Controls.zip (300 k) | This section contains information about the programming elements used with rich edit controls
http://www.wildgardenseed.com/RQDP/inc.zip - 728 k | Files that are needed for using custom components
WIN32API.ZIP - 144,311 b | Win32 API declarations for Rapid-Q
WINDOWS.ZIP -194,394 b | WINDOWS.INC for 32 bit MASM (Version 1.25a) 22 October 2001
New RapidQ inc files and new documentation |
For more links |

b) The Rapid-Q Documentation (original Preface)
by william Yu, last update of the documentation: august, 29, 2000

A lot has changed since the initial release of Rapid-Q, but one thing that hasn't changed is the fact that Rapid-Q is constantly being upgraded almost daily. The overall goal still exists, to provide an alternative BASIC programming language that's not only FREE, but good and easy to use. Being a BASIC programmer at heart, I looked through the eyes of a user, and added the features and ease of use that I like to see in a good programming language. Some of the features you see are spawned in part by our excellent Rapid-Q user base. Requesting features is one way this project can succeed, since there are many out there that share the same vision. Perhaps in the future, some of these features will become standard in all BASIC languages. If you're familiar with either QBasic, PowerBasic, or even VisualBasic, you'll be able to program in Rapid-Q in no time. The advanced features that Rapid-Q offers need not be used at all, but is available when you get more comfortable with the language itself. For example, Rapid-Q offers object/component creation, function pointers, procedures with infinite parameters, variants, and overloaded macros, while still maintaining all the fundamental features that most BASIC programmers are familiar with, ie. GOTO, GOSUB, line numbers, etc... This makes converting legacy code much easier. The only feature which deviates from traditional BASIC languages is file handling. I believe that once you understand how file and memory streams work, this can be a huge benefit, rather than a hassle. For those who aren't aware, Rapid-Q is a 32-bit multiplatform GUI and CONSOLE BASIC compiler/interpreter for Windows, Linux, and Unix. Rapid-Q compiles your BASIC source code into byte-code, which is normally attached to an interpreter, but can also be run from other programming languages using specialized DLLs.

About this document These chapters were written and rewritten as new features were added, which means that it's quite possible you'll find some inconsistent or obsolete comments and code. If you spot one of these, please send me an e-mail so I can remove/change it.

Source Codes I have always stressed that the best way to learn is by example. It really isn't enough just to look at it and say "Uh huh, yeah." Take some time to take it apart and rewrite the code yourself. Trial and error is always a good way of learning. It seems we learn more by our mistakes, this is also true for programming. Yes, you'll have many nights of frustration when your code just doesn't seem to run properly, but once that bug is found, you'll be dancing around like there's no tomorrow. I'm also maintaining a knowledge base of some of the many questions that I've received from fellow Rapid-Q users. You can find a link to this on our homepage. Another site that I maintain is the All Basic Code Archives at http://www.basicguru.com/abc/ which consists of over 2600 BASIC source codes and hundreds of BASIC related resources.

Rapid-Q Audience Being a BASIC programming language, I've targeted BASIC programmers, primarily beginner to intermediate BASIC programmers, but even advanced programmers have used Rapid-Q at some point. My future goal is to integrate Rapid-Q in a classroom, such as in junior/senior high school, or even in college.

The Future of Rapid-Q Obviously expanding Rapid-Q by adding new features is something that will continue in the future, but I also plan on open sourcing Rapid-Q when I've done all I can. This of course can't be guaranteed, and there's no telling when this decision will be made. It's likely that the Linux/Unix version will be open source sooner than the Windows version.

Comments & Suggestions I appreciate all comments, suggestions and constructive criticism. I would also like to extend thanks to all beta testers for their help and suggestions. The best way to voice your opinion is on our mailing list, this way we can all discuss the problem or suggestions that you may have. However, I don't discourage individual e-mails, so feel free to contact me and I'll try to get back to you ASAP.

E-mail me William Yu <voxel@edmc.net>


RQDP-Hystory

Rapid-Q Documentation Project (RQDP) | Release 01 Hystory
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | hystory.html/Serban Stanescu/None/01

April 2001 May 2001 June 2001 July 2001 August 2001 September 2001 October 2001 November 2001 December 2001
Last update

c) The Rapid-Q Documentation Project Hystory
by rapidQProjects, last update of the documentation: june, 11, 2001

30th April, 2001: The work begins. The documents are very difficult to use. You just can't go up/down, get to a specific section and so on. The only way you can navigate is using "contents.html". Not very convenient though.

10th May, 2001: Three new docs added: "indexalfa.html" - the framed main document; "indexa.html" - alphabetical index of terms; "indextitlu.html" - the title page. The hard working starts: lots of references needed to link the terms to documents, or to specific sections of documents. Test release: RQD01.zip, at
w.w.w.groups.yahoo.com/group/RapidQProjects/files
Up

6th June, 2001: The Hell begins: Trying to view the new docs with I.E. 4.0 I receive a dissappointing result: more than a half of the new links are rendered different than under I.E. 5.5. (that is on my current machine). A pale hope: Netscape 6.0! But... My hope was broken down by the brand new Netscape! Same rendering as I.E. 4.0!! I don't know what to do?!! All the work in vain???!!!

8th June, 2001: After 2 days of break, I'm getting back to work: ALL documents need to be reformatted! The project goes too slow, eating my time at light speed. Something crosses through my mind: what about the "Opera 5.0" ? I haven't tested the docs with this browser though I use it. Test results = OK. Cheer up boy, time to go to the next task!
First conclusions:
  1. The test release works fine on Internet Explorer 5.5 or higher, and on Opera 5.0 or higher (download it, it's free!)
  2. Fails rendering correctly in I.E. 4.0 and Netscape Navigator 6.0 (!!!)
  3. ALL documents need reformatting: (:-(( ... "The show must go on!"
  4. New documents needed (existing apps, controls, sorcecode titles...)
  5. Too many dead links in the original test-release. Can't download it to "rapidq" group yet.
  6. A list of contributions needed: there's already a lot of stuff and many of the group members don't know exactly what and where... (what about the others?)
9th June, 2001, 15:00': Planning to release this document, as a preview. Probably later (maybe tonight?)
Solved most of the dead links. Some others still left. Can't find references. I'll dig some more.
9th June, 2001, 16:00': Two new assignments. That means a delay of at least 3 days but means also money. I have to earn my living, don't I? 'Think I'll download this now and later (??) the rest. It's obvious I can't go further for the next 4-5 days.
9th June, 2001, 19:00': (...) The file has been uploaded.
Others:
  1. Changed the Main Page, "indexalfa.html";
  2. Changed the title page, "indextitlu.html";
  3. Created "sitemap.html" and "siteindex.html";
  4. Updated links to fit new layout;
  5. Updated "index.html" layout;
  6. Updated "pref01.html"; (hystory and links)
  7. It seems that this file has to be splitted into two :"pref02.html" and "rqdphistory.html". Hystory section grows too fast and makes navigation difficult, especially in code, when changes are made;
  8. Added "faq.html" (empty though...)
11th June, 2001: 9:00':
  1. Added 2 pages: Programmer's Guide Main Page= "pgmainpg.html", and PG Title page "pgtitle.html";
  2. Splitted "pref01.html" into "hystory.html" and "pref01.html";
  3. Updated "pref01.html"; (hystory and links)
12th June, 2001:
21:30':
  1. Added pages: Programmer's Guide Index = "indexpg.html", FAQ Index, "indexfaq.html", FAQ Title page, "faqtitle.html", FAQs: "faq001.html", "faq002.html",
  2. I've been working all the day. I've done my best to include Andrea's Fink FAQ ASCII file (first release) into Release 01, but I'm not sure I can do it, without delaying many days the first release.FAQ Section needs a lot of workaround. File is 3,958,110 bytes... It's simply unuseable! It loads like a turtle (Wrong! Turtles move lot faster...) I have to spilt it into small pieces, and then turn those into HTML. How long will it take? I'm running out of time... I haven't done anything for my assignments : -( , and I got the payment in advance... : -- (( OK! Time out for today! (14 hours of work?!? Where am I supposed to get?...) I need heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelllllllllllllllllllpppppppppppppp!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Moving to another task (That's what's Window$ for, multitasking, ay?!) See ya... (tomorrow?) ...when I'm done with those graphics. 'One has to earn money... (@#!*~!##@_ :--@/!~`#$$$!!!) That is:
    May's phone bills:
    32.68$ : - (
    May's income : )
    34.60$
    May's profit:
    1.92$ (??!??) Ain't that great?

           (:-|_
                ~
  3. Updates: hystory and links
15th June, 2001:
24:00':
  1. Added pages: AS Keyword= "askeyword.html" - not finished though...; P. Guide: Introduction "pgintro.html"; page template "pgtemplate.html"; P. Guide Contents "pgcontents.html"; FAQs: no FAQs today...
  2. I've been very tired -haven't sleeped for more than 20 hours. I couldn't do very much, I had some other assignments. Maybe today I'll be able to add some progress to the project. I need reference on QD3DANIMATION, QD3DANIMATIONSET, XREPLACE$ at "Documentation" section (the old one). That will be all for the first Release. I will use a search engine I found on the NET: Agent Ransack 1.2. ,. I'd like to add some more FAQs though. We'll see.
  3. ToDo: Ckeck links; delete unused files; pack distribution; create missing files/links; continue splitting FAQ source file; create page templates (for Documentation section, FAQ section, Programmer's Guide section, and Do It By Example subsection), create sample code list, descriptions of codepieces, update index file at P. Guide, build it at FAQ section, rebuild site index, add links to files, rebuild site map... probably there are some others, I don't have them in my mind now... I need to rest, and review all project. Write message for the group. Ask for new code samples (if any), other ideas, suggestions. Figure out to build a RQ distribution, with SETUP and complete files kit. Test all pieces of code I have; screenshots for them
  8. Updates: hystory and links
18th June, 2001:
11:00':
  1. New docs: in Programmer's Guide, page Events "pgevents.html" ; Methods, "pgmethods.html"; How To..., "pghowto.html"; Objects List, "pgobjectslist.html"; Properties, "pgproperties.html"; Sample Code List, "pgsamples.html"; To Do... List, "pgtodo.html".
  2. Reformatted some old docs.
  3. Tested with: Internet Explorer v. 4.0 & 5.5; Opera 5.02; Netscape 6.0. THIS TIME IS OK!
  4. Wiped garbage from distribution;
  5. Tested some methods to pack: Unpacked size = 1,209,299 bytes; Zipped with ZipCentral 3.0 = 413.647 bytes; Exed with ZipCentral 3.0 = 453,695 bytes for "rqdp-rel01.exe" (lost 40,048 bytes, not very much though... :) );
  6. Finallizing release files, writing mail, packing, testing installation... Done!
  7. Releasing: 12:30 (GMT+2, summertime hour).
  8. Next targets: Gather bug reports; bugfixes; start next stage: Programmer's Guide; build update tool. Bye for now...
  9. Updates: hystory and links
??th ??, 2001:
??:00':
  5. Updates: hystory and links

Up


Table of Contents

RapidQ Documentation Project

Rapid-Q Documentation by William Yu ©1999-2000 Contents

Contents

  • Preface
    Chapter 1: Rapid-Q Overview
    • 1.1 How slow is Rapid-Q anyway?
    • 1.2 What about bloat-ware?
    • 1.3 Does Rapid-Q require any extra runtime DLLs?
    • 1.4 How much memory does Rapid-Q suck out of my programs?
    • 1.5 How easy is it to hack into my programs?
    • 1.6 Do I need a license to distribute my programs?

    Chapter 2: Rapid-Q Fundamentals

    • 2.1 Rapid-Q Environment
      • Required files and settings
    • 2.2 Using the Rapid-Q IDE
    • 2.3 Compiling and Running a Simple Application
    • 2.4 Command line switches
    • 2.5 General Structure of a Rapid-Q Program
    • 2.6 How close to the BASIC language is Rapid-Q?

    Chapter 3: Rapid-Q Language Guide

    • 3.1 Rapid-Q Directives
      • $APPTYPE
      • $DEFINE and $UNDEF
      • $ESCAPECHARS
      • $IFDEF and $IFNDEF
      • $INCLUDE
      • $MACRO
      • $OPTIMIZE
      • $OPTION
      • $RESOURCE
      • $TYPECHECK
    • 3.2 Variables and Assignments
      • Numeric types, string types
      • Numeric Range values
      • Proper assignment, and inconsistencies
    • 3.3 Rapid-Q Components/Objects
    • 3.4 Component Methods & Events
    • 3.5 Rapid-Q Subroutines & Functions
      • Special conditions
      • Passing by value or reference
    • 3.6 Rules of Scope

    Chapter 4: Writing your first Rapid-Q Application

    • 4.1 Deciding what to write
      • Simple database like program
      • Using QButton, QEdit, QForm, QLabel, and QListBox
    • 4.2 Designing the form
    • 4.3 Handling events
      • How to handle on click events
    • 4.4 Source Code Listing

    Chapter 5: Introduction to Forms

    • 5.1 What's in a form?
    • 5.2 Adding components to a form
    • 5.3 Tracking mouse position on form
      • Introduction to MouseX and MouseY
    • 5.4 Special Events for forms
      • OnResize, OnKeypress, OnKeydown
    • 5.5 Dialog boxes
      • Use of ModalResult
    • 5.6 Using the CREATE Method
    • 5.7 Embedding CREATEs
    • 5.8 Creating Menus

    Chapter 6: Writing Console Applications

    • 6.1 Overview of console functions
    • 6.2 Hello world example
      • Writing/Copying to/from offscreen pages
    • 6.3 Using PEEK and POKE
    • 6.4 Accepting user input
    • 6.5 Trapping extended keys
    • 6.6 Mixing CONSOLE with GUI
    • 6.7 Linux/Unix console

    Chapter 7: Introduction to streams

    • 7.1 File streams
      • Reading/Writing numbers and strings
    • 7.2 Memory streams
      • Copying between streams
    • 7.3 Saving/Loading UDTs and Arrays

    Chapter 8: Using Image Resources

    • 8.1 Supported Resources
    • 8.2 Introduction to Image lists
      • More on Rapid-Q's image cache
    • 8.3 Other kinds of Resources

    Chapter 9: SUBI, FUNCTIONI, and DLLs

    • 9.1 SUB/FUNCTIONs with variable parameters
    • 9.2 More on FUNCTIONI
    • 9.3 Introduction to DLLs
    • 9.4 How to call a DLL
    • 9.5 Using Quick View
    • 9.6 Writing your own DLLs
    • 9.7 Using unsupported types in DLL call
    • 9.8 API conversion table

    Chapter 10: Creating Custom Components

    • 10.1 Introduction to object creation
    • 10.2 Extending QCanvas
      • Adding new properties
      • Using Constructor
    • 10.3 Adding/Overriding Methods
    • 10.4 Defining Events
      • Inherting Events
    • 10.5 Adding components to components
    • 10.6 Extending empty components
    • 10.7 Public/Private properties and methods
    • 10.8 Templates and property sets
    • 10.9 Creating custom events
    • 10.10 QDiamondBox Source Code Listing

    Chapter 11: Using Function Pointers

    • 11.1 Introduction to the concept
    • 11.2 Defining function pointers
    • 11.3 Using function pointers properly
    • 11.4 What's not supported in Rapid-Q

    Chapter 12: Graphics under Windows

    • 12.1 Graphics under DOS versus Windows
    • 12.2 What components require painting
    • 12.3 Drawing graphics dynamically
      • Using QBITMAP as the off-screen page
    • 12.4 Ownerdraw List and Combo Boxes
      • Ownerdraw Variable vs. Fixed
    • 12.5 Using DirectX

    Chapter 13: Direct3D for Rapid-Q

    • 13.1 Requirement specifications
      • Required or suggested files
    • 13.2 Using Anim8or to create 3D models
    • 13.3 Loading/Using .X files
    • 13.4 Wrapping textures around an object
    • 13.5 Rotate/Moving objects

    Chapter 14: Programming in MySQL

    • 14.1 Quick introduction
      • Required files
    • 14.2 Connecting to MySQL
    • 14.3 How to perform queries and obtain result
    • 14.4 Interfacing QMYSQL with QSTRINGGRID
    • 14.5 Storing and retrieving blobs
    • 14.6 Using LOADBLOB and SAVEBLOB
    • 14.7 In conclusion

    Chapter 15: COM Programming

    • 15.1 Supported COM extensions
      • COM clients (automation controllers)
      • Active Documents
      • How to register COM objects
    • 15.2 About QOLEOBJECT
    • 15.3 About QOLECONTAINER

    Appendix A: Rapid-Q Component/Object Reference

    • APPLICATION (Windows/Linux)
      • Properties, Methods Application examples
    • CLIPBOARD
      • Properties, Methods ClipBoard examples
    • PRINTER
      • Properties, Methods Printer examples
    • QBITMAP
      • Properties, Methods QBitmap examples
    • QBUTTON (Windows/Linux)
      • Properties, Methods, Events, QButton examples
    • QCANVAS (Windows/Linux)
      • Properties, Methods, Events, QCanvas examples
    • QCHECKBOX (Windows/Linux)
      • Properties, Events, QCheckbox examples
    • QCOMBOBOX (Windows/Linux)
      • Properties, Methods, Events, QCombobox examples
    • QCOMPORT
      • Properties, Methods, Events, QComPort examples
    • QCOOLBTN (Windows/Linux)
      • Properties, Methods, Events, QCoolbtn examples
    • QDIRTREE
      • Properties, Methods, Events, QDirTree examples
    • QEDIT (Windows/Linux)
      • Properties, Events, QEdit examples
    • QFILELISTBOX
      • Properties, Methods, Events, QFileListBox examples
    • QFILESTREAM (Windows/Linux)
      • Properties, Methods, QFilestream examples
    • QFONT (Windows/Linux)
      • Properties, Methods, QFont examples
    • QFONTDIALOG
      • Properties, Methods, Events, QFontDialog examples
    • QFORM (Windows/Linux)
      • Properties, Methods, Events, QForm examples
    • QGAUGE
      • Properties, QGauge examples
    • QGLASSFRAME
      • Properties QGlassFrame examples
    • QGROUPBOX
      • Properties, Methods, Events, QGroupBox examples
    • QHEADER
      • Properties, Methods, Events, QHeader examples
    • QIMAGE
      • Properties, Methods, Events, QImage examples
    • QIMAGELIST
      • Properties, Methods, QImageList examples
    • QLABEL (Windows/Linux)
      • Properties, Events, QLabel examples
    • QLISTBOX (Windows/Linux)
      • Properties, Methods, Events, QListbox examples
    • QLISTVIEW
      • Properties, Methods, Events, QListView examples
    • QMAINMENU (Windows/Linux)
      • Properties, Methods, QMainMenu examples
    • QMEMORYSTREAM (Windows/Linux)
      • Properties, Methods, QMemorystream examples
    • QMENUITEM (Windows/Linux)
      • Properties, Methods, Events, QMenuItem examples
    • QMYSQL (Windows/Linux)
      • Properties, Methods, QMySQL examples
    • QOPENDIALOG (Windows/Linux)
      • Properties, Methods, QOpenDialog examples
    • QOLECONTAINER
      • Properties, Methods, QOleContainer examples
    • QOLEOBJECT
      • Properties, Methods, QOleObject examples
    • QOUTLINE
      • Properties, Methods, Events, QOutLine examples
    • QOVALBTN (Windows/Linux)
      • Properties, Methods, Events, QOvalbtn examples
    • QPANEL (Windows/Linux)
      • Properties, Events, QPanel examples
    • QPOPUPMENU
      • Properties, Methods, QPopupMenu examples
    • QRADIOBUTTON (Windows/Linux)
      • Properties, Events, QRadioButton examples
    • QRECT
    • QREGISTRY
      • Properties, Methods, QRegistry examples
    • QRICHEDIT (Windows/Linux)
      • Properties, Methods, Events, QRichedit examples
    • QSAVEDIALOG
      • Properties, Methods, QSaveDialog examples
    • QSCROLLBAR (Windows/Linux)
      • Properties, Events, QScrollBar examples
    • QSCROLLBOX
      • Properties, Methods, Events, QScrollBox examples
    • QSOCKET (Windows/Linux)
      • Properties, Methods, QSocket examples
    • QSPLITTER
      • Properties, Events, QSplitter examples
    • QSTATUSBAR
      • Properties, Methods, Events, QTrackBar examples
    • QSTRINGGRID
      • Properties, Methods, Events, QStringGrid examples
    • QSTRINGLIST (Windows/Linux)
      • Properties, Methods, QStringList examples
    • QTABCONTROL
      • Properties, Methods, Events, QTabControl examples
    • QTIMER (Windows/Linux)
      • Properties, Events, QTimer examples
    • QTRACKBAR
      • Properties, Methods, Events, QTrackBar examples
    • QTREEVIEW
      • Properties, Methods, Events, QTreeView examples

    Rapid-Q DirectX Component/Object Reference

    • QDXIMAGELIST
      • Properties, Methods, Events, QDXImageList examples
    • QDXSCREEN
      • Properties, Methods, Events, QDXScreen examples
    • QDXSOUND
      • Properties, Methods QDXSound examples
    • QDXTIMER
      • Properties, Methods, Events, QDXTimer examples

    Rapid-Q Direct3D Component/Object Reference
    This is a work in progress, some properties or methods may change in the future. All 3D operations are done in Retained mode.

    • QD3DFace
      • Properties, Methods, QD3DFace examples
    • QD3DFrame
      • Properties, Methods, QD3DFrame examples
    • QD3DLight
      • Methods, QD3DLight examples
    • QD3DMesh
      • Properties, Methods, QD3DMesh examples
    • QD3DMeshBuilder
      • Methods, QD3DMeshBuilder examples
    • QD3DTexture
      • Methods, QD3DTexture examples
    • QD3DVector
      • Properties, QD3DVector examples
    • QD3DVisual
      • Methods, QD3DVisual examples
    • QD3DWrap
      • Methods, QD3DWrap examples

    Appendix C: Rapid-Q Keywords & Statements

    • Valid Operators (In order of precedence)
      • Exponentiation (^)
      • Multiplication/Division and Shifts (*, /, \ (integer division), SHL, SHR)
      • Modulo arithmetic (MOD, INV)
      • Addition and subtraction (+, -)
      • Relation operations (=, >, <, <>, <=, >=)
      • Logical operations in order from high to low (NOT, AND, OR, XOR)
    • Rapid-Q internal definitions
      • WIN32, UNIX, TYPE
    • Rapid-Q supported Data Types
      • BYTE, WORD, INTEGER, VARIANT, etc...
    • Branching with GOTO and GOSUB
      • GOTO, GOSUB, RETURN
    • User defined types
      • TYPE versus STRUCT
    • Conditional statements
      • IF .. THEN .. ELSE, SELECT CASE
    • Loops
      • FOR .. NEXT, DO .. LOOP, WHILE .. WEND
    • Constructors/Methods
      • CONSTRUCTOR, CREATE, WITH
    • Procedures
      • SUB, FUNCTION, SUBI, FUNCTIONI
    • Internal Variables
      • Command$, CurDir$, MouseX, MouseY, etc...
    • Console keywords, Detailed list
      • CLS, COLOR, PRINT, INKEY$, etc...
    • Other reserved keywords, Detailed list
      • ABS, LEN, MID$, SWAP, etc...
    • Touble Shooting
      • How to Debug your programs


Chapter 1: Rapid-Q Overview

Rapid-Q Documentation by William Yu (c)1999-2000 Chapter 1

1. Rapid-Q Overview

Rapid-Q is a programming language, a BASIC programming language to be precise. It is multiplatform, although not completely compatible in terms of the graphical interface, but the underlying language is more or less compatible between platforms. Rapid-Q is available for Windows, Linux, and Unix (Solaris and HP-UX are supported). You can use Rapid-Q to create both GUI and CONSOLE applications, including CGI applications. Rapid-Q generates byte-code as opposed to the native opcode of your processor. This requires an interpreter to read and execute the byte-codes, however, this interpreter is embedded in all your applications, so no extra files are necessary when you distribute your executable. The biggest issue is speed, but depending on what you're using Rapid-Q for, this may not be a factor. Rapid-Q was originally created to provide a free implementation of a BASIC programming language for Windows.

RapidQ is compatible with Win95, Win98 and Win ME without limitations. On Win 2000 and Win XP, 3D objects and Sound keyword don't work, and an error popup appears when launching the IDE. RapidQ doesn't work on Win 3.x

1.1 How slow is Rapid-Q anyway?

Although Rapid-Q is based on compiling your sources to byte-code, execution isn't as slow as many think. Your programs will obviously slow down if you require heavy computation or to perform very low level manipulation to data. For example, reading a single byte from a 1MB file will take longer in Rapid-Q than in most languages, but not so extremely slow that you'll be sleeping at the keyboard. Same with looping I = I + 1 a few thousand times. But in terms of displaying graphics, controls and forms, it's just as fast as any other language. For computations, I suggest writing a separate DLL in a more accustomed language like C, and call the DLL in Rapid-Q when you just need that extra speed.

1.2 What about bloat-ware?
This is obviously something which there's nothing much you can do about. Rapid-Q (the interpreter part) itself, requires about 300KB (150KB for Linux, 600KB for Sparc). So this is the overhead that all your programs will have. Compared to some Windows programs, this isn't that bad, but still bloated if all you wanted was a simple "Hello World!" program. Your bytecode will only add to it, but most likely your bytecode is less than 50KB anyway (for a moderate/large application), plus any resources and graphics you may want to include of course.

1.3 Does Rapid-Q require extra runtime DLLs?
No. All your programs require no extra runtime DLLs or externalities. Just distribute your .EXE file and that's it. They should run on any Win95/98/NT system, assuming the end user hasn't done anything to his/her Windows System files. If you compare the bloat-ware of Rapid-Q and the runtime DLLs of other languages, Rapid-Q isn't that bad in terms of bloated size.

1.4 How much memory does Rapid-Q suck out of my programs?
It doesn't suck anything out of your programs (not literally), but it does suck memory out of Windows which in turn limit the amount of memory for your program(s). It really isn't as bad as one might think though. It eats up less than 200KB for virtual, global, and heap memory combined. This is because all variables and objects are created dynamically. The heap/stack memory is the one you should look out for. If your program is deeply nested or involves intense recursion, this can grow and shrink very rapidly. You don't need to worry about cleaning up your objects or variables when your program terminates. Rapid-Q will free all your objects and clean up the memory space for you.

1.5 How easy is it to hack into my programs?
Being a byte-code compiler, if the end user knows how everything is constructed, then it's just a formality. However, Rapid-Q generates a non-standard, or non-specific type byte-code output, which means, unless the user specifically knows what each operation does, it is very very difficult to hack your program. It's easy to hack into your string variables (like any other language), because these things aren't encrypted anyway. In most cases, your program should be safe from snoopers, they might not even know your program is byte-code generated! Unlike Java or other languages, Rapid-Q does not attach any symbol table or extra debugging information to your .EXE.

1.6 Do I need a license to distribute my programs?
No. You don't need a license to use Rapid-Q (it's free), and you definitely don't need any license to distribute or sell your programs. The only agreement you have to worry about is that if you choose to use Rapid-Q, you assume any and all consequences, direct or indirectly from the use of Rapid-Q. Rapid-Q can be used for any task, whether it's profit-seeking or otherwise. You don't pay me a cent, and you don't even have to acknowledge that your program was created with Rapid-Q (although this would be a nice gesture). You CANNOT, however, distribute Rapid-Q (the program itself) and charge for it. You're allowed to bundle Rapid-Q along with your program(s), so long as the user is well informed that it's not buying into Rapid-Q, but rather, buying into your program. How is that done? By not even advertising that your distribution includes a copy of Rapid-Q. Call it the hidden feature.


Chapter 2: Rapid-Q Fundamentals

Rapid-Q Documentation by William Yu (c)1999-2000 Chapter 2

2. Rapid-Q Fundamentals

Before jumping into any language, it helps to know how to use it first. This chapter will introduce you to the Rapid-Q environment, how to compile and run your programs, and what the general structure of your Rapid-Q program will look like.

2.1 Rapid-Q environment
Your Rapid-Q distribution should have included an IDE (integrated development environment) program (called RAPIDQ.EXE), along with the actual Rapid-Q compiler (RC.EXE). RAPIDQ32.LIB and RAPIDQCC.LIB are also required to compile any of your programs. If any of these files are missing, please report the problem to me or the webmaster of the site you downloaded Rapid-Q from. These are the main (4) programs that you will need to develop and compile your Rapid-Q source codes. The IDE is strictly optional, so if your distribution excludes this file, don't fret. If you feel more comfortable writing your programs in NotePad or whatever editor you choose, that's also fine. If that is the case, you probably want to skip the next section on Using the Rapid-Q IDE. All these files must reside in the same directory.

2.2 Using the Rapid-Q IDE
Unlike some IDEs that offer debugging options, the Rapid-Q IDE offers nothing more than an environment to write your programs, run them, and provide run-time command options. It has primitive error checks, I say primitive, because the IDE doesn't do the error checking at all, (RC.EXE) the compiler does all of it. It's just that the Rapid-Q IDE interfaces nicely with RC.EXE so you don't really notice that. It also provides syntax highlighting which makes using the Rapid-Q language much easier.
    What are its limitations:
  • Not all components are available in the form designer
  • When running your program, your source code is automatically saved
  • All files are compiled before they are executed
I can't speak for everybody, but the Rapid-Q IDE is a good tool to use when starting out to learn the Rapid-Q language, but as you become more accustomed to the language, most people would switch to their favourite text editor. That is not to say that you should abandon using the Rapid-Q IDE altogether, if you feel comfortable using it, by all means, stick with it.

2.3 Compiling and Running a Simple Application
Wait a minute, we haven't even covered the BASICs on writing a simple application yet. Don't worry, we'll get to that, it's better to know how to compile and run it first before doing anything else. Here is a very simple GUI application that you can type in and compile for yourself.
            DIM MainForm AS QFORM
            MainForm.ShowModal
If you're using the Rapid-Q IDE, just type in that code (or cut & paste if you like). Click on the Run Menu, and select Run. If all goes well, you should see an empty Window at the top left hand corner of the screen. Close it and return to your IDE. If you prefer the command line approach of compiling, then load up your favourite editor, copy the above code and save it to a file (Forms.BAS). Then to compile it, you type in:
          RC Forms.BAS
If all goes well, you should have a Forms.EXE file in the current directory. Just type Forms to run it. If all goes well, continue reading. If not, then something is amiss, in which case, see the Trouble Shooting section.

2.4 Command line switches for RC.EXE
I will only discuss the 3 more important ones:
      -I[Path] Change Include Path
      -L[Path] Change Library Path
      -G[File] Icon file
The compiler by default looks in the current directory for the .LIB files and any include files. You can override this by specifying the above command line switches. Since we're talking about C type parameters, there are a few niceties you have to know about, first, the paths should be specified like so:
      RC -Ic:/rapidq/includes
You can use \ instead of / but there's a reason why / is preferred, consider this:
      RC -I"c:\rapidq long dir\includes\"
If you never used C (or C++) you'll not likely see what I mean. If you prefer the above command line, you have to add an extra \ to the end (or drop it entirely), like so:
      RC -I"c:\rapidq long dir\includes\\"
or
      RC -I"c:\rapidq long dir\includes"
This is because C translates \" into " which is obvious to any C programmer. Also, long file names must be enclosed in quotations. Those are the catches, so now you know (or already knew).
Now, to change the default icon for your .EXE file, you can use the -G command switch:
      RC -Gzip.ico zipview.bas
When your ZIPVIEW.EXE file is generated, the file "zip.ico" will replace the default icon. Please note that your icon must be 32x32 and 16 colors (also 766 bytes).

2.5 General Structure of a Rapid-Q Program
There really is no pre-defined structure of a BASIC program, but there is a general form that most people conform to.
    Directives
    Declarations
    Global Variables
    Main Program
This is only a general form, your Rapid-Q applications can be structured in a variety of ways. Some of which will have similar results, and some will have devasting or more customized results. For example, $INCLUDE is a directive to import a file at that position. So if you use $INCLUDE somewhere in your main program, it would have a different result than if you included it at the beginning of your program.

2.6 How close to the BASIC Language is Rapid-Q?
Very close, all the familiar commands like DIM, PRINT, MID$, etc. are inherited. That does not mean you'll be able to port your DOS based QBasic programs to Rapid-Q without any modification. Since Rapid-Q is Windows based, providing primitive support for CONSOLE, it's a safe bet you won't directly convert your QBasic applications to Rapid-Q without a 50-90% rewrite of your source code (depending on what the code does). Comments in Rapid-Q begin with the ' symbol, just like QBasic, or you can use REM instead. You can also separate lines by using the colon : symbol. This has the same effect as starting a new line.
             PRINT "Hello" : PRINT "World"
         or
             PRINT "Hello"
             PRINT "World"
Most BASIC programmers will become very accustomed to the language once they use it. However, Rapid-Q does not inherit the properties of Visual Basic. For example, there's no SUB MAIN procedure, nor is there any public or private identifiers used in Rapid-Q. Your entire program is considered the MAIN program. Going from Rapid-Q to Visual Basic probably requires a bit more effort than the reverse.


Chapter 3: Rapid-Q Language Guide

Rapid-Q Documentation by William Yu (c)1999-2000 Chapter 3

3. Rapid-Q Language Guide

In this chapter, I'll go through the language of BASIC, specifically Rapid-Q. Since Rapid-Q is derived from the BASIC language, most experienced BASIC programmers can skim this section if you so choose. There's a few new concepts that is not part of the BASIC language like infinite parameter passing and using the '-' operator on strings.

3.1 Rapid-Q Directives
Directives are used in Rapid-Q to tell the compiler how, and what kind of code is to be generated. Rapid-Q supports the following directives, which are usually included at the beginning of your programs.

 $APPTYPE

[ CGI | CONSOLE | GUI ] Default is GUI
$APPTYPE is used to tell the compiler what kind of application you want generated. Although the default is GUI, if no $APPTYPE directive is used, Rapid-Q will detect what kind of application your program is just by looking at the source code. To override this feature, include the $APPTYPE directive at the beginning of your source code.
Usage: $APPTYPE CONSOLE

$TYPECHECK

[ OFF | ON ] Default is OFF
$TYPECHECK is used to tell the compiler whether you want the source code parsed using strict type checking ON (all variables must be declared), or relaxed type checking OFF like traditional BASIC where you don't need to declare your variables. Note, you can turn ON or OFF type checking at anytime, so you can type check a portion of your code and turn it OFF afterwards.
Usage: $TYPECHECK ON

 $INCLUDE

[ FileName ]
Using $INCLUDE has the same effect as importing your file directly into your program at the point of call. You can use $INCLUDE anywhere in your program, except in a SUB or FUNCTION, but is most often included at the beginning of your source code. Enclosing the filename between quotes will search for that file in the current directory, and specified include paths. Enclosing the filename between < and > will search for that file in the current directory, specified include paths and the environment search paths.
Usage:
    $INCLUDE "RAPIDQ.INC"
    $INCLUDE <RAPIDQ.INC>

$RESOURCE

Handle AS FileName
Most Windows programming languages include support for Resource files. In Rapid-Q, this is somewhat different. In Rapid-Q, Resource files are just a collection of graphics files. There is no such thing as resource strings in Rapid-Q. Anyway, what's great about Resource files is that they are embedded into your applications. So if you're using 10 different bitmaps, you don't need to include them in your .ZIP distribution because it's already embedded into the .EXE. Enclosing the filename between quotes will search for that file in the current directory, and specified include paths. Enclosing the filename between < and > will search for that file in the current directory, specified include paths and the environment search paths.
Usage:
    $RESOURCE RES_BMP1 AS "CLOUDS.BMP"
    $RESOURCE RES_BMP1 AS <CLOUDS.BMP>

$DEFINE

NewDefinition [OldDefinition]
When you feel like redefining or creating new keywords/tokens, use this directive. You cannot construct a series of tokens to be redefined. You cannot redefine operators or punctuations. $DEFINE cannot be used to define a function (like in C). The OldDefinition parameter is optional, so you can do this just fine: $DEFINE NEWDEF
Usage: $DEFINE INT16 SHORT

 $UNDEF

DefName [, DefName]
To undefine a previous call of define, use $UNDEF. You can specify multiple instances on the same line, separated with commas.
Usage: $UNDEF INT16, INT32

 $IFDEF

Definition
This directive is used to specify whether a piece of code should or should not be compiled. It is used in conjunction with $DEFINE. If the Definition has been defined, the code within the $IFDEF...($ELSE)...$ENDIF statement will be compiled, otherwise it is skipped entirely.
Usage:
    $IFDEF INT16
    ' if INT16 has been defined
    ' compile this portion
    $ELSE
    ' if INT16 has not been defined
    ' compile this portion
    $ENDIF

 $IFNDEF

Definition
$IFNDEF has the opposite effect as $IFDEF.
Usage:
    $IFNDEF INT16
    ' if INT16 has not been defined
    ' compile this portion
    $ELSE
    ' if INT16 has been defined
    ' compile this portion
    $ENDIF

 $OPTION

OptionName [Parameters]
BYREF, BYTECODE, DECIMAL, DIM, EXPLICIT, GTK, ICON, INKEY$, and WEAKTYPE are valid OptionNames.
Usage:
    $OPTION BYREF
    This changes the way variables are
    passed. By default, Rapid-Q passes variables
    by value. This option reverses that.
    Use with caution.

    $OPTION BYTECODE
    Compile as byte code only.

    $OPTION DECIMAL ","
    $OPTION DECIMAL 64
    This changes the default decimal
    character for use in VAL.
    The default decimal character is the period.

    $OPTION DIM BYTE
    $OPTION DIM WORD
    $OPTION DIM DWORD
    $OPTION DIM SHORT
    $OPTION DIM INTEGER
    $OPTION DIM LONG
    $OPTION DIM SINGLE
    $OPTION DIM DOUBLE
    $OPTION DIM STRING
    $OPTION DIM VARIANT
    This changes the default type
    for an undeclared variable.
    By default, all undeclared variables are
    assumed to be of type DOUBLE
    if no suffix is provided.

    $OPTION EXPLICIT
    Same as using TYPECHECK ON
    Maintained for compatibility with VB

    $OPTION GTK
    Uses GTK instead of XFORMS
    Make sure you have the proper files

    $OPTION ICON "path\file.ico"
    This changes the default icon
    of your executable file.

    $OPTION INKEY$ DEFAULT
    $OPTION INKEY$ TRAPALL
    This allows INKEY$ to accept/reject
    certain extended characters.
    TRAPALL will trap Shift/Ctrl/Alt/Menu
    as well as Caps/Num/Scroll lock.

    $OPTION VBDLL ON
    $OPTION VBDLL OFF
    This determines how DLLs are handled.
    If VBDLL is enabled (ON), your DLL
    declarations in Rapid-Q will mimic VB's
    such that your code can be used the
    same way in both languages.
    This option is OFF by default.

    $OPTION WEAKTYPE ON
    $OPTION WEAKTYPE OFF
    WeakType is disabled (OFF) by default
    WeakType allows for faster parsing
    and may help in porting some VB code.
    It should not generally be used,
    unless you know the code is okay.

 $OPTIMIZE

[ OFF | ON ] Default is OFF
$OPTIMIZE can be used to reduce the byte code size by eliminating unnecessary instructions. If you use this option, make sure it's one of the first things you call.
Usage: $OPTIMIZE ON

 $ESCAPECHARS

[ OFF | ON ] Default is OFF
If $ESCAPECHARS is turned ON, you can use escape sequences in your strings. Escape sequences can either be character or numeric escapes. Note that case is sensitive.
Usage: $ESCAPECHARS ON
Escape sequence
Details

  \a        Alarm bell
  \b        Backspace
  \f        Form feed
  \n        New line
  \r        Carriage return
  \t        Horizontal Tab
  \v        Vertical Tab
  \\        Backslash
  \"        Double quote
  \###      ### is any number 0..255
  \xHH      HH is a hexidecimal value 00..FF

Examples:
    PRINT "\""
    Output is "

    PRINT "\x41"
    Output is A

    PRINT "\t\65\66\67\t\68\69\70
    Output is ABC       DEF

    PRINT "Hey\r\n";
    Output is Hey with newline

 $MACRO

MacroName[(Parameters, ...)] MacroDefinition
A Macro simply replaces a definition with another. It can be treated like a function if you supply parameters. Rapid-Q allows Macros to be embedded within another Macro (foward only to avoid recursion), token pasting using ##, and even macro overloading. You can also redefine operators and special characters except quotes. A definition can extend to multiple lines by using the colon as a line separator. A $MACRO directive is global if it preceeds any $INCLUDE directives. ie. the included files have access to those Macro definitions. A $MACRO directive only affects the module level (ie. the current file) if used in an $INCLUDE file. So if A depends on B and B has some $MACRO directives, then those $MACRO directives only affect B and A has no access to them unless redeclared in module A.
Notes:
If you use the $MACRO directive, you are forcing Rapid-Q to preprocess your code, which will prolong the compilation process. Rapid-Q normally performs a single-pass compilation process.
Usage:
    $MACRO ~ ,
    This redefines the comma character
    Try: ? STRING$(10 ~ "A")

    $MACRO strcat(a,b) a=a+b
    Implements a STRCAT function
    strcat(a$,"abc") translates to a$=a$+"abc"

 Not working strcat(a1,b) a1=a1+b

    $MACRO VARID(x) V##x
    An example of token pasting
    DEFINT VARID(1) translates to DEFINT V1

    $MACRO TWO_PI (2*PI)
    $MACRO PI 3.14159
    Embedded Macros (forward only).
    Can't embed itself as a parameter.
    This avoids rescanning & recursion.

    $MACRO ADD(a,b,c,d) ADD(a,b)+ADD(c,d)
    $MACRO ADD(x,y) x+y
    $MACRO ADD(x,y,z) x+y+z
    An example of macro overloading

'MacroPower !!!

'Char presentation of number

Macro as pseudo SUB
DIM M AS
QMemoryStream

$Macro Digit2Char(D,a) _
M.Write(D):za=sizeOf(D):
_
M.Position=0:a=M.ReadBinStr(za) : M.Close

dim LPod as
double
lpod=33.234
Digit2Char(lpod,sss$)
print "Char LPod=",sss$:

dim tst as
integer
tst=33.234
Digit2Char(tst,zz$)
print "Char tst=",zz$:

 3.2 Variables and Assignments

Variables are stored in main memory, and stay there for the entire duration of your program. In Rapid-Q, type checking is very relaxed. Which means you can assign a string to an integer variable. The result is undefined, but will most likely return 0. Same goes with assigning a number to a string variable, the result is an empty string. Type checking is really done at the interpreter level in Rapid-Q, but since you don't want error messages popping up everywhere, I have disabled the check entirely. What this ultimately means is that you should be very very careful in assigning values to your variables, since you won't get any warnings from Rapid-Q. The only strict type checking done is for QObjects. You cannot assign a number or string to a variable expecting an Object for its value. Some examples of valid assignments:
         A% = "Hello"  "World"

         A$ = "Hi World!"

         A# = 34 + 34 - 324 * 3 / (34 / 5 + 5)

If you've never programmed in BASIC before, you're probably wondering what all those symbols after the A mean. Well, since most implementations of BASIC does not restrict you to define your variables before you use them, you can define them by using these symbols:
         ?, ??, ???, %, &, !, #, $
They represent BYTE (?), WORD (??), DWORD (???), SHORT (%), LONG (&) or INTEGER, SINGLE (!), DOUBLE (#), and STRING ($), respectively. Of course, if you didn't put any symbol in front of your undeclared variable, it's automatically assumed that the variable is a DOUBLE. That is the implementation used in Rapid-Q, for other languagues, the default maybe SINGLE, LONG, or what have you. Here's a table for your viewing pleasure:
    Type       ID  Size  Range
    --------- ---- ---- -------------
    Byte        ?   1   0..255
    Word       ??   2   0..65535
    Dword     ???   4   Only Linux version for now...
    Short       %   2   -32768..32767
    Integer     &   4   -2147483648..2147483647
    Long        &   4   -2147483648..2147483647
    Single      !   4   1.5 x 1045..3.4 x 1038
    Double      #   8   5.0 x 10324..1.7 x 10308
If you didn't like the way that was done, you could also use DIM to declare your variables, like so:
            DIM Number AS INTEGER
            DIM S AS STRING
            DIM B AS BYTE
Well, you get the idea. If you turned $TYPECHECK ON, then you will be forced to declare your variables like that. It's a nice habit to pick up, especially if you wanted to switch to languages like C or Pascal. You will be forced to declare all your variables before you use them. Here's something that's valid in Rapid-Q, but can confuse the daylights out of people:
            DIM Num$ AS INTEGER
Yes, try to avoid obfuscated code like that.

(evilone_666k )
A little syntactic sugar thrown in. Previously, if you were to declare 3 variables of type INTEGER, you had to write:

DIM a AS INTEGER, b AS INTEGER, c AS INTEGER

A lengthy one... just to remind, the following is NOT correct:

DIM a, b, c AS INTEGER

In this case, a and b will be VARIANTs, and only c is INTEGER. Previously, there was no workaround. However, since 1.4.0, you can group variables together using braces:

DIM (a, b, c) AS INTEGER

Here, all three variables are of type INTEGER - rather convenient. There is a disadvantage though: you cannot initialize variables declared in such a manner:

DIM (a = 1, b = 2) AS INTEGER ' error!

This is correctly written as:

DIM a AS INTEGER = 1, b AS INTEGER = 2

Also, you cannot have one of the variables be an array, while others aren't:

DIM (a, b(5), c) AS INTEGER ' incorrect!
DIM (a, b, c)(5) AS INTEGER ' correct: a, b and c are arrays

'This program demonstrate how to use
'DEF... Instead of DIM even for arrays!
'Boltex <pier..@yahoo.com>

DEFSHORT tour 'ok, define type:SHORT
DEFSHORT a(3) = {1,2,3,4} 'assign value even to arrays...
DEFSHORT b(1,3) = {1,2,3,4,5,6,7,8} 'of more than 1 dimension!

FOR tour=0 TO 3
PRINT "a(";tour;")=";a(tour)
NEXT tour
?
FOR tour=0 TO 3
PRINT "b(0,";tour;")=";b(0,tour)
NEXT tour
?
FOR tour=0 TO 3
PRINT "b(1,";tour;")=";b(1,tour)
NEXT tour
' Outputs to screen:
'
'a(0)=1
'a(1)=2
'a(2)=3
'a(3)=4
'
'b(0,0)=1
'b(0,1)=2
'b(0,2)=3
'b(0,3)=4
'
'b(1,0)=5
'b(1,1)=6
'b(1,2)=7
'b(1,3)=8

3.3 Rapid-Q Components/Objects

Rapid-Q offers reuseable components (or objects) which assists the programmer in developing Windows applications. Most RAD (Rapid Application Development) Programming languages offer this. For Visual C++, it's MFC, and for Java, it's JFC Swing. So what are visual components? They're basically just wrapper code that implement all the features of the Windows API control (or under Linux, whatever GUI API you're using) without all the headaches involved in using the API directly. For example, you can create windows using pure Windows API calls only, but this can run down for pages. In Rapid-Q, all this has been wrapped up into a component called QFORM. So instead of having to first register your class window, then display it and handle all the callbacks, all you do in Rapid-Q is:
             DIM Form AS QFORM
             Form.ShowModal
Comparing this to a C/C++ program, it's much cleaner, and easier to understand. There are a lot of supported components in Rapid-Q, like QBUTTON, QIMAGE, QFILESTREAM, etc. There are also some which aren't supported, that's the restriction involved in using Rapid-Q. Components are created exactly the same way you create variables, by using DIM. Each component has its own properties, methods and events. Properties are like the component's attributes. For example, Left, Top, Width, and Height are properties common to all visible controls, which define its placement within the form or Window. Caption is a property of type STRING. For a QFORM component, the Caption property defines the title of that form. Caption for a QBUTTON defines the text of that button. Caption for something like QFILESTREAM does not exist, since a QFILESTREAM isn't a visible component. It has its own properties. For a complete guide of the properties, methods and events for all components, please check the Appendix section. Here's a quick example of how you can assign properties to your components:
                 DIM Form AS QFORM
                 Form.Caption = "My Application"
                 Form.Left = 100
                 Form.Top = 100
Be careful to know which properties are Read-Only, and which ones are Write-Only. An example of a read-only property is the ITEMCOUNT property of a QLISTBOX. An example if a write-only property is the ICON property of a QFORM, used to specify the location of an icon to use as the default. Reading the Write-Only values, or Writing to Read-Only values have no defined meaning, and may result in a compile error or more seriously, your program crashing.

3.4 Component Methods & Events
Well, we've covered only the properties so far, but methods aren't much different. What exactly is a method you ask? It's really just a SUBROUTINE or FUNCTION. It's called a method, because the SUBROUTINE or FUNCTION only refers to that component. This is harder to explain than to understand. Here's an example of a method:
              DIM Form AS QFORM
              Form.Center
              Form.ShowModal
We used 2 methods here, Center, and ShowModal. The Center method is a SUBROUTINE that accepts no parameters. What it does is center the form on your desktop. ShowModal is actually a FUNCTION, but we ignore the return value in this case. It's a method used to Display your form, and wait for the user to close it. Note: Unlike some BASIC implementations, a FUNCTION can be called like a SUBROUTINE in Rapid-Q, you just ignore the return value. This is similar to C/C++. Other methods that you see may require some extra parameters, and some even accept an infinite number of parameters. You can also write these in Rapid-Q yourself, but I'll cover that topic later. So basically, methods are functions which perform a specific task on that component. In our above example, we're centering the form, and then displaying it.
All right, now what about events? Well, this can be a confusing subject if we were talking in terms of message passing and callbacks. Well, luckily, we can take a much higher level look at it. An Event occurs whenever something happens. This is very vague, something happening could be anything from time elasping, user clicking the mouse, user pressing a key, etc. Rapid-Q can't trap all these events, but the most important ones are. For example, if a user clicked on a button, you'd want to write some code to perform that task. We have to define a CALLBACK function to handle it. For each event which occurred, you want to direct that event to a subroutine you wrote to handle the event. Here's how:
       SUB ButtonClicked
          PRINT "Button was clicked"
       END SUB

       DIM Button AS QBUTTON
       DIM Form AS QFORM

       Button.Parent = Form                 ' Property
       Button.OnClick = ButtonClicked       ' Event
       Form.ShowModal                       ' Method
Seems easy enough right? It really is. Whenever an "OnClick" message/event occurs, the program jumps into your subroutine ButtonClicked and executes the code you have waiting in there. The above program is complete, so you can try it out yourself. For a list of all events that a particular component can receive, just look at the Appendix section.

3.5 Rapid-Q Subroutines & Functions
There are some GOTCHAS associated with Rapid-Q SUBs and FUNCTIONs. The first, and most important, is that all values passed are passed by VALUE (except for objects, variants, udts, and arrays). To pass a variable by reference, you need to prepend an @ symbol. The second catch is that only a maximum of 10 parameters can be accepted (except when calling an API function, then it's limited to 25). There's no difference in the way you create SUBs or FUNCTIONs in Rapid-Q (as compared to other BASIC languages like QBasic/PB):
    FUNCTION FindMax (X AS INTEGER, Y AS INTEGER) AS INTEGER
      IF X > Y THEN
        FindMax = X      '' Return value is X
      ELSE
        FindMax = Y      '' Return value is Y
      END IF
    END FUNCTION
The above code is valid, as is the following:
    FUNCTION FindMax (X%, Y%) AS INTEGER
      IF X% > Y% THEN
        FindMax = X%      '' Return value is X
      ELSE
        FindMax = Y%      '' Return value is Y
      END IF
    END FUNCTION
However, as you may notice, you can't have FindMax% without attaching an AS INTEGER to the end of the function.
 To pass a variable by reference, attach an @ symbol in front of your variable:
    SUB StrCat (Source AS STRING, Text AS STRING)
        Source = Source + Text
    END SUB

    A$ = "Hello"
    StrCat(@A$, " World!")
    PRINT A$                '-- Should print: Hello World!
Or if you prefer, you can also attach a BYREF keyword in your parameter list like so:
    SUB StrCat (BYREF Source AS STRING, Text AS STRING)
        Source = Source + Text
    END SUB

    A$ = "Hello"
    StrCat(A$, " World!")
    PRINT A$                '-- Should print: Hello World!
Yet another approach you can use instead (note that this is the "old" way, maintained for compatibility reasons):
    SUB Strcat (A$, B$)
       A$ = A$ + B$
    END SUB

    A$ = "Hello"
    Strcat(A$, " world!")
    A$ = STACK.STR(0)
    PRINT A$
The stack contains an array of integers and strings, to access the correct parameter, you have to specify the number (from left to right). The first element being 0. You can also pass QObjects, but you can't use it as a return value.
    SUB (Button AS QButton)
        Button.Left = 100
    END SUB
All components/QObjects are passed by reference.

Arrays as parameter.

function AverageSubtract (Dat1!() as single) as single
'calculate and subtract average value from function Dat1!()
Npt1 = UBOUND(Dat1!)
ARMid! = Dat1!(0)
FOR p = 0 TO Npt1-1:
    ARMid! = ARMid! + Dat1!(p):
NEXT p
average! = ARMid! / Npt1
FOR I = 0 TO Npt1-1: Dat1!(I) = Dat1!(I) - average!: NEXT I
result=average!
END sub '' function  Heh..It's working too ;-)

DefSng arg!(10) ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
DefSng dateTime(1 To 9) = { 1, 2, 3, 4, 5, 6, 7, 8, 9}

for i=0 to 9: print "arg!(",i,")=",arg!(i)  :  next i
abc= AverageSubtract (arg!() )
print "------------------   average=" ,abc
for i=0 to 9: print "arg!(",i,")=",arg!(i)  : next i
print

for i=1 to 9: print "dateTime(",i,")=",dateTime(i)  : next i
abc= AverageSubtract (dateTime )
print "------------------   avrage=" ,abc
for i=1 to 9: print "dateTime(",i,")=",dateTime(i)   : next  i

3.6 Rules of Scope

Rapid-Q is not like BASIC in this case. Since Rapid-Q is a simple top-down one-pass compiler, the scope is very similar to that of Pascal.
Here's what I mean:

       SUB Test
          DIM I AS INTEGER
          I = 100
          PRINT I
       END SUB

       DIM I AS INTEGER
       I = 10

       SUB Test2
         PRINT I
       END SUB

       Test    '' Call Subroutine
       Test2
Here's how the scope works, for the SUB Test, the LOCAL variable I only extends down as far as the end of that SUB block. The variable I in the main program extends down all the way to the end of your program. That means SUB Test2 can use the global variable I because it's within its scope. You can also redeclare the variable I in SUB Test2, in which case the local I is used instead of the global I. Here's another situation to demonstrate the scope of variable names:
       DIM I AS INTEGER

       SUB Scope (I AS INTEGER)
         DIM I AS INTEGER
         PRINT I
       END SUB

       PRINT I
In fact, the line DIM I AS INTEGER is a wasted statement, since the variable I is shadowed by the parameter name I. Rapid-Q will warn you about this, but won't error out.


Chapter 4: Writing your first Rapid-Q Application

Rapid-Q Documentation by William Yu (c)1999 Chapter 4

4. Writing your first Rapid-Q Application

Let's jump right into writing Windows applications in Rapid-Q! There will be a simple step-by-step guide, along with the complete source code listing at the end of this chapter.

4.1 Deciding on what to write
We're not going to write a simple "Hello World!" demo, nor are we going to write a web browser, we'll start with something meaningful, yet simple to write. Let's write a simple form based database type program. Some of the concepts we'll learn is form handling, event handling, and using the components, QEDIT, QBUTTON, QFORM, QLABEL, and QLISTBOX. Here's what our finished application should look like, you can modify the interface to your liking (if you're comfortable you know what you're doing).

It may look like a lot, but honestly, the source code is less than 100 lines! Most of the time spent is used designing the layout.

4.2 Designing the form
You can almost see the components that we'll need. One QFORM, 2 QBUTTONs, 4 QEDITs, 4 QLABELs, and finally 1 QLISTBOX. First of all, we need a Window (that's our QFORM). So let's type that in:
           DIM MainForm AS QFORM

           MainForm.Center
           MainForm.Caption = "My First Application"
           MainForm.Height = 340
           MainForm.Width = 350
           MainForm.ShowModal    '-- Display form
If you entered all this correctly, you should see an empty Window, with the same geometry as the above diagram. One thing to notice is that we're not using MainForm.Left or MainForm.Top because when the MainForm is centered, it is automatically calculated for us. All we really need is to supply the width and height of our Window.
All right, now that we have our Window, we'll have to add controls to it. You should place the following code BEFORE the line MainForm.ShowModal. For the sake of argument, let's begin by adding some labels to our Window.
       DIM NameLabel AS QLABEL, AddrLabel AS QLABEL
       DIM CityLabel AS QLABEL, PhLabel AS QLABEL

           NameLabel.Parent = MainForm
           NameLabel.Caption = "Name:"
           NameLabel.Top = 13
           NameLabel.Left = 25
           AddrLabel.Parent = MainForm
           AddrLabel.Caption = "Address:"
           AddrLabel.Top = 38
           AddrLabel.Left = 25
           CityLabel.Parent = MainForm
           CityLabel.Caption = "City:"
           CityLabel.Top = 63
           CityLabel.Left = 25
           PhLabel.Parent = MainForm
           PhLabel.Caption = "Phone #:"
           PhLabel.Top = 88
           PhLabel.Left = 25
We're creating 4 label components, and we're going to use MainForm as our container for these components, hence the Parent = MainForm association. If for example, we created a QPANEL on our form, it can also act as a container for any of our controls. But we won't get into that until later. For the moment, take some time to digest the above code and add it to our previous listing.
We now have our Window, our 4 labels, now let's add the 4 edit controls to our application.
       DIM NameEdit AS QEDIT, AddrEdit AS QEDIT
       DIM CityEdit AS QEDIT, PhEdit AS QEDIT

           NameEdit.Parent = MainForm
           NameEdit.Left = 70
           NameEdit.Top = 10
           NameEdit.Width = 230
           AddrEdit.Parent = MainForm
           AddrEdit.Left = NameEdit.Left
           AddrEdit.Width = NameEdit.Width
           AddrEdit.Top = 35
           CityEdit.Parent = MainForm
           CityEdit.Left = NameEdit.Left
           CityEdit.Width = NameEdit.Width
           CityEdit.Top = 60
           PhEdit.Parent = MainForm
           PhEdit.Left = NameEdit.Left
           PhEdit.Width = NameEdit.Width
           PhEdit.Top = 85
Looks familar doesn't it? It's the same idea as our QLABELs, the biggest thing is correct placement on the form. In the above example, we're aligning all the QEDIT controls just after the QLABELs. Again, take some time to digest the above code and add it to our existing code.
All that's left is to add our 2 buttons and one listbox control. Here's how we do that:
       DIM AddButton AS QBUTTON, ClearButton AS QBUTTON
       DIM ListBox AS QLISTBOX

           AddButton.Parent = MainForm
           AddButton.Left = 70
           AddButton.Top = 115
           AddButton.Width = 110
           AddButton.Caption = "&Add to Database"
           ClearButton.Parent = MainForm
           ClearButton.Left = 190
           ClearButton.Top = 115
           ClearButton.Width = 110
           ClearButton.Caption = "&Clear Database"

           ListBox.Parent = MainForm
           ListBox.Top = 150
           ListBox.Left = 70
           ListBox.Width = 230
           ListBox.Height = 150
Cut & Paste, and voila! Wow, we now have a form which looks exactly like the diagram above (section 4.1). Run it, fool around with it for a while, then return back, there's still two more things to implement.

 4.3 Handling Events
As you can see, the above code just flashes us with a nice user interface, but nothing to back it up with. If you tried clicking on the buttons, they do nothing. You'll have to write your event handler to handle a button click. Here's how:
           AddButton.OnClick = AddButtonClick
That it? Well, that's part of it, the OnClick event handler will transfer execution to the subroutine we named AddButtonClick. Now we'll have to go and write our subroutine. Just make sure you include the subroutine below, before adding the above code.
           SUB AddButtonClick
               IF ListBox.ItemCount > 0 THEN
                  '-- Add a nice separator
                  ListBox.AddItems "--------------------------"
               END IF
               ListBox.AddItems NameEdit.Text, AddrEdit.Text, _
                                CityEdit.Text, PhEdit.Text
           END SUB
Well, now we're getting somewhere. Whenever the user clicks on the add button, the code above gets executed. As you can see, all it does is add the text fields to our listbox. If you didn't already know, the underscore '_' character can be used in Rapid-Q to split up long lines. We're almost done, now we'll add an event handler for the other button.
           SUB ClearButtonClick
               ListBox.Clear
           END SUB

           ClearButton.OnClick = ClearButtonClick
Whew, if you counted all the lines, it is well below 100! Our application is now complete, you can play with it, add stuff to it, and generally learn from it.

4.4 Source code listing, in its entirety
DIM MainForm AS QFORM
DIM NameEdit AS QEDIT, AddrEdit AS QEDIT, _
    CityEdit AS QEDIT, PhEdit AS QEDIT
DIM NameLabel AS QLABEL, AddrLabel AS QLABEL, _
    CityLabel AS QLABEL, PhLabel AS QLABEL
DIM ListBox AS QLISTBOX
DIM AddButton AS QBUTTON, ClearButton AS QBUTTON

SUB AddButtonClick
  IF ListBox.ItemCount > 0 THEN
    '-- Add a nice separator
    ListBox.AddItems "--------------------------------"
  END IF
  ListBox.AddItems NameEdit.Text, AddrEdit.Text, _
                   CityEdit.Text, PhEdit.Text
END SUB

SUB ClearButtonClick
  ListBox.Clear
END SUB

NameLabel.Parent = MainForm
NameLabel.Caption = "Name:"
NameLabel.Top = 13
NameLabel.Left = 25
AddrLabel.Parent = MainForm
AddrLabel.Caption = "Address:"
AddrLabel.Top = 38
AddrLabel.Left = 25
CityLabel.Parent = MainForm
CityLabel.Caption = "City:"
CityLabel.Top = 63
CityLabel.Left = 25
PhLabel.Parent = MainForm
PhLabel.Caption = "Phone #:"
PhLabel.Top = 88
PhLabel.Left = 25

NameEdit.Parent = MainForm
NameEdit.Left = 70
NameEdit.Top = 10
NameEdit.Width = 230
AddrEdit.Parent = MainForm
AddrEdit.Left = NameEdit.Left
AddrEdit.Width = NameEdit.Width
AddrEdit.Top = 35
CityEdit.Parent = MainForm
CityEdit.Left = NameEdit.Left
CityEdit.Width = NameEdit.Width
CityEdit.Top = 60
PhEdit.Parent = MainForm
PhEdit.Left = NameEdit.Left
PhEdit.Width = NameEdit.Width
PhEdit.Top = 85

AddButton.Parent = MainForm
AddButton.Left = 70
AddButton.Top = 115
AddButton.Width = 110
AddButton.Caption = "&Add to Database"
AddButton.OnClick = AddButtonClick
ClearButton.Parent = MainForm
ClearButton.Left = 190
ClearButton.Top = 115
ClearButton.Width = 110
ClearButton.Caption = "&Clear Database"
ClearButton.OnClick = ClearButtonClick

ListBox.Parent = MainForm
ListBox.Top = 150
ListBox.Left = 70
ListBox.Width = 230
ListBox.Height = 150

MainForm.Center
MainForm.Caption = "My First Application"
MainForm.Height = 340
MainForm.Width = 350
MainForm.ShowModal


Chapter 5: Introduction to forms

Rapid-Q Documentation by William Yu (c)1999-2000 Chapter 5

5. Introduction to forms

The basic concepts of forms are introduced in this chapter. The example program in the previous chapter will definitely help you understand the concepts a little better. I will use the terms form and windows interchangeably.

5.1 What's in a form?
A form (or window), is a generic container that can be displayed on your desktop. It is like a panel (see QPANEL). A form can have many appearences. In Rapid-Q, the only forms which are valid, are (you can also define custom shapes for your forms, using the method SHAPEFORM):
The default form is bsSizeable. What exactly is bsNone good for? Games :-) That's right, if the form is maximized, you can utilize the whole screen for your game. It can serve other purposes as well... MSIE uses it for a full screen web browser. Looks ugly though. If you're not sure how all these variables come from, take a look at RAPIDQ.INC bsNone = 0, bsSingle = 1, etc... these variables just make programming easier, so you don't need to remember the exact number, just the variable name to use.
          $INCLUDE "RAPIDQ.INC"

          DIM Form AS QFORM
          Form.BorderStyle = bsDialog
          Form.ShowModal
For bsSingle, the form looks exactly like bsSizeable, except that you cannot resize the form. In many cases, the only two useful forms are bsSizeable, and bsDialog.

5.2 Adding components to a form
If you followed closely the example in the previous chapter, you can add components onto the form simply by assigning the Parent property for that component.
        DIM Form AS QForm
        DIM Button AS QButton

        Button.Parent = Form       '' Add button to form
If you're wondering why that is, just consider a program with multiple forms. All visible components must have a Parent property. Components, such as QMENUITEM, or QTIMER do not have a parent property. Even though QMENUITEM is considered a "visible" component, its parent can only be a QMAINMENU or QPOPUPMENU. But instead of assigning a Parent property, you have to Add/Insert the items to the menu. If no Parent is given, the component remains hidden. In the case of QCANVAS or QIMAGE, you will get error messages if you try to draw on the components. This is because you can't draw on something not visible. In most cases, the Parent property should be the first property you assign before doing anything else. To hide components, you can use the Visible property.

5.3 Tracking the mouse position on a form
You can use MouseX and MouseY to track the position of the mouse on a form, but these 2 methods are being faded out. It is better just to handle the OnMouseMove event which pass the X and Y coordinates of the mouse position relative to the component.

5.4 Special events for forms
There are a few special events that only forms can handle. The most important is the OnResize event. This occurs whenever the user has clicked on the maximize button or manually resizes your form. Your program should almost always capture this event and update the size of your controls appropriately. Imagine if your MSIE browser window was 320x200, and when you resized the application to 640x480, the browser window was still 320x200. Looks ugly, because it is. If you don't want anyone resizing your form, just use a different BorderStyle as mentioned earlier.
Another special event is key presses. I suggest using OnKeyDown instead of OnKeyPress. The difference is that OnKeyDown can handle extended keys, and can detect Shift, Alt, and Ctrl states. If your application does not need to handle extended keys, then by all means, use OnKeyPress instead. Keyboard handling is useful for many applications that require it, like a typing tutor, games, etc... What might be confusing is the fact that OnKeyPress and OnKeyDown return extra parameters that you can use. This deviates from most of our understanding of Events. So far we've only covered simple events that don't require any special processing.
      SUB AddButtonClick
        '' Do stuff
      END SUB

      AddButton.OnClick = AddButtonClick
A simple click only passes a simple message to our button control, telling it that a click was received. Well, for key presses, this is more complicated. It's not enough to say that a key was pressed, we have to know what key was pressed, so we have to grab this extra message.
      SUB KeyPressed(Key AS WORD)
        '' Do stuff
        PRINT Key
      END SUB

      Form.OnKeyPress = KeyPressed
The key pressed is returned in the variable Key. You can name this anything you want, but your SUB must have at least that one parameter. Rapid-Q won't complain if you added more parameters, nor does it complain if you don't supply any parameters. It's up to you to make sure. For OnKeyDown, there's two parameters that are passed:
      SUB KeyDown(Key AS WORD, Shift AS INTEGER)
        '' Do stuff
        PRINT Key;" ";Shift
      END SUB

      Form.OnKeyDown = KeyDown
There are 3 shift states, ShiftDown, AltDown, and CtrlDown. Be careful of the ShiftDown state. Unlike OnKeyPress which handled all the Shiftdown states for you, OnKeyDown will not. This means if you pressed SHIFT+i you'll have to go UCASE$(Key). Extended keys are much different in Rapid-Q than what you'd expect in a QBasic program. For example, in QBasic, the arrow keys are easy to decode:
    DO
      A$=INKEY$
      IF A$=CHR$(0)+"H" THEN PRINT "Up arrow key pressed"
    LOOP
By using the OnKeyDown the virtual key code is returned, which is not a 2 byte code. The up arrow is Key = 38, left arrow Key = 37, right arrow Key = 39, and down arrow Key = 40

5.5 Dialog Boxes
A special type of form is a simple dialog box. Dialog boxes are usually extra interfaces to your main form. You don't usually implement a dialog box as your main form. For example, consider a main form where you have 3 choices:

Well, for each choice (except maybe for the last), you should create dialog boxes to handle the user's input. When the user clicks on the first button, a dialog box like this should appear:

The nice buttons are custom buttons. See RAPIDQ.INC for all the values.
     OKButton1.Kind = bkOK
     CancelButton1.Kind = bkCancel
Fine, but how do you know if the user pressed OK or CANCEL? There's actually two ways to do this, both involve using the ModalResult property. Remember how you called your dialog box:
   IF Dialog1.ShowModal = mrOK THEN
      '' User pressed OK
   ELSE
      '' User cancelled
   END IF
The ModalResult is a property of both the QButtons, and QForms. When we did this:
     OKButton1.Kind = bkOK
We also automatically did this:
     OKButton1.ModalResult = mrOK
What this means is that whenever you pressed the OK Button, the ModalResult returned is mrOK. This result automatically closes your Dialog1 form as well. Another less elegant approach is just to assign the ModalResult to your form. For example, let's assume this scenario:
      SUB ButtonClick
          Dialog1.ModalResult = mrOK
      END SUB

      OKButton1.ModalResult = mrNone   '' No result
      OKButton1.OnClick = ButtonClick
In the above scenario, clicking on the button will transfer control to the ButtonClick SUB. In this SUB, the ModalResult property of the Dialog1 form is set, which is doing exactly the samething as our previous example.

5.6 Using the CREATE Method
In most cases, using CREATE is preferred over DIM, this is because it saves you a lot of typing, and provides a cleaner look to your source code. For starters, let's just look at how much typing it could save you:
        DIM MainForm AS QForm
            MainForm.Left = 100
            MainForm.Top = 50
            MainForm.Height = 300
            MainForm.Width = 400
            MainForm.Caption = "Hello world!"
Well, here's what the above code looks like using CREATE:
        CREATE MainForm AS QForm
           Left = 100
           Top = 50
           Height = 300
           Width = 400
           Caption = "Hello world!"
        END CREATE
As you can see, you don't need to type MainForm each time, since the compiler will know exactly how you want the fields to be parsed.

5.7 Embedding CREATEs
Here's where using the CREATE method over DIM will save you time and confusion. This is what I mean about "encapsulation" of your controls:
        CREATE MainForm AS QForm
           Center
           CREATE Button1 AS QButton
              Left = 10: Top = 10: Height = 20: Width = 20
           END CREATE
           ShowModal
        END CREATE
You'll probably notice that we don't need the Parent property. This is because the compiler realizes that you want to include a Button to the MainForm (due to an embedded CREATE), so it automatically generates a Button1.Parent = MainForm for you. As you can also see, it looks much better, and you can visually see what components belong to want form/container. Rapid-Q can store up to 25 layers, in the above example, we only need one layer. I don't believe people need more than 4 or 5 layers (at most), but I set 25 as the maximum just to please the 1% who really want it. As you maybe able to figure out, components without a Parent property (non-visible components) are invalid in an Embedded CREATE.

5.8 Creating Menus
Creating menus using the CREATE method is no different:
        CREATE MainForm AS QForm
           Center
           CREATE MainMenu AS QMainMenu
              CREATE FileMenu AS QMenuItem
                Caption = "&File"
                CREATE OpenItem AS QMenuItem
                  Caption = "&Open"
                END CREATE
                CREATE SaveItem AS QMenuItem
                  Caption = "&Save"
                END CREATE
              END CREATE
           END CREATE
           ShowModal
        END CREATE
Instead of the Parent property, we're saving ourselves from using AddItems. This is probably easier to understand than using DIM to define all your menus.


Chapter 6: Writing Console Applications

Rapid-Q Documentation by William Yu (c)1999 Chapter 6

6. Writing Console Applications

Console applications are as easy to create as Windowed applications. Whenever you feel like creating text-based applications, just compile as CONSOLE instead of GUI. As you may find, it's easier to learn the fundamentals of Rapid-Q (or the BASIC language in general) by creating simple console applications and testing your routines. It can also act as a debugging tool for your GUI applications.

6.1 Overview of console functions
A console application is a text-based application capable of writing to and accepting input from the console. A console application, in Rapid-Q, consists of one visible screen, and 7 off screen buffers. Here's an overview of some console functions:
   CLS    - Clear console screen
   PRINT  - Write output to screen (visible/offscreen)
   INPUT  - Accept input from user
   PCOPY  - Used to copy to and from the screen buffers
   LOCATE - Position cursor
   POS(0) - Get current cursor column
   CSRLIN - Get current cursor row

   COLOR  - Change color attribute of text
   POKE   - Put attribute/char on screen
   PEEK   - Get attribute/char from screen
   SLEEP  - Delay
   INKEY$ - Non-blocking keyboard check
These functions mimic the ones you would see under QBasic. PEEK and POKE operate the same way, SLEEP is more precise than QBasic's (ie. you can specify a fraction of a second, like in PowerBASIC). Notice that you don't require any DEF SEG statements, since this is Windows.

6.2 Hello world example
Rapid-Q is like most BASIC languages, you can create a hello world program in just one line:
     PRINT "Hello World!"
Compile and run, you've just created your first useless console application for Windows! Let's move on to something more interesting, copying to and from screen buffers.
   CLS
   PRINT "This is page 1"

   PCOPY 0, 1    '-- Copy visible page 0, to off screen page 1

   CLS
   PRINT "Press any key to see page 1"

   DO:LOOP UNTIL INKEY$<>""

   PCOPY 1, 0    '-- Copy off screen page 1, to visible page 0
As you can see, our visible page is always 0. Our off screen pages range from 1-7. PCOPY just copies the whole buffer and places it into another. You can even copy an off screen buffer to another off screen buffer like so:
    PCOPY 1,5
The contents in buffer 1, is now copied to buffer 5. There's nothing new introduced here that you wouldn't have found in QBasic. One new feature is that you can now write to any offscreen page:
   PRINT #1, "Hi World!"       '-- Write to page 1
The above example will write the string "Hi World!" to the offscreen page 1. Make sure you use the pound sign '#' else it will be treated as a number. To see it, use PCOPY 1, 0.
 LOCATE and COLOR have the same effect on the offscreen pages. You can also PEEK from and POKE to the offscreen pages, just supply an additional parameter, the first being the page number to write/read from.

6.3 Using PEEK and POKE
If you've never used PEEK and POKE before, it's not a big deal. In Rapid-Q, PEEK and POKE have the same functionality of QBasic (except for the additional feature to PEEK/POKE to any offscreen page). Addresses range from 0 to 3999. This is because the screen size is restricted to 80x25 in Rapid-Q. But if 80x25 = 2000, what's the extra 2000 for?
    POKE 0, ASC("A")
    POKE 1, 15
If you run this code, you'll see a white letter 'A' displayed at the upperleft corner of your console. One thing you should note is that a "byte" on the screen contains a character and its attribute. All even numbered address contain the character, all odd numbered addresses contain the attribute. If you don't exactly know what an attribute is, it's just a combination of the foreground color and background color all in one byte (8-bits). The lower 4 bits is reserved for the foreground color, and the upper 4 bits is reserved for the background color. If you know anything about bits and bytes, you can easily calculate the attribute:
    B? = &H07       '-- 0 = background, 7 = foreground
Yes, you can have high intensity background colors. Blinking is not supported yet.

6.4 Accepting user input
You can accept user input via the INPUT statement or by the INKEY$ function. Rapid-Q's INPUT statement is not like "normal" Basic INPUT that you may be familiar with. It is more like a LINE INPUT in that it will prompt for a complete line of information and only terminates if the user hits the enter key.
   INPUT "What is your age? ", Age
A quoted string can follow an INPUT statement, then a comma or semi-colon, followed by a variable. The input statement will store the result in the variable, string or numeric. The INPUT statement will block until the user has hit the enter key. For non-blocking keyboard inputs, try using INKEY$. It's a bit confusing to use at first, but it allows for customized keyboard handling. Let's use the same example above to demonstrate how this is done using INKEY$. However, in this version, we can customize input and filter out non-numeric characters.
   PRINT "What is your age? ";
   AGE$ = ""
   DO
     DO
       A$ = INKEY$
     LOOP UNTIL LEN(A$)
     IF A$ = CHR$(13) THEN EXIT DO
     IF A$ >= "0" AND A$ <= "9" THEN PRINT A$;:AGE$=AGE$+A$
   LOOP
   PRINT
   PRINT "You are "; AGE$; " years old."
Notice that if you press a non-numeric key, that character is not echoed. This is because we've restricted input to characters 0..9 only. Although the example is much longer than the previous one, we have customized our input using INKEY$ and that provides so much more power than INPUT. Another advantage of using INKEY$ is that you can also trap extended keys.

6.5 Trapping Extended Keys
Extended keys are 2 bytes in length, the first byte is an ESC character, which can be ignored, and the second byte is the virtual key code. In the Windows version, you can add the option to trap all keys, including shift, ctrl, key, caps lock, num lock, scroll lock, and that PopupMenu key (if you're using a Windows specific keyboard, no not the StartMenu Key, the other one, if it exists on your keyboard). You can turn on/off this option anytime you wish:
   $OPTION INKEY$ TRAPALL

   ' trap all keys including shift, alt, ctrl, caps/num/scroll lock
   ' and the PopupMenu key

   $OPTION INKEY$ DEFAULT

   ' traps all extended keys except the ones listed above
If you've used QBasic, you probably know the scan codes inside out, so all the virtual key codes that Rapid-Q dishes out is exactly the same scan codes you'd see in QBasic. The following code is an example of how to trap/parse extended keys, particularly the arrow keys:
   DO
     DO
       A$ = INKEY$
     LOOP UNTIL LEN(A$)

     IF LEN(A$) = 2 THEN
       SELECT CASE RIGHT$(A$, 1)
         CASE "P"
           PRINT "Down arrow key pressed."
         CASE "H"
           PRINT "Up arrow key pressed."
         CASE "M"
           PRINT "Right arrow key pressed."
         CASE "K"
           PRINT "Left arrow key pressed."
         CASE ELSE
           PRINT "Extended key "; A$
       END SELECT
     END IF

   LOOP UNTIL A$ = CHR$(27)
Even if you didn't know the scan codes, you can look at the output of the above example to figure them out.

6.6 Mixing CONSOLE with GUI
As you've noticed in the above example, we've mixed some CONSOLE operations with GUI ones. This is perfectly valid as long as you've compiled your application as CONSOLE. Under Linux/Unix there are some strange differences, please refer to the compatibilty guide for more information. For example, a GUI application for Linux/Unix can perform some CONSOLE operations such as PRINT, INPUT, and CLS without being compiled as CONSOLE.

6.7 Linux/Unix Console
Since most terminals are different, some console features will not work. If your terminal does not support color, none will be displayed. You don't need to worry about these issues, as Rapid-Q performs all proper error checking for you. The same can be said for extended keys, some terminals don't support certain keys. However, most terminals do support the arrow keys and Page up/down keys. You're almost guaranteed that those keys will work for most terminals.


Chapter 7: Introduction to streams

Rapid-Q Documentation by William Yu (c)1999 Chapter 7

7. Introduction to streams

Rapid-Q supports file streams instead of the standard OPEN command used in BASIC. It has the same functionality, but is called differently. What's great about streams is that it's unlimited in size, and you can copy to and from different streams (ie. File to Memory).

7.1 File streams
File streams are used to create, read and write to files. All streams are opened as binary, with no locking capabilities (ie. all files you open are shared). Please familiarize yourself with these file modes:
     fmCreate    - Create file (read/write), truncate if file exists
     fmOpenRead  - Open file for reading only
     fmOpenWrite - Open file for writing only
     fmOpenReadWrite - Open file for reading & writing
To open a file you need to pass the filename, and provide one of the above file modes.
     DIM File AS QFileStream

     File.Open("Test.txt", fmOpenRead)
This will open Test.txt for reading only. To read data, you use the methods ReadNum and ReadStr. See RAPIDQ.INC for valid numbers.
     PRINT File.ReadNum(Num_SINGLE)   '-- Read 4 bytes as a SINGLE number
     PRINT File.ReadStr(1024)         '-- Read 1024 bytes
Another approach is to store the value into a variable, you can use the generic Read and Write routines.
     File.Read(A&)          '-- Read a long value and store in A&
     File.Write(B#)         '-- Write a double value B#

     '-- or similarily, with more work:
     A& = File.ReadNum(Num_LONG)
     File.WriteNum(B#, Num_DOUBLE)
After you're done with the file, make sure you close the handle. You can then reuse your file stream and open up another file. To test if you've reached the end of the file, you can either compare File.Position with File.Size or see if File.EOF is true (-1). So long as File.Position is less than File.Size, you haven't reached the end of the file. There are actually 2 ways to test if a file exists:
     IF FileExists("Test.txt") <> FALSE THEN
       File.Open("Test.txt", fmOpenRead)
     END IF
However, it's better just to cut this down to:
     IF File.Open("Test.txt", fmOpenRead) = FALSE THEN
        ShowMessage("Could not open file")
     END IF
File.Open will return a non-zero number if the file was successfully opened, 0 otherwise.

7.2 Memory streams
A memory stream is created whenever you DIM it. It's similar to file streams, all the methods are the same, such as ReadNum, WriteNum, etc... The only difference is that memory streams are stored in memory, which can grow/shrink with no upper bounds. It's even possible to store arrays of numbers in memory stream (see ARRAYS.BAS example). Memory streams serve many purposes, let your imagination take over. One useful purpose might be to store temporary data, such as copying a file to a memory stream and manipulating the data that way. So how can I copy from one stream to another? Quite easily, you can copy between different streams (ie. File to Memory) or of the same kind (ie. Memory to Memory).
    DIM File AS QFileStream
    File.Open("test.txt", fmOpenRead)

    DIM Memory AS QMemoryStream
    Memory.CopyFrom(File, File.Size)  '-- Copy everything
As you can see, we've just copied the entire contents of our file "test.txt" to our memory stream. Now you can manipulate your memory stream without affecting the file.

7.3 Saving/Loading UDTs and Arrays
Saving and loading UDTs is as simple as passing the UDT to QFileStream or QMemoryStream.
    TYPE TTest
        S AS STRING*8
        N AS INTEGER
    END TYPE

    DIM Test AS TTest
    DIM File AS QFileStream

    File.Open("test.txt", fmCreate)
    File.WriteUDT(Test)
    File.Close
In the above example, 12 bytes was saved to the file test.txt. 8 bytes for the fixed string S, and 4 bytes for N. To retrieve the UDT, use the method ReadUDT.
    File.Open("test.txt", fmOpenRead)
    File.ReadUDT(Test)
Saving/Loading arrays is equally easy.
    DIM A(1 TO 100) AS LONG
    DIM File AS QFileStream

    File.Open("test.txt", fmCreate)
    File.SaveArray(A(1), 100)
    File.Close
The first parameter of SaveArray is the starting array element to save, this could be any value from 1 to 100 in the above example. The next parameter specifies how many elements of the array to save. In this case we choose to save all 1..100 elements. Similarly, we can use LoadArray to retrieve our data:
    File.Open("test.txt", fmOpenRead)
    File.LoadArray(A(1), 100)
Streams are very popular in most high level languages for file/memory manipulation, but does take some time to get used to, especially if you're a die-hard BASIC user.


Chapter 8: Using Image Resources

Rapid-Q Documentation by William Yu (c)1999 Chapter 8

8. Using Image Resources

Most Windows programming languages offer support for .RES (Resource) files. A Resource file is nothing more than a collection of images (plus resource strings and data). In this chapter, you'll learn about Image lists, how to embed resources in your executable, and how to properly use them in your applications.

8.1 Supported RESOURCES
Rapid-Q only "directly" supports image resources, ie. just Icons and Bitmaps. So what exactly is the difference between loading a picture at run-time, or loading resource handles? For one thing, whenever you declare a resource handle, that picture file is automatically embedded within your executable. Here's an example:
     $RESOURCE ICO_TEST AS "C:\ICONS\TEST.ICO"

     DIM Form AS QForm

     Form.ICOHandle = ICO_TEST
     'Form.Icon = "C:\ICONS\TEST.ICO"
The file C:\ICONS\TEST.ICO is embedded within your executable, which means you don't need to include TEST.ICO if you plan on distributing your .EXE program. Rapid-Q doesn't generate .RES files for you, and it can't handle other people's .RES files either. Most languages you'll see have a .RES file, but you can't use them in Rapid-Q, you'll have to extract the pictures within it, and use the $RESOURCE handle directive to include them in your application. It is also possible to do this:
     Form.ICOHandle = ICO_TEST

     DIM Image AS QImage

     Image.Icon = Form.Icon
Image.Icon normally accepts a string value, but if no string is specified, it'll read the previously cached icon. In this case, we're loading Form.Icon to our "cache" and Image.Icon will read from it. So what does this do?
     Image.Icon = Form.Icon + Form2.Icon
This will load Form2.Icon into the cache, so Image.Icon will copy Form2.Icon. However, please note that you can't assign Icon Handles, for example:
     Image.IcoHandle = Form.IcoHandle
The parser will try to look for a resource handle, but won't find one.

8.2 Introduction to Image lists
You may want to refer to the Appendix on the properties, and methods of QImageList. An Image list is an array of icons and/or bitmaps. They are ordered from 0 to N. The first image you add will be index 0, the next index 1, etc... an image list store images of FIXED width and height. Anytime you change the Width or Height property, you're ultimately clearing the entire array. Note, this does not mean you can't add a 100x100 BMP file when your image list width is 32. It just means your BMP will be resized, whether you wanted that or not.
    DIM ImageList AS QImageList
        ImageList.Width = 32
        ImageList.Height = 32
        ImageList.AddICOFile("app.ico")
        ImageList.AddBMPFile("app.bmp", 0)
You can add icons or bitmaps in any order. As before, you can also add images from the "cache" if no filename was specified. As before:
    ImageList.AddICOFile(Form.Icon)
    ImageList.AddICOFile(ImageList.GetICO(0))

8.3 Other kinds of Resources
You can include any kind of resource to your Rapid-Q program, but how can you use these other kinds? For example, if I include a .WAV file as a resource, how can I use it in my PLAYWAV routine? Well, since PLAYWAV can take resource handles, you can just pass it as a parameter:
    $RESOURCE Bomb_WAV AS "BOMB.WAV"

    PlayWav(Bomb_WAV, 1)      '-- 1 = background play

    SLEEP 5                   '-- Wait until wav is finished
As for other types, you can extract the resource to be manipulated.
    $RESOURCE Whatever_TYPE AS "text.txt"

    ExtractResource(Resource(0), "text.txt")
After you're done using it, you can simply delete the file. There are a wide range of uses for extracting resources, you can even use this technique in an installation program. For more information on EXTRACTRESOURCE, RESOURCE, and RESOURCECOUNT, please see Appendix C: Other reserved keywords


Chapter 9: SUBI, FUNCTIONI, and DLLs

Rapid-Q Documentation by William Yu (c)1999-2000 Chapter 9

9. SUBI, FUNCTIONI, and DLLs

You'll learn all there needs to know about creating your own SUB/FUNCTIONs with variable number of parameters. If you know a little about C, you'll probably know about the most popular command printf. Well, it's actually possible to implement your own printf in Rapid-Q!

9.1 SUB/FUNCTIONs with variable parameters
Traditional SUBs or FUNCTIONs have a fixed number of parameters we can pass, but SUBI and FUNCTIONI can accept an infinite number (255) of variable parameters. You're probably wondering how we can retrieve these parameters, well, they are actually stored in an internal stack. So what you'll have to do is probe this stack for the correct parameter. Here are the keywords used to do that:
   ParamStr$()   - Array of string parameters
   ParamVal()    - Array of numeric parameters
   ParamValCount - Number of numeric parameters passed
   ParamStrCount - Number of string parameters passed
As a simple example, we'll just test to see that it works:
    SUBI TestSUBI (...)
       PRINT "String Parameters:  "; ParamStrCount
         FOR I = 1 TO ParamStrCount
           PRINT I;" "; ParamStr$(I)
         NEXT I
       PRINT "Numeric Parameters: "; ParamValCount
         FOR I = 1 TO ParamValCount
           PRINT I;" "; ParamVal(I)
         NEXT I
    END SUBI

    TestSUBI "Hello", 1234, "Hmmm", "Yeah...", 9876, 1*2*3*4, UCASE$("Last one")
You'll probably notice that the ParamStr$() and ParamVal() arrays aren't zero-based (ie. their first value starts at 1). This may seem strange, since everything in Rapid-Q is zero-based. Anyway, besides that, something equally strange is the use of (...) in replace of parameter names. It doesn't really matter what you put in the brackets, as long as it's a valid token (one word). Try creating a FUNCTIONI, it's no different from creating a standard FUNCTION except you replace your formal parameter names with (...).

9.2 More on FUNCTIONI
To expand our knowledge, let's do more examples, here's one that will find the maximum number from the parameters you provide it.
   FUNCTIONI FindMax (...) AS DOUBLE

     DIM Largest AS DOUBLE
     DIM I AS BYTE

     Largest = -999999999999

     FOR I = 1 TO ParamValCount
       IF ParamVal(I) > Largest THEN
          Largest = ParamVal(I)
       END IF
     NEXT

     FindMax = Largest         ' or Result = Largest
   END FUNCTIONI
The function goes through the entire list of numeric parameters and checks which one is the largest. Any string parameters are properly ignored. Now let's test it:
   PRINT "Largest number is: "; FindMax(523, 12.4, 602, 45, -1200)
   PRINT "Largest number is: "; FindMax(523, 12.4, FindMax(602, 45, -1200))
You can comfortably embed your FUNCTIONI if you like. There's really nothing to it. Just remember the keywords you need to access the internal stack, and away you go!

9.3 Introduction to DLLs
What is a DLL? It's a Dynamic Link Library which contain exported functions which can be used by any programming language that support DLLs. So you could write your DLL in Delphi or C++ and use those functions in Rapid-Q. DLLs work by loading in the same process space as your program, so you have access to their exported functions. DLLs in Rapid-Q can only be dynamically linked at run-time (ie. executed at run-time).

9.4 How to call a DLL
There is an example called DLL.BAS included in your Rapid-Q distribution. Included is also a DLL called PASCAL.DLL. You may want to take a look at it. To call DLLs in Rapid-Q is almost identical to the way you call DLLs in PowerBASIC or VisualBASIC. It may look nasty, but I've decided to conform to that standard... One thing to note is that CASE MATTERS! Yes, that's right, if you miscapitalized your function, ka-boom! Oops, not to confuse you even more, but there's actually 2 functions. One which you will call in your program, and the other is the one contained in the DLL. These two functions/subs must have matching parameters, or ka-boom!

    DECLARE SUB Test LIB "TEST.DLL" ALIAS "MyFunc" (S AS STRING)
So you must be wondering, which is case sensitive, Test or MyFunc. Well, Test is the one you'll be calling in your own program, so you know that can't be it, MyFunc is the one contained in the DLL, so make sure you typed that in correctly! The above SUB will point to the memory address of your DLL (when loaded), and execute the code within. As you can see, there's only one parameter for our MyFunc routine. There are only 2 extra keywords introduced here, LIB and ALIAS. After LIB should be a string corresponding to the path of your DLL. If your DLL resides in your $PATH setting, you don't need to specify any path (ie. if your TEST.DLL resides in C:\WINDOWS\SYSTEM). The second keyword ALIAS is to specify the function/subroutine you can execute in that DLL. Make sure you check your case, this is very important. If you're not sure of the case, you can use a DLL viewer (such as Quick View, more on this later). What are the valid datatypes to pass?
SHORT/WORD, INTEGER/LONG/DWORD, DOUBLE, STRING, QRECT, QNOTIFYICONDATA, and any UDT you create.
Unlike some implementations which force you to pass your STRING as a pointer, Rapid-Q will do all this for you, so you need not worry. Whenever you see LPZSTR as a parameter, that just means Long Pointer Zero-Terminated String. You can safely pass any string variable. You may notice that some BASIC languages (like VB) will ignore ALIAS whenever the function matches the same function you're declaring. For example:
    DECLARE SUB MyFunc LIB "TEST.DLL"
As long as your function matches that of the DLL function, you can ignore using ALIAS. However, this DOES NOT apply to Rapid-Q, you can't do this, so don't even try.
Calling a DLL function or calling your own function is exactly the same, there's nothing more you need to know:
    MyFunc("Hello")

9.5 Using Quick View
As mentioned before, if you're not sure of the exact case of your function, it's a good idea to take a look using Quick View.
Quick View is included with Windows (you don't need to download it). To invoke Quick View, load up Windows Explorer (or click on "My Computer"), then find a .DLL file, right click on it, and select Quick View from the menu. Look for an Export Table, that's where you'll find all the available functions. There are probably better DLL viewers available, but I won't advertise them here. Most of the time, Quick View is all you'll need.

9.6 Writing your own DLLs
As of this writing, it's not possible to write DLLs in Rapid-Q. Most languages are capable of creating DLLs, the only problem I see is STRINGs, especially if you're using VisualBasic or PowerBasic. Please use pointers to strings in your parameters to avoid using OLE to allocate the string itself. Rapid-Q won't use OLE to allocate the string, since I don't anticipate many DLLs that don't use pointers to strings.

9.7 Using unsupported types in DLL call
THIS SECTION IS NULL AND VOID WITH THE INTRODUCTION OF STRUCT, BUT CAN STILL BE USED IF YOU LIKE. Rapid-Q has a different storage mechanism for user defined TYPEs which renders it useless for DLL calls that require certain TYPE parameters. However, all is not lost. There is a cheap workaround which works just fine, but does need a little getting used to. DLL functions that require TYPE parameters need to be passed a pointer to that TYPE, so how is this accomplished? Let's look at an example of a DLL function which requires a TYPE parameter:
    DECLARE FUNCTION GetWindowRect LIB "USER32" ALIAS "GetWindowRect" _
                     (hWnd AS LONG, lpRect AS RECT) AS LONG
RECT is a structure of the form:
    TYPE RECT
        Left AS LONG
        Top AS LONG
        Right AS LONG
        Bottom AS LONG
    END TYPE
Naturally, you would like this to work:
    DIM R AS RECT

    GetWindowRect(MainForm.Handle, R)
YES, THIS WORKS NOW. However, Rapid-Q stores user defined types noncontiguously, ie. not as one whole block as required by the DLL call, so this call is invalid. So what does work? A simple workaround is necessary, using the ever useful QMEMORYSTREAM component:
    '' Notice the change in lpRect
    DECLARE FUNCTION GetWindowRect LIB "USER32" ALIAS "GetWindowRect" _
                     (hWnd AS LONG, lpRect AS LONG) AS LONG

    DIM R AS RECT
    DIM M AS QMEMORYSTREAM

    M.WriteUDT(R)
    GetWindowRect(MainForm.Handle, M.Pointer)
    M.Position
    M.ReadUDT(R)
The first thing we do is change the parameters of the DLL Function. We just changed the type of lpRect to LONG. This is because we want to pass a pointer (which is just a number). Here we use QMEMORYSTREAM to store the user defined type (using M.WriteUDT) in one contiguous block for our DLL call. All we have to do is pass the pointer to this block of memory and the DLL will read from this memory location. After calling the function we should retrieve the returned data (if necessary, in this case GetWindowRect returns the rect structure of the Window). This is rather simple, but what if there are nested TYPEs within a TYPE?
     TYPE Struct1
         A AS INTEGER
     END TYPE

     TYPE Struct2
         S AS Struct1
         I AS INTEGER
     END TYPE
If a DLL call requires a TYPE, which may have nested TYPEs, then you can do the same kind of conversion:
     TYPE Struct1
         A AS INTEGER
     END TYPE

     TYPE Struct2
         S AS LONG
         I AS INTEGER
     END TYPE

     DIM S1 AS Struct1
     DIM S2 AS Struct2

     DIM M1 AS QMEMORYSTREAM
     DIM M2 AS QMEMORYSTREAM

     M1.WriteUDT(S1)
     S2.S = M1.Pointer
     M2.WriteUDT(S2)

    '' Call DLL function...
Now the last case we have to consider is strings within TYPEs. We can't just declare a string anymore, we have to declare a pointer to a string, for example:
     TYPE TStruct
         ST AS STRING
         Other AS INTEGER
     END TYPE
This would not be valid since ST would be passed by value (in which case it can consume any number of bytes in memory). However, most DLL calls want strings passed by reference (ie. just give it the pointer to the string). A conversion is necessary, using VARPTR:
     TYPE TStruct
         ST AS LONG
         Other AS INTEGER
     END TYPE

     DIM Struct AS TStruct
     DIM S AS STRING

     S = SPACE$(100) '' Allocate some space for string
     Struct.ST = VARPTR(S)

    '' To get back the string use VARPTR$
    S = VARPTR$(Struct.ST)
Please note that this string conversion is only necessary for TYPEs and not necessary for normal DLL calls. For normal DLL calls which have STRING as parameters, just pass the string and not the pointer, since Rapid-Q will translate this automatically for you. You can, of course, do the conversion yourself, just remember to change the STRING parameter to something like LONG, and pass VARPTR(S$) instead of the actual string S$.

9.8 API conversion table
A lot of people have requested an API guide to convert their WinAPI declarations in C or VB to use with Rapid-Q, so here is a basic summary with some brief explanations. Special thanks to Mayuresh S. Kadu for this WIN32 API in VB guide.
C data type | Pascal | VB | Rapid-Q
ATOM | SHORT | byval as INTEGER | SHORT
BOOL | BOOLEAN | byval as LONG | LONG
BYTE | BYTE | byval as BYTE | BYTE
CHAR | CHAR | byval as BYTE | BYTE
CHAR[20] | STRING[20] | as STRING | N/A in API Declarations
COLORREF | LONGINT | byval as LONG | LONG
DWORD | DWORD | byval as LONG | DWORD
Windows handles ie. HDC | Windows Handles | byval as LONG | LONG
INT, UINT | INTEGER, DWORD | byval as LONG | INTEGER, DWORD
LONG | LONGINT | byval as LONG | LONG
LPARAM | LONGINT | byval as LONG | LONG
LPDWORD | ^DWORD | as LONG | BYREF as DWORD
LPINT, LPUINT | ^INTEGER | as LONG | BYREF as LONG
LPRECT | ^TRECT | as ANY | QRECT
LPSTR, LPCSTR | PCHAR | byval as STRING | BYREF as STRING
LPVOID | LONGINT | as ANY | LONG
LPWORD | ^WORD | as INTEGER | BYREF as WORD
LRESULT | LONGINT | byval as LONG | LONG
NULL | NIL | byval as LONG | LONG
SHORT | SHORT | byval as INTEGER | SHORT
WORD | WORD | byval as INTEGER | WORD
WPARAM | LONGINT | byval as LONG | LONG

For those data types in red, they are pointers to the variable. In Rapid-Q, this requires using VARPTR in passing the address of the variable, and not the value of the variable. Here's some sample conversions:
  In VB:
        DECLARE SUB Test LIB "USER32" ALIAS "What" _
                     (byval L AS LONG, byval S AS STRING)

        Test (1230, "Hello world!")

  In Rapid-Q:
        DECLARE SUB Test LIB "USER32" ALIAS "What" _
                     (byval L AS LONG, byval S AS STRING)

        Test (1230, "Hello world!")
Nothing different there, note that Rapid-Q doesn't use BYVAL, so you can ignore putting them there. In the above example, the string is passed by reference, ie. the address of the string is passed, not the string itself. Here's an example which passes the whole string (not the address, so it involves OLE to allocate space for the string), this works fine in VB but not in Rapid-Q:
  In VB:
        DECLARE SUB Test LIB "USER32" ALIAS "What" _
                     (byval L AS LONG, S AS STRING)

        Test (1230, "Hello world!")

  In Rapid-Q:
        Not possible, since it doesn't use OLE to allocate the string.
How about NULL strings? Here's another situation (please note that I don't use VB much so it may be possible to declare S as STRING and pass it a vbNullString, I'm not really sure so I'll play it safe):
  In VB:
        DECLARE SUB Test LIB "USER32" ALIAS "What" _
                     (byval L AS LONG, byval S AS LONG)

        Test (1230, 0&)

  In Rapid-Q:
        DECLARE SUB Test LIB "USER32" ALIAS "What" _
                     (byval L AS LONG, byval S AS LONG)

        Test (1230, 0&)
So what if we want to pass a string instead of a NULL string, then you'd need to use VARPTR:
  In VB or Rapid-Q:
        DIM S AS STRING
        S = "Hello world!"

        Test (1230, VARPTR(S))
A NULL string basically means an address of 0. VARPTR just returns the address of a variable. How about other pointers, like LPWORD? A WORD is just an unsigned 16-bit number, VB only supports signed 16-bit numbers called INTEGERs, but the general idea is to remove the byval keyword when passing variables by reference:
  In VB (doesn't support WORD, so use next best):
        DECLARE SUB Test LIB "USER32" ALIAS "Another" _
                     (L AS INTEGER)

        DIM L AS INTEGER

        Test (L)

  In Rapid-Q:
        DECLARE SUB Test LIB "USER32" ALIAS "Another" _
                     (BYREF L AS WORD)

        DIM L AS WORD

        Test (L)
In Rapid-Q, use BYREF when passing variables by reference, in VB you don't need to use BYREF, as the above example demonstrates.


Chapter 10: Creating Custom Components

Rapid-Q Documentation by William Yu (c)1999 Chapter 10

10. Creating Custom Components

Creating your own custom components may be helpful when you want to have a custom look and feel to your forms (among other things). For example, instead of the the standard Windows checkboxes, you may want to create diamond like checkboxes (complete listing at end of chapter). By the end of this chapter, you'll be able to create your own fully reuseable components, even custom forms! We will start with a simple example of a diamond checkbox.

10.1 Introduction to object creation
You won't exactly be reinventing the wheel when you create your own custom objects. The way you create your own objects is to EXTEND a component (like QCanvas). What this means is that you'll inherit all its properties, methods, and events. After that, you may choose to override its properties, and/or methods, or create new properties and methods. The concept is really easy to understand, once you get the hang of things. Rapid-Q's component creation method doesn't resemble any language per se, but it doesn't look too foreign either. Since object creation is not something newbies should step right into, you should familiarize yourself with the concept of properties, methods, and events. You also need a good understanding of TYPEs, since events/methods within types is something new. Do not get confused with other OOP languages, Rapid-Q does not adopt overloading, protected or virtual members. Rapid-Q's OCC (Object Component Creation) paradigm doesn't model any language, but does take several ideas from other OOP languages like Delphi, C++ and Java.

10.2 Extending QCanvas
QCanvas is a very useful "blank sheet" component. It allows you to draw whatever you want on it, making this the most useful component to extend. First of all, how exactly do we extend it?
     TYPE QDiamondBox EXTENDS QCanvas
     END TYPE
Wow, that was easy. The above code is perfectly valid, although it doesn't do anything useful. What that did was create a new object called QDiamondBox which inherited all the properties, methods, and events of QCanvas. So we can now DIM it and assign values to it:
     DIM DBox AS QDiamondBox
         DBox.Top = 10
Okay, that's not very useful. Sometimes we would like to add properties to our existing component, and in our above example, we probably need a Caption property, and maybe a Checked property (since we're going to implement a checkbox type component). Adding properties is nothing new:
     TYPE QDiamondBox EXTENDS QCanvas
        Caption AS STRING
        Checked AS INTEGER
     END TYPE
As you can see, it looks like any UDT (user defined types) that most BASIC programmers are familiar with. So now we've added 2 additional properties to our new component, we'd access them like we would any property. Okay, but what if you want the values to be initialized to something when it gets created? Not a problem, you don't need a constructor procedure like in C++, you just embed this information like so:
     TYPE QDiamondBox EXTENDS QCanvas
        Caption AS STRING
        Checked AS INTEGER

        CONSTRUCTOR
          Caption = "DiamondBox"
          Checked = 0
        END CONSTRUCTOR
     END TYPE
After each DIM (that is, when you create the object), the default values are initialized. Rapid-Q does not require DESTRUCTORs though, as everything is automatically cleaned up for you when your program terminates. If you're not convinced this worked, test it out:
     DIM DBox AS QDiamondBox

     ShowMessage(DBox.Caption)
If it doesn't return 'DiamondBox' then something is wrong, check your spelling, and turn $TYPECHECK ON.

10.3 Adding/Overriding Methods
In Rapid-Q, all methods, properties, and events can be overridden. In fact, you can override a method and treat it like it were a property or custom event. Once you override this method/property, you won't be able to access the inherited one (since it's hidden). To access this property or method, you must explicitly call the SUPER class as demonstrated below. Becareful if using WITH Super ... END WITH, since all properties/methods will be referenced as the super class. The concept of overriding properties or methods is simple enough, instead of using the inherited properties, we can just redefine them instead.
     TYPE QDiamondBox EXTENDS QCanvas
        Left AS STRING
        Top AS BYTE

        SUB Pset
            PRINT Super.Left
        END SUB
     END TYPE
In the above example, we've overriding 2 properties of QCanvas, and 1 method. As you'll see, QDiamondBox has a property named Left which overrides the Left property of QCanvas. To use the Left property of the super class, we just use the provided invocation Super.Left instead of QDiamondBox.Left. Overriding methods and properties have many useful purposes. Consider a filter listbox. You can override the AddItems method, and create one yourself, but filtering out certain keywords you don't want included. It's also useful when you're porting your Windows code to Linux and vice versa. This way, you can have your own "standard" component for both versions. In any event, we won't cover this topic any further. Let's now move on to creating new methods for our components:
     TYPE QDiamondBox EXTENDS QCanvas
       Caption AS STRING
       Checked AS INTEGER

       FUNCTION TextSize AS INTEGER
         Result = LEN(QDiamondBox.Caption)
         'QDiamondBox.TextSize = LEN(QDiamondBox.Caption)
       END FUNCTION
     END TYPE
The above example is a good place to start. We've just defined a new method for our QDiamondBox component. As you've noticed, we have to embed our FUNCTIONs or SUBs in our TYPE declaration. This is called INLINE code, you should be familiar with this if you've used C++ or any other OOP language. Rapid-Q requires INLINE code, you cannot define your SUB and then have the SUB sitting outside our TYPE definition. Okay, the only thing that stands out is QDiamondBox.Caption, which does what exactly? Well, you're probably wondering why we couldn't just say
      Result = LEN(Caption)
Well, this doesn't help, since in our FUNCTION, we could have easily added
      DIM Caption AS INTEGER
Then Rapid-Q would be confused... Which one should I use, the local Caption variable, or the new property one? To ease the pain, when you want to use a property, or method you must also reference them as you would normally. Our object in this case is QDiamondBox (you can also use the reserved word this), and we want to reference the property Caption. Since the above method is pretty much useless in our component, we'll just drop it from our design. What we really need is a method to draw our component, so here we go:

  SUB DrawComponent
    IF QDiamondBox.Checked THEN
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,0)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,0)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Paint(QDiamondBox.Height/2, QDiamondBox.Height/2, QDiamondBox.HiLightColor, 0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,&HFFFFFF)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,&HFFFFFF)
    ELSE
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,0)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,0)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Paint(QDiamondBox.Height/2, QDiamondBox.Height/2, &HBBBBBB, 0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,&HFFFFFF)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,&HFFFFFF)
    END IF
    QDiamondBox.TextOut(QDiamondBox.Height + 5, QDiamondBox.Height/2-QDiamondBox.Height/4, QDiamondBox.Caption, 0, -1)
  END SUB
It may look nasty, but further investigation proves it's just long lines that appear cryptic. What the above code will do is draw a diamond and properly size your component so that it looks nice whenever you resize your component. This is very important, since you don't want your component to look like a miniature when your user specified Height = 100, Width = 100, etc... Just insert the above code inside our TYPE declaration. We also need to define another property HiLightColor. Whenever our check box is checked, we probably want our component to change color to notify the user that the box has been checked.

10.4 Defining Events
It's possible to define new events for our components, but this will be covered later For now we have all we need for our QDiamondBox component, OnPaint, and OnClick. So why exactly do we need to define events? Don't we just let the user do that? Yes, but since this is our custom component, we want things to happen. For example, the QCheckBox component automatically becomes checked and unchecked when we click on it, we didn't need to write our own event handler to do that. This is that samething we want to happen for our own custom component. For starters, we'll need our OnPaint event. This event is called each time the form/component is updated.
     TYPE QDiamondBox EXTENDS QCanvas
       'Properties here

       'Our DrawComponent Method here

       EVENT OnClick
         IF QDiamondBox.Checked THEN
           QDiamondBox.Checked = 0
         ELSE
           QDiamondBox.Checked = 1
         END IF
         QDiamondBox.DrawComponent
       END EVENT

       EVENT OnPaint
         QDiamondBox.DrawComponent
       END EVENT
     END TYPE
Fairly straightforward, we've already covered why you'd reference DrawComponent like so, but the EVENT identifier is new. All that says is we're creating an EVENT handler for our component. Write your code like you would normally. Whenever we create (DIM) our new component, the events are automatically registered for us. They are called whenever that event happens. Fair enough, but what if I need to write a new event handler? In our QDiamondBox example, we're definitely going to need to redefine OnClick, since we want to know whether the user has checked or unchecked the DiamondBox. This is probably where it gets naughty. Since we don't actually want to discard our previous declaration of OnClick, we'll have to inherit it.
     DIM DBox AS QDiamondBox

     SUB NewDBoxOnClick
         DBox.InheritOnClick
         ' do you stuff here
     END SUB

     DBox.OnClick = NewDBoxOnClick
As you can see, if we wanted to inherit the OnClick event, we reference it by using QObject.Inherit<EventName> Where EventName is the event we want inherited. It's actually possible to Inherit OnPaint in our above example, but that would serve no purpose. If the Inherited event is not found (ie. there was no previous declaration of it), you will get a compiler ERROR message.

10.5 Adding components to our component (composition)
In our example, there's really no need to include components to our new QDiamondBox component, but since this topic is useful for many purposes, it's covered in this section. You can only add Rapid-Q components, not ones you've created yourself. As before, there's nothing new to the way we add components or properties:
     TYPE QGenericForm AS QForm
       Panel AS QPanel
     END TYPE

     DIM GF AS QGenericForm
         GF.Panel.Left = 123
Notice how we reference an object within an object. First period is to reference our Panel object, and the second period is to reference the Panel's properties or methods. If you wanted your panel to have some default values, you use the CONSTRUCTOR method as before:
     TYPE QGenericForm AS QForm
       Panel AS QPanel

       CONSTRUCTOR
          Panel.Parent = QGenericForm
          Panel.Width = QGenericForm.ClientWidth
          Panel.Height = QGenericForm.ClientHeight
       END CONSTRUCTOR
     END TYPE
You'll probably notice that even though we've somewhat implied that the Panel will be a part of the form, we still need to assign its Parent property, or else the panel won't show up. Simple enough, but how about defining its EVENTs? Okay, no problem:
     TYPE QGenericForm AS QForm
       Panel AS QPanel

       EVENT Panel.OnClick
         ShowMessage("User clicked on panel")
       END EVENT

       EVENT OnClick
         ShowMessage("User clicked on form")
       END EVENT
     END TYPE
Notice the extra reference (period). If you ignored that, the OnClick EVENT will be attached to your QGenericForm instead. As before, to inherit EVENTs, you'll have to do something like:
     GF.Panel.OnClick = GF.Panel.InheritOnClick
Most of the time, you never really want to access the components within a component directly. For example, you can create your own custom form, with close buttons, resize buttons etc... none of which you want to rewrite event handlers for.

10.6 Extending an empty Component
There may be cases when you don't need to extend any component, and you just want to write your own custom interface object. A good example is implementing a QIniFile interface object. Perhaps provide properties and methods to easily access and write to your own custom .INI file or however you want to do it. To do this, there is an empty object provided in Rapid-Q:
    TYPE QIniFile EXTENDS QObject
       Size AS INTEGER
       FileName AS STRING

       SUB SaveINI
       END SUB
       SUB LoadINI
       END SUB
    END TYPE
This kind of object acts like QSocket. ie. It's not a visible component, it's mainly an interface type object. Objects provide a cleaner interface, and is more elegant (well, I don't really care myself). In conclusion, this is basically all you need to know about adding your own components to Rapid-Q, it's fairly easy to grasp.

10.7 Public/Private properties and methods
All properties and methods are PUBLIC by default. Here's how you can define the scope of your properties and methods:
     TYPE QText EXTENDS QObject
       PUBLIC:
         I AS INTEGER
         X AS INTEGER

       PRIVATE:
         Y AS INTEGER

       PUBLIC:
         SUB Test
            QText.X = QText.Y + 1
         END SUB
     END TYPE
Properties I and X are PUBLIC, meaning they can be used outside their scope (ie. outside TYPE). Same with method Test. However, property Y is PRIVATE, so you can not use the property Y outside its scope. Since SUB Test is still inside the scope of Y (ie. inside TYPE), you can use it there. You can define PROTECTED properties and methods, but they act exactly like PUBLIC properties and methods, since (as of this writing) you can't extend a type of your own. For those who don't have any OOP background, the reason you have PUBLIC and PRIVATE members is mainly for your end-user's sake. Obviously you'll know what members shouldn't be used outside its scope, but by defining PRIVATE members you tell your end-users not to touch these in your program since they are used "internally."

10.8 Templates and property sets
We have yet to cover how one creates their own custom events, so we'll get to that very soon, however, there are a few more interesting techniques, one called templates which you can use in your TYPE definition, and another called property sets. We will get to property sets later in this section, but let's start with templates. A template type definition may look a bit odd, but it was more or less modelled after C++.
    TYPE NewClass<DataType> EXTENDS QOBJECT
        N AS DataType
    END TYPE
Directly after declaring the new type, you can define the template <parameters>. In the above example, our only parameter is DataType, but you are allowed infinitely many parameters. Unlike C++ though, you don't specify the type of parameter, just the name. Now when you DIM this new type, you have to pass it that one extra template parameter:
    DIM MyClass1 AS NewClass<INTEGER>
    DIM MyClass2 AS NewClass<STRING>
Notice now how this works, the property N of MyClass1 is bound to an INTEGER data type, while MyClass2 has an N property which is bound to a STRING data type. Here are some other examples:
    TYPE Arrays<DataType, Size> EXTENDS QOBJECT
        Item(Size) AS DataType

        SUB Clear
            DIM N AS DataType
            DIM I AS LONG
            DIM V AS VARIANT

            WITH Arrays
                V = .Item(0)
                IF VARTYPE(V) = 2 THEN
                    '-- String data type
                    FOR I = 0 TO Size
                        .Item(I) = ""
                    NEXT
                ELSE
                    '-- Integer/Float
                    FOR I = 0 TO Size
                        .Item(I) = 0
                    NEXT
                END IF
            END WITH
        END SUB
    END TYPE

    DIM IntArray AS ARRAYS<INTEGER, 100>
    DIM StrArray AS ARRAYS<STRING, 50>

    IntArray.Clear
    IntArray.Item(1) = 99
    StrArray.Clear
    StrArray.Item(1) = "Hello world"

    PRINT IntArray.Item(1)
    PRINT StrArray.Item(1)
The use of templates can help reduce the amount of code by reusing the same TYPE for our INTEGER and STRING arrays. Now that we've covered templates, let's move on now to property sets. A property set is just a collection of properties, with one major difference, you can do special processing when a user sets the property. We will start with a somewhat useless example
    TYPE TForm EXTENDS QFORM
        Focus AS LONG PROPERTY SET Set_Focus

        PROPERTY SET Set_Focus (Handle AS LONG)
            WITH TForm
                .Focus = Handle
                IF .Focus THEN
                    SetFocus(Handle)
                END IF
            END WITH
        END PROPERTY
    END TYPE

    CREATE Form AS TForm
        CREATE Edit AS QEDIT
        END CREATE
        Focus = Edit.Handle
    END CREATE
Nevermind the function SetFocus, it's just an API call. In the above example, Focus is a property set, whenever you assign a value to this property, it automatically calls the routine Set_Focus as outlined in the SET parameter with the parameter being the value being assigned to it. Of course, you may be wondering why you'd even need this since it's equivalent to doing this:
    TYPE TForm EXTENDS QFORM
        SUB Focus (Handle AS LONG)
            IF Handle THEN
               SetFocus(Handle)
            END IF
        END SUB
    END TYPE

    CREATE Form AS TForm
        CREATE Edit AS QEDIT
        END CREATE
        Focus(Edit.Handle)
    END CREATE
As you may notice in this example, since Focus is a SUB, you can't retrieve the value (like in our previous example). In this case, you'd have to use another name such as GetFocus to check which handle has the focus. In the previous example, we can read and write the property and perform special processing when the property is assigned, which is what we wanted. Take for example, how the BorderStyle of QFORM is changed, when we assign a new value to BorderStyle, this initiates a sequence of events, but since BorderStyle is a property set, we don't need to define a SUB to set the style and a FUNCTION to retrieve the value.
    TYPE TForm EXTENDS QFORM
        GetStyle AS LONG
        SUB BorderStyle (Style AS LONG)
            TForm.GetStyle = Style
            SendMessage(TForm.Handle, etc...)
        END SUB
    END TYPE

    CREATE Form AS TFORM
        BorderStyle(bsNone)
        Caption = STR$(Form.GetStyle)
    END CREATE
That's a real waste as you can see, so you'd probably use property sets in that case. Obviously you won't need property sets if you don't require any special processing when assigning a value to a property. If you do decide to use property sets, there are some rules to follow: 1. Property and parameter should be of the same type; 2. Only simple types and QObjects are allowed to be property sets, so this excludes arrays and UDTs. The compiler will warn you if you violate these rules, but sometimes the error messages aren't so clear.

10.9 Custom events
Custom events are triggered by the programmer, ie. you. Let's try to come up with a situation where we would need to trigger an event. Take for example the QSOCKET component. It's completely void of any events, what if we want to know when the server is ready? Obviously we can keep polling to see when this occurs, but wouldn't it be nice if it was triggered for you, and then you can write an event handler to do what you want. I won't actually write the complete example, just the necessary parts to demonstrate how to create your own custom events:
    '-- Define, but don't implement, a template function
    DECLARE SUB ServerReady_EventTemplate (Socket AS LONG)

    TYPE TSocket EXTENDS QSOCKET
        OnServerReady AS EVENT(ServerReady_EventTemplate)
        Timer1 AS QTIMER
        Sock AS LONG

        EVENT Timer1.OnTimer
            WITH TSocket
                IF .IsServerReady(.Sock) AND .OnServerReady > 0 THEN
                    '-- OnServerReady  > 0 is to check whether pointer is null
                    '-- ie. is there really an event handler assigned
                    '-- If assigned, then trigger the event
                    CALLFUNC(.OnServerReady, .Sock)
                END IF
            END WITH
        END EVENT

        CONSTRUCTOR
            OnServerReady = 0
            Timer1.Enabled = 1
            Timer1.Interval = 500
        END CONSTRUCTOR
    END TYPE

    SUB ServerReady (Sock AS LONG)
        PRINT Sock;" is ready."
    END SUB

    CREATE Socket AS QSOCKET
        OnServerReady = ServerReady
    END CREATE
It might be a good idea to go through the next chapter on Function Pointers, since this is basically how custom events work. OnServerReady is really a function pointer, which points to a SUB (if assigned, if not, it is equivalent to 0). A declaration of the template SUB is required, this is to provide CALLFUNC with the necessary parameter types, if any. It may seem a bit confusing at first, since it takes some time getting used to the syntax and the idea of triggering an event. However, creating custom events has many benefits and uses, so learning how to create your own events could greatly simplify the use of your component or even extend the functionality of others (such as the above example).

10.10 QDiamondBox Source Code Listing
$APPTYPE GUI
$TYPECHECK ON

TYPE QDiamondBox EXTENDS QCanvas     '' You can extend any QObject
  '-- New Properties, you can also add components
  Caption AS STRING
  Checked AS INTEGER
  HiLightColor AS INTEGER

  '-- There are no protected methods, but you should let the user know anyway.
  '-- PROTECTED (meaning you shouldn't directly call it in your program).
  SUB DrawComponent
    IF QDiamondBox.Checked THEN
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,0)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,0)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Paint(QDiamondBox.Height/2, QDiamondBox.Height/2, QDiamondBox.HiLightColor, 0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,&HFFFFFF)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,&HFFFFFF)
    ELSE
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,0)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,QDiamondBox.Height,QDiamondBox.Height/2,0)
      QDiamondBox.Line(QDiamondBox.Height,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,0)
      QDiamondBox.Paint(QDiamondBox.Height/2, QDiamondBox.Height/2, &HBBBBBB, 0)
      QDiamondBox.Line(QDiamondBox.Height/2,0,0,QDiamondBox.Height/2,&HFFFFFF)
      QDiamondBox.Line(0,QDiamondBox.Height/2,QDiamondBox.Height/2,QDiamondBox.Height,&HFFFFFF)
    END IF
    QDiamondBox.TextOut(QDiamondBox.Height + 5, QDiamondBox.Height/2-QDiamondBox.Height/4, QDiamondBox.Caption, 0, -1)
  END SUB

  '-- Inherited Events (sorry, can't create any new events)
  '-- The user can still override these events, but it's not a good idea.
  EVENT OnClick
    IF QDiamondBox.Checked THEN
      QDiamondBox.Checked = 0
    ELSE
      QDiamondBox.Checked = 1
    END IF
    QDiamondBox.DrawComponent
  END EVENT

  EVENT OnPaint
    QDiamondBox.DrawComponent
  END EVENT

  '-- Default values
  CONSTRUCTOR
    Height = 30
    Width = 100
    HiLightColor = &H00FF00
    Caption = "DiamondBox"
    Checked = 0
  END CONSTRUCTOR
END TYPE

'----- Test our new component

DECLARE SUB DBox2Click

DIM Font AS QFont
    Font.Name = "Arial"
    Font.Size = 10

CREATE Form AS QForm
  Center
  Height = 120
  Caption = "Custom Check Boxes"
  CREATE DBox1 AS QDiamondBox
    Caption = "Diamond Box 1"
    Left = 100
    Height = 20
  END CREATE
  CREATE DBox2 AS QDiamondBox
    Caption = "Diamond Box 2"
    Top = 30
    Left = 100
    Height = 20
    Width = 140
    HiLightColor = &H0000FF
    Font = Font
    ShowHint = 1 ' True
    Hint = "Click me"
    OnClick = DBox2Click
  END CREATE
  CREATE DBox3 AS QDiamondBox
    Caption = "Diamond Box 3"
    Top = 60
    Left = 100
    Height = 20
  END CREATE
  ShowModal
END CREATE

SUB DBox2Click
  DBox2.InheritOnClick    '' Inherit event
  ShowMessage("Diamond Box 2 clicked")
END SUB


Chapter 11: Using function pointers

Rapid-Q Documentation by William Yu (c)1999 Chapter 11

11. Using Function Pointers

Didn't think you'd see function pointers in a BASIC programming language did you? Well, in Rapid-Q function pointers are a bit different from what most people are used to. There are a few oddities I guess, but most of the important features are there, like redefining function pointers, and dynamic function pointers. Unfortunately (as of this writing), you can't pass function pointers as arguments.

11.1 Introduction to the concept
Great, so what are function pointers? I know a lot people are tired of terminology, only because the definition is probably a lot easier to understand/grasp. It helps to understand how things are stored in memory and addressed. For example, a function (ie. SUB or FUNCTION) occupies space in some address space somewhere. A pointer to that function is just the address of it. So if I know the address of the function, I can jump into that "process space" and execute the code within. This is the low level way of thinking, first push the parameters, and then jump to (ie. CALL) the function. So if pointers are only numbers, how do we find the address of the function? This is the question that will be considered next.

11.2 Defining function pointers
If you have prior experience with function pointers (ie. in C) there are a few differences you'll have to get accustomed to. In Rapid-Q, since function pointers are just numbers, you can use any valid numeric datatype to define your function pointers. Seems odd, yes, but pointers are only numbers. Try avoiding BYTE, since the address of your function may be greater than 255, using BYTE may not be large enough. I suggest sticking with INTEGER/LONG.
    DECLARE SUB Test (I AS INTEGER)

    DIM FPtr AS INTEGER

    BIND FPtr TO Test
Well, we use BIND in Rapid-Q to bind our variable FPtr to the function Test. This will do 2 things, obviously FPtr will point to the address space of Test, but it also binds the number of parameters to FPtr, this is important for the compiler so that it knows how many parameters to pass/accept. To call our function, we have to use the reserved word CALLFUNC:
    CALLFUNC(FPtr, 120)
This calls our SUB Test with 1 parameter. Obviously this isn't a very useful example, so consider when it is useful...
    DECLARE SUB Test1 (I AS INTEGER)
    DECLARE SUB Test2 (I AS INTEGER)

    DIM FPtr(1 TO 2) AS INTEGER

    BIND FPtr(1) TO Test1
    BIND FPtr(2) TO Test2
When you're binding arrays, please note that the first function that is bound will be the TEMPLATE for all your other elements. Confusing? Okay, let me put this into words people can understand. :) Our array is FPtr, our BIND bounds FPtr(1) to SUB Test1. FPtr is now BOUND. What this means is that if you BIND any other FPtr(i), the function MUST HAVE MATCHING NUMBER OF PARAMETERS. Maybe an example would help:
    DECLARE SUB Test1 (I AS INTEGER)
    DECLARE SUB Test2 (I AS INTEGER, J AS STRING)

    DIM FPtr(1 TO 2) AS INTEGER

    BIND FPtr(1) TO Test1
    BIND FPtr(2) TO Test2
The second BIND is incorrect, since Test2 does not have matching parameters with Test1. You will receive an error message if you do this. Notice that I say matching NUMBER of parameters, you really don't need matching TYPE parameters. Don't do this though, results may vary.

11.3 Using function pointers properly
It will be clear (once you've used function pointers for a while) that there are times when using function pointers is necessary, and times when they're not. I think every situation is different, but consider this situation:
     SELECT CASE I
       CASE 1
         Process1("1", 44)
       CASE 2
         Process2("2", 55)
       CASE 3
         Process3("3", 66)
       CASE 4
         :
         :
      etc...
You can generalize this situation, for example, a menu with several options, or perhaps a parser (yes Rapid-Q does use function pointers to parse your code). As you may notice, that's a lot of comparisons, especially if you're writing a parser where there's so many keywords (over 50 say). We can easily eliminate these comparisons by using function pointers, consequently speeding up your program. See FUNCPTR.BAS for a concrete example.
     BIND FPtr(1) AS Process1
     BIND FPtr(2) AS Process2
     BIND FPtr(3) AS Process3
     BIND FPtr(4) AS Process4
     BIND FPtr(5) AS Process5
     BIND FPtr(6) AS Process6
     BIND FPtr(7) AS Process7

     x = VAL(INPUT$(1))
     CALLFUNC(FPtr(x), 33)
None of the code you see above is executable as is, but I think you get the general idea. We don't need any case statements as you can see (this is assuming you've partitioned your function pointers properly).

11.4 What is not supported in Rapid-Q
Function pointers as arguments is not supported. As funny as that sounds, this is actually very useful. Unfortunately I didn't get a chance to implement this (yet). You can pass the function pointer value as an argument, but as you can see, you won't be able to call your function. The only way would be to define a global function pointer as your template, and then assign that to your argument. It's easier to see with an example:
     DECLARE FUNCTION MyFuncTemp (X AS LONG) AS LONG
     DECLARE FUNCTION Func1 (X AS LONG) AS LONG
     DECLARE FUNCTION Func2 (X AS LONG) AS LONG

     DIM Template AS INTEGER
     DIM I(100) AS INTEGER

     BIND Template TO MyFuncTemp
     BIND I(1) TO Func1
     BIND I(2) TO Func2

     SUB Test (FPtr AS INTEGER)
        Template = FPtr
        PRINT CALLFUNC(Template, 10)
     END SUB

     Test I(1)
That's about the only way you can work around this limitation.


Chapter 12: Graphics under Windows

Rapid-Q Documentation by William Yu (c)1999 Chapter 12

12. Graphics under Windows

Most of the information contained in this chapter will not apply to the Linux/Unix version, except for the first few sections. If you're a DOS programmer converting your skills to Windows, there are some differences in the way you display graphics, mostly introduced by the concept of events and the multi-tasking nature of Windows.

12.1 Graphics under DOS versus Windows
If you're familiar with DOS programming and not so familiar with Windows programming, you'll probably notice some major differences in the nature of Graphics programming under the two OSes. Under DOS it's much simpler since you don't have to worry about other "programs" interrupting your program. This means what you display/draw on the screen won't erase itself magically, you only worry about what to draw next. However, there is a slight difference under Windows. Although it's perfectly safe to draw on your form, it has several consequences. The most obvious is that another program may "interrupt" the execution/display of your program. Think about minimizing the form or have it hidden under another window. How will Windows know what to redraw once your program gains refocus? You would think that Windows is smart enough to redraw the part that was hidden, but unfortunately we're not that lucky. Your program must tell Windows what to redraw. Windows will tell you that your form requires redrawing by sending messages to your form. In particular, the OnPaint (WM_PAINT) message is sent to the window which requires repainting. It is then your responsibility to provide an OnPaint procedure to your component/form that requires it.

12.2 What components require painting?
All visible components actually, but fortunately most of the work is done by Windows. For example, there's no need to provide an OnPaint method for the QButton class since it's already implemented for you. You can of course write your own Button class as you may have learned in Chapter 10, in which case you'll be writing the OnPaint method for the user. The QForm and QCanvas components are the two most obvious candidates to do graphics on. You can think of QCanvas as your basic DOS graphics screen, what you want drawn should be written inside the OnPaint procedure:
    DECLARE SUB CanvasPaint (Sender AS QCanvas)

    CREATE Form AS QForm
        CREATE Canvas AS QCanvas
            OnPaint = CanvasPaint
        END CREATE
        ShowModal
    END CREATE

    SUB CanvasPaint (Sender AS QCanvas)
        Sender.FillRect(10,10,100,100,&HFF0000)      '-- Blue box
    END SUB
If you try hiding the form under another Window and then refocus the program, the blue box will still appear. Now try writing something that doesn't utilize the OnPaint procedure:
    CREATE Form AS QForm
        CREATE Canvas AS QCanvas
            FillRect(10,10,100,100,&HFF0000)      '-- Blue box
        END CREATE
        Form.ShowModal
    END CREATE
Notice anything? Exactly, there is no blue box. The paint message was sent when your form first appears on your desktop, and since you didn't write any OnPaint procedure, there's nothing to draw. So what really happens to that FillRect code? Nothing really, it's still executed, but the next paint message offset it. To understand this better, try this code which will display the blue box when your press the button, but try hiding the window again or minimizing it. Redisplay your window and see what happens:
    DECLARE SUB ButtonClick

    CREATE Form AS QForm
        CREATE Button AS QButton
          OnClick = ButtonClick
        END CREATE
        CREATE Canvas AS QCanvas
        END CREATE
        ShowModal
    END CREATE

    SUB ButtonClick
        Canvas.FillRect(10,10,100,100,&HFF0000)
    END SUB
When you click your button the blue box will be drawn, however, once you hide part of the window and redisplay your window, you'll probably notice that your blue box has dissappeared.

12.3 Drawing graphics dynamically
As you may have already noticed, if all your graphics are contained in your OnPaint procedure, how do you draw on it dynamically without it erasing itself magically? For this purpose, you'll have to draw on an off-screen graphics bitmap and then in your OnPaint procedure, you just use the Draw method to display the graphic. You can use the QBITMAP component as your off-screen graphics page. Here's some sample code for you to test:

DECLARE SUB CanvasPaint (Sender AS QCanvas)
DECLARE SUB ButtonClick (Sender AS QButton)

' Create bitmap for off-screen use
DIM BitMap AS QBITMAP
    BitMap.Height = 100
    BitMap.Width = 100
    BitMap.Paint(0,0,0,0)

CREATE Form AS QForm
    Center
    Caption = "Simple graphics demonstration"
    CREATE Canvas AS QCanvas
        OnPaint = CanvasPaint
    END CREATE
    CREATE SquareButton AS QButton
        Caption = "Draw Square"
        OnClick = ButtonClick
        Left = 150
    END CREATE
    CREATE CircleButton AS QButton
        Caption = "Draw Circle"
        OnClick = ButtonClick
        Left = 150
        Top = 50
    END CREATE
    CREATE LineButton AS QButton
        Caption = "Draw Line"
        OnClick = ButtonClick
        Left = 150
        Top = 100
    END CREATE
    ShowModal
END CREATE

SUB CanvasPaint (Sender AS QCanvas)
    Sender.Draw(0,0,Bitmap.BMP)
END SUB

SUB ButtonClick (Sender AS QButton)
    SELECT CASE Sender.Caption
        CASE "Draw Square"
            Bitmap.FillRect(10,10,50,50,&HFF0000)
        CASE "Draw Circle"
            Bitmap.Circle(10,60,50,110,&H0000FF,&H0000FF)
        CASE "Draw Line"
            Bitmap.Line(50,50,90,90,&H00FF00)
    END SELECT
    Canvas.Repaint       '-- Tell Canvas to repaint itself.
END SUB
Sample Output:
Output

Code Details:
Much of the code is self explanatory. The first bit of code creates and initializes the Bitmap component. Since QBitmap is a non-visible component, it does not receive paint messages, so anything you draw on the Bitmap will stay. Now that we have our Bitmap ready, our OnPaint procedure for QCanvas can use the Draw method to paint the Bitmap onto the Canvas. This is what you call double buffering, a similar technique is utilized in DirectX.

12.4 Ownerdraw List and Combo Boxes (including QStringGrid)
Ownerdrawn ListBoxes and ComboBoxes allow you to override the default paint method somewhat. It doesn't really let you redraw the entire interface of a list or combo box, since that's probably not what you want anyway. What it does allow you to do is override the paint method for the data. So instead of just displaying the text fields in your list or combo boxes, you can actually draw pictures in them and/or change the font/color for each individual item. There are 2 types of ownerdraw list/combo boxes.
  • 1. OwnerDrawFixed
  • 2. OwnerDrawVariable
A fixed ownerdrawn list/combo box means that all your items will have a fixed predetermined height. So let's consider the case where one of your pictures is 100 pixels high and another which is only 10 pixels high. If you specify an ItemHeight of say 10, the 100 pixel high picture will actually overlap some of your items since it doesn't have enough room for itself (this can be avoided if you use CopyRect instead of Draw). But in any event, it would have been much better to create variable sized item fields, so you'd use OwnerDrawVariable instead. The only problem with OwnerDrawVariable list/combo boxes is that it requires the programmer to specify the height of each item, it doesn't automatically calculate this field for you. In most cases this isn't that big of a problem, but nonetheless you'll have to store this extra information for each field. How you do this is entirely up to you. To see a working example of ownerdrawn list/combo boxes, look at LISTBOX.BAS included in EXAMPLES.ZIP. You can rewrite the code to work with ComboBoxes. You may notice that you don't implement any OnPaint event, but an OnDrawItem event.

Code Details:
  SUB ListBoxDrawItem(Index AS INTEGER, State AS BYTE, Rect AS QRECT)
    IF State = 0 THEN
      '-- Selected
      ListBox.FillRect(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, &H00FF00)
    ELSE
      ListBox.FillRect(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, &HFFFFFF)
    END IF
    ListBox.TextOut(100, Rect.Top+(Rect.Bottom-Rect.Top)/4, ListBox.Item(index), 0, -1)
    ListBox.Draw(Rect.Left, Rect.Top, Bitmap(Index).BMP)
  END SUB
Hopefully the code is self explanatory, but a few things you may notice is that you don't paint the entire listbox (ie. all items), but rather a paint message is sent everytime an item is changed. This item occupies a rectangular region in your listbox, so what the OnDrawItem sends to you is the region of this item (this is the Rect parameter). You should not overstep this bound that has been given to you (ie. don't try to draw outside this region, it's not yours to draw on!). I have not covered QStringGrid in this section, but the same idea persists. You'll have to implement the OnDrawCell event, which is similar to the way you handle OnDrawItem in list/combo boxes.

12.5 Using DirectX
Why is DirectX so popular? This question can be summed up quite frankly without going into much detail. It's faster than Windows GDI (and OpenGL in most cases), it supports most graphics cards, it's free to use, and it provides a lot of the most necessary graphics commands that programmers are looking for without implementing it themselves. Not to mention that it's widely supported and (to some people) easy to use. As you may note, this is not my general opinion about DirectX, but the general public opinion.
Does everyone have DirectX installed? In most cases, yes, it depends what version though. Not everyone will have the latest version, but that usually doesn't matter. DirectX for Rapid-Q only requires v5.0 and may even work for version v3.0 and up (untested). Rapid-Q does not yet support all the features of DirectX, like joystick or 3D programming.
To use DirectX under Rapid-Q, you'll have to know 2 things.
  • 1. All drawing is done on the off-screen page
  • 2. You need to FLIP to this page everytime you want it displayed
In essence, you can think of this off-screen page as already implemented for you (like in the above example where we had to use QBitmap as our off-screen page). You can think of the FLIP operation as a repaint operation just like in the above example. After you understand these 2 concepts, everything else is basically the same. You draw on the DirectX Screen like you would a QCanvas or QBitmap, then FLIP pages when you're ready to display your graphics. It is easier to look at some examples rather than for me to explain it. There is however, one more important topic, that is QDXTimer.
QDXTimer is a specialized timer specifically for DirectX, it provides slightly better precision than QTimer, and controls the frame rate so that your program doesn't run too fast. It may decrease your frame rate if your program is running too fast, but can't do much if your program is chugging along at 5 or 6 frames per second. Please use QDXTimer instead of the standard Windows timer QTimer when animating graphics in DirectX (not necessary but recommended).


Chapter 13: Direct3D for Rapid-Q

Rapid-Q Documentation by William Yu (c)1999 Chapter 13

13. Direct3D for Rapid-Q

This is only an introduction to using Direct3D with Rapid-Q. Since most of the Direct3D components have not yet been finalized under Rapid-Q, this chapter will deal mostly with what can be done.

13.1 Requirement specifications
The most basic requirement is that you have the DirectX 6.0 runtimes. If you're unsure what version you have, type DXDIAG at the command prompt, or find the file under C:\WINDOWS\SYSTEM. If you don't have DXDIAG then you'll definitely need to upgrade. You can download the runtime files at http://msdn.microsoft.com/directx/
Just the runtime files, you don't need the SDK, but if you want, no one is stopping you from downloading it. The SDK does contain an important file CONV3DS.EXE which is necessary to convert different 3D models for use with your programs. However, I have posted a link to this file so it's not necessary for you download the entire SDK just for that one file.

    Other nice things to have:
  • 3D accelerated video card
  • A 3D modeler (like 3D Studio)
  • OpenGL (some 3D modelers use this)
Even if you don't have any of the above, this shouldn't matter. A 3D card is not necessary, but you'll find that running your programs can be 5 to 10 times slower, but still manageable if you have a good Pentium. I don't have a 3D card, and only get about 5-10 fps on my P200, but it doesn't bother me. If you don't have a 3D modeling program don't worry, there's some free 3D modelers on the internet. I find that Anim8or is pretty good, for something that's completely free there's nothing to complain about. It's only a 500KB download, which is very small compared to other 3D modeling programs I've seen. It does require OpenGL, but check your C:\WINDOWS\SYSTEM directory for OPENGL32.DLL. If you have it, you're in good shape, if not, just download it off the web at http://www.opengl.org/
    Nice links to have:
  • Anim8or homepage good 3D modeler
  • DOGA Homepage another good free 3D modeler
  • CONV3DS.EXE converts .3DS files to .X files
  • 3DCafe.com thousands of free 3D models available
  • Microsoft's DirectX homepage learn more, download their SDK documentation

13.2 Using Anim8or to create 3D models
If you already have a good understanding of how to create 3D models, you can skip this section. I will be using Anim8or to demonstrate simple 3D modeling which you can quickly use in your Rapid-Q programs. If you haven't already downloaded Anim8or's HTML documentation, I suggest you do that. I won't cover all there is to know about Anim8or, just the basics.

    Step by step introduction
  • Load Anim8or
  • Click on a polygon object
  • To draw this object, just click and drag your mouse on the main grid
  • Make sure to also center the object (not necessary but a good thing anyway). To do this, just select the object you want centered, then select from the menu: Edit|Locate|Center about origin
  • Make sure you haven't drawn an overly big polygon, perhaps the size of your pinky is good enough.
  • Now to export your object, select from the menu: Object|Export Just make sure to save as a .3DS file.
  • Let's just say you named your file poly.3ds then from the command prompt type in:
       CONV3DS -m poly.3ds
    I assumed you downloaded CONV3DS.EXE (copy this to your Windows directory if you want).
  • Once converted, you should have a poly.x file, this object file can now be used in your Rapid-Q program!
If you don't like doing your own 3D models you can always download pre-made 3D models from www.3dcafe.com and other websites like it. However, it's always nice to customize your objects, so learning to use a 3D modeling program wouldn't hurt. The optional parameter -m is used to create a single mesh for use with MeshBuilder. Without -m, your .X file is saved as a frame so you would have to use QD3DFrame to load your .X file.

13.3 Loading/Using .X Files
Simply loading an .X file is easy enough, to make sure you have this much working, copy and paste this code:
' Simply places an object on the scene

$TYPECHECK ON

CONST alClient = 5

'-- Light Types
CONST D3DRMLIGHT_AMBIENT = 0
CONST D3DRMLIGHT_POINT = 1
CONST D3DRMLIGHT_SPOT = 2
CONST D3DRMLIGHT_DIRECTIONAL = 3
CONST D3DRMLIGHT_PARALLELPOINT = 4

DECLARE SUB DXInitialize(Sender AS QDXScreen)
DECLARE SUB DXTimerExpired

DIM DXTimer AS QDXTimer
    DXTimer.Enabled = 1
    DXTimer.Interval = 0
    DXTimer.Activeonly = 0
    DXTimer.OnTimer = DXTimerExpired

CREATE Form AS QForm
    Caption = "Direct 3D Example"
    Center
    CREATE DXScreen AS QDXScreen
        Init(320,240)
        Align = alClient
        Use3D = 1
        UseHardware = 0        '' This is for non-3D accelerated video cards.
                               '' 3D will be emulated using software, which
                               '' is much slower.
        OnInitialize = DXInitialize
    END CREATE
    ShowModal
END CREATE

SUB DXInitialize(Sender AS QDXScreen)
   DIM Light AS QD3DLight
   DIM LightFrame AS QD3DFrame, MeshFrame AS QD3DFrame
   DIM MeshBuilder AS QD3DMeshBuilder

   DXScreen.CreateFrame(LightFrame)
   DXScreen.CreateFrame(MeshFrame)

   '-- Need light, else object would be completely hidden
   DXScreen.CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, 0.9, 0.9, 0.9, Light)
   LightFrame.AddLight(Light)

   DXScreen.SetCameraPosition(-5, 10, 0)
   DXScreen.SetCameraOrientation(0.35, -0.65, 1.0, -0.15, 1.0, 0.5)

   MeshFrame.SetPosition(0, 0, 15)
   MeshFrame.SetOrientation(0, 0, 1, 0, 1, 0)
   MeshFrame.SetRotation(0, 0, 0, 0.05)     '-- Angle of rotation = 0.05

   DXScreen.CreateMeshBuilder(MeshBuilder)  '-- Create object

   MeshBuilder.Load("poly.x")               '-- Load your object
   MeshFrame.AddVisual(MeshBuilder)         '-- Add object to frame
END SUB

SUB DXTimerExpired
   DXScreen.ForceUpdate(0,0,50,50)   '-- Updates FPS Text
   DXScreen.Render
   DXScreen.TextOut(10,10,"FPS: "+STR$(DXTimer.FrameRate), &HFFFFFF, -1)
   DXScreen.Flip
END SUB
If everything worked, you should obtain some output that looks like this:
If you understood the example, it's quite easy to add more objects to the scene, just create another MeshFrame and load another object file. Play around with the code until you're satisfied.

13.4 Wrapping textures around an object
Now that we have the basics, time to wrap textures around our object. To do this, all we need is a .BMP file for our texture. There's a few important points to note, First, width and height of bitmap must be equal, and secondly, they must be powers of 2 (ie. 32x32, 256x256, etc.). This is obviously for optimization reasons, but don't ask me, I didn't create Direct3D. Anyway, to wrap this texture around our object, we just need to modify the above code a bit (changes are noted in Blue):
' Wrap textures around 3D object

$TYPECHECK ON

CONST alClient = 5

'-- Light Types
CONST D3DRMLIGHT_AMBIENT = 0
CONST D3DRMLIGHT_POINT = 1
CONST D3DRMLIGHT_SPOT = 2
CONST D3DRMLIGHT_DIRECTIONAL = 3
CONST D3DRMLIGHT_PARALLELPOINT = 4

'-- Wrap Types
CONST D3DRMWRAP_FLAT = 0
CONST D3DRMWRAP_CYLINDER = 1
CONST D3DRMWRAP_SPHERE = 2
CONST D3DRMWRAP_CHROME = 3
CONST D3DRMWRAP_SHEET = 4
CONST D3DRMWRAP_BOX = 5

CONST WrapType = D3DRMWRAP_SPHERE     '-- You can modify this

DECLARE SUB DXInitialize(Sender AS QDXScreen)
DECLARE SUB DXTimerExpired

DIM DXTimer AS QDXTimer
    DXTimer.Enabled = 1
    DXTimer.Interval = 0
    DXTimer.Activeonly = 0
    DXTimer.OnTimer = DXTimerExpired

CREATE Form AS QForm
    Caption = "Direct 3D Example"
    Center
    CREATE DXScreen AS QDXScreen
        Init(320,240)
        Align = alClient
        Use3D = 1
        UseHardware = 0        '' This is for non-3D accelerated video cards.
                               '' 3D will be emulated using software, which
                               '' is much slower.
        OnInitialize = DXInitialize
    END CREATE
    ShowModal
END CREATE

SUB DXInitialize(Sender AS QDXScreen)
   DIM Light AS QD3DLight
   DIM LightFrame AS QD3DFrame, MeshFrame AS QD3DFrame
   DIM MeshBuilder AS QD3DMeshBuilder
   DIM Texture AS QD3DTexture
   DIM Wrap AS QD3DWrap
   DIM Mesh AS QD3DMesh

   DXScreen.CreateFrame(LightFrame)
   DXScreen.CreateFrame(MeshFrame)

   DXScreen.CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, 0.9, 0.9, 0.9, Light)
   LightFrame.AddLight(Light)

   DXScreen.SetCameraPosition(-5, 10, 0)
   DXScreen.SetCameraOrientation(0.35, -0.65, 1.0, -0.15, 1.0, 0.5)

   MeshFrame.SetPosition(0, 0, 15)
   MeshFrame.SetOrientation(0, 0, 1, 0, 1, 0)
   MeshFrame.SetRotation(0, 0, 0, 0.05)       ' Angle of rotation = 0.05

   DXScreen.CreateMeshBuilder(MeshBuilder)

   MeshBuilder.Load("poly.x")            '-- Egg object

   MeshBuilder.LoadTexture("back.bmp")   '-- New lines
   MeshBuilder.CreateMesh(Mesh)

   MeshFrame.AddVisual(Mesh)

   DXScreen.CreateWrap(WrapType, 0,0,0, 0,0,1, 0,1,0, 0,0, 1,1, Wrap)
   Wrap.Apply(Mesh)

END SUB

SUB DXTimerExpired
   DXScreen.ForceUpdate(0,0,50,50)
   DXScreen.Render
   DXScreen.TextOut(10,10,"FPS: "+STR$(DXTimer.FrameRate), &HFFFFFF, -1)
   DXScreen.Flip
END SUB
Again, if everything worked, you should obtain some output that looks like this (depending on what texture file you used of course):

As you can see, it doesn't take much to add textures to our objects. The only problem is you lose a few frame rates by doing this.

13.5 Rotating/Moving objects
Unfortunately as of this writing, there is no support for Animation sets, but that will be worked on later. You can do simple rotations and scene movements just by calling the method Move or manually setting the camera angles and positions. Using the example from above, add this extra code:

   DXScreen.ForceUpdate(0,0,50,50)
   DXScreen.Move(1)            '-- Add this line
   DXScreen.Render
This moves the camera position by the amount specified. The affect is a rotation about angle Theta. This Theta was specified on the line:
   MeshFrame.SetRotation(0, 0, 0, 0.05)       ' Angle of rotation = 0.05
DXScreen.Move animates the entire scene, to just animate a certain frame, you can use MeshFrame.Move(1).


Chapter 14: Programming in MySQL

Rapid-Q Documentation by William Yu (c)1999 Chapter 14

14. Programming in MySQL

This chapter is a quick overview of what you can do with the QMYSQL component. It does not teach you about SQL or how to construct proper queries. It is assumed you have some prior knowledge of SQL, but not necessarily with MySQL.

14.1 Quick Introduction
MySQL is basically free for Unix and OS/2 platforms, but Rapid-Q only supports MySQL for Linux and Windows since my resources are limited to such machines. Under Windows, if you like MySQL, then you are required to pay a license fee after a 30 day trial period. Not to be confused with paying me of course, but if you want, I'll oblige. Why did I choose MySQL over other database servers? The reason is fairly simple, yet deserves some explanation anyway. MySQL is free, mostly, and it's multiplatform, which fits into Rapid-Q quite nicely. It's also easier for me to test, and quite simple to implement under Rapid-Q. It's fairly lightweight, fast, robust, and did I mention free? Perhaps in the future, other database servers will be supported, ie. through MyODBC or Window's ODBC.
    Required files:
  • MySQL server version 3.22.xx or better
  • Rapid-Q MySQL Libraries
  • MySQL Client if you don't want to run a server
After installing the MySQL server, test it to make sure it works (read their nice documentation and help files), you'll also need to copy LIBMYSQL.DLL (under Windows) and libmysqlclient.* (under Linux) to your library path directory. C:\WINDOWS\SYSTEM under Windows, and maybe /usr/lib under Linux (you can also just add a library path to the file instead of moving it). These library files are required by Rapid-Q, they should have come with your MySQL distribution, probably in C:\MYSQL\LIB and /usr/local/lib/mysql depending on your installation. If you already have MySQL installed, which is possible, make sure it's up to date, or if you have an SQL Administrator, check with the that person.

14.2 Connecting to MySQL
The introduction assumed that you wanted to install a MySQL server on your machine, but you can access a MySQL database from anywhere, as long as you have access of course. If you don't want to install a MySQL server (why wouldn't you?) then make sure you have the proper client libraries, ie. LIBMYSQL.DLL. To begin with, I'll assume you have the MySQL server installed. To connect to your local MySQL server is simple enough:
            DIM MySQL AS QMYSQL

            Host$ = ""
            User$ = ""
            Password$ = ""
            MySQL.Connect(Host$, User$, Password$)

            IF MySQL.Connected THEN PRINT "Successfully connected"
Change User$ and Password$ to suit your needs. Host$ can also take the value of "localhost" but is not necessary in this case. Now to connect to a remote MySQL server located, say, in allsql.com
            DIM MySQL AS QMYSQL

            Host$ = "allsql.com"
            User$ = "anonymous"
            Password$ = "guest"
            MySQL.Connect(Host$, User$, Password$)

            IF MySQL.Connected THEN PRINT "Successfully connected"
Most servers will use the standard MySQL port 3306, but if you know the exact port, then you can use the method RealConnect.
            DIM MySQL AS QMYSQL

            Host$ = "allsql.com"
            User$ = "anonymous"
            Password$ = "guest"
            Port% = 12345
            MySQL.RealConnect(Host$, User$, Password$, "", Port%, "", 0)

            IF MySQL.Connected THEN PRINT "Successfully connected"
See appendix section for the parameters of QMYSQL.RealConnect. It is suggested by the MySQL documentation that you use RealConnect instead of the using Connect.

14.3 How to perform queries and obtain the results
Write your queries like you would normally, for example, if you want to select everything from a certain table, say you have a table named user, then you can do this:
            DIM MySQL AS QMYSQL

            '' First connect to server

            '' Use database
            MySQL.SelectDB("mysql")

            '' Perform query
            MySQL.Query("select * from user")
The result of this query is stored internally, and sequentially. To obtain the result, you'll need to Fetch it. You can visualize a 2 dimensional table:
Since the result is stored sequentially, you have to fetch each row one at a time (not necessarily true, but assume we have no other choice). To do this is quite simple:
            WHILE MySQL.FetchRow       '' Get next row
                MySQL.FieldSeek(0)     '' Reset field position
                FOR I = 0 TO MySQL.FieldCount-1
                    PRINT MySQL.Row(I) '' Read current row element I
                NEXT
            WEND
MySQL.FetchRow fetches the next row. As long as there are still rows available to fetch, MySQL.FetchRow returns TRUE (non-zero number). MySQL.FieldCount is used to count how many fields per row there are in the current table. The rest is self explanatory.

14.4 Interfacing QMYSQL with QSTRINGGRID
As you may notice, it would be nice if the results could just be preloaded into a string grid instead of having to fetch everything and doing it manually. Unfortunately I haven't got any motivation to do this right now, but you can use this simple code until I get off my butt and implement it internally:
            SUB ExecuteQuery(MySQL AS QMYSQL, Grid AS QSTRINGGRID, Query AS STRING)
                IF MySQL.Query(Query) = 0 THEN
                   '' Failed to execute
                   EXIT SUB
                END IF

                DEFINT I = 0, J

                ''-- Write header
                Grid.ColCount = MySQL.FieldCount
                WHILE MySQL.FetchField
                   Grid.Cell(I,0) = MySQL.Field.Name
                   I++
                WEND

                Grid.RowCount = MySQL.RowCount+1
                J = 1
                WHILE MySQL.FetchRow       '' Get next row
                   MySQL.FieldSeek(0)      '' Reset field position
                   FOR I = 0 TO MySQL.FieldCount-1
                      Grid.Cell(I,J) = MySQL.Row(I)
                   NEXT
                   J++
               WEND
            END SUB

            ''-- Example
            ExecuteQuery(MySQL, MyGrid, "select * from user")
Obviously, you can interface QMYSQL with any component, or components, you want.

14.5 Storing and retrieving blobs
Blobs are just binary data that require special processing. Since blobs can contain NULL characters and other special characters that affect MySQL and Rapid-Q, you'll need to do some special processing with your binary data. Please note that blob sizes vary, depending on the field type. A BLOB, by default can hold up to 65535 bytes (a LONGBLOB should be able to handle 2^32-1 bytes). If you want to change the buffer size, you'll have to read up on it (max_allowed_packet). To store binary data, like images, you'll have to preprocess certain characters before you can send it over to your MySQL database.
            $INCLUDE "RAPIDQ.INC"

            DIM MySQL AS QMYSQL

            ''-- Connect to database code, etc...

            DIM File AS QFILESTREAM
            File.Open("test.bmp", fmOpenRead)

            ''-- Read file as binary, preserves NULL chars
            Buffer$ = File.ReadBinStr(File.Size)

            ''-- Here's the special processing
            ''-- Converts NULLs to \0 and others
            ProcessedBuffer$ = MySQL.EscapeString(Buffer$, File.Size)

            ''-- Insert blob in our table
            MySQL.Query("insert into MyImageTable values('Label 1', '" + _
                        ProcessedBuffer$ + "')")

            File.Close
            MySQL.Close
Since we're dealing with binary data, you have to be aware that we don't use LEN() or any other STRING processing functions with our binary data. Note that we can store text data in blob fields, in which case you can use any STRING processing functions you want. You may notice that MySQL.EscapeString converts the binary data to a usable format that can be passed to the MySQL database. Basically all it does is convert NULLs to '\0', ' to \', " to \", and CRLF to \r and \n respectively. Once parsed, the new string is returned which you can use in a query. So far so good, now we consider retrieving our blobs:
            $INCLUDE "RAPIDQ.INC"
            $INCLUDE "MYSQL.INC"

            DIM MySQL AS QMYSQL

            ''-- Connect to database code, etc...

            DIM File AS QFILESTREAM
            File.Open("out.bmp", fmCreate) ''-- Create new file

            ''-- Your query here
            MySQL.Query("select * from MyImageTable")

            WHILE MySQL.FetchRow
                MySQL.FieldSeek(0)
                MySQL.FetchLengths ''-- Required for binary data
                FOR I = 0 TO MySQL.NumField-1
                    MySQL.FetchField
                    IF MySQL.Field.Type = FIELD_TYPE_BLOB THEN
                        ''-- Read binary data from table
                        Buffer$ = MySQL.RowBlob(I, MySQL.Length(I))
                        File.WriteBinStr(Buffer$, MySQL.Length(I))
                    ELSE
                        Buffer$ = MySQL.Row(I)
                    END IF
                NEXT
            WEND

            File.Close
            MySQL.Close
Retrieving blobs from the database is a little more confusing than storing blobs. The first thing you have to note is that reading binary data and text strings are 2 different operations. Since text strings are NULL terminated, you don't have to worry about how many bytes to read, this is automatically calculated for you. However, since binary data can contain NULL characters, this makes reading blobs a little bit tricky. You have to fetch the lengths of each field, since we have blobs in our table, this is done by calling MySQL.FetchLengths for each row. Then to find out the length of each field, you use the internal array MySQL.Length(index%) which returns the length for field index%. Why do we have to do this? Because we need to know the size of our blob before we can read it in. To read binary data from our database, you use the specialized function MySQL.RowBlob(Row%, Bytes%) which returns a binary string. With this binary string, you can write the data to a file or memory, or manipulate the data directly. In the above example, we're just writing the data to a file.

14.6 Using LOADBLOB and SAVEBLOB
In the previous section, we uncovered the natural way of storing and retrieving blobs (binary data). However, there is an easier and faster way of doing the samething.
            ''-- Recall the natural way
            ProcessedBuffer$ = MySQL.EscapeString(Buffer$, File.Size)
            MySQL.Query("insert into MyImageTable values('Label 1', '" + _
                        ProcessedBuffer$ + "')")

            ''-- Using LOADBLOB instead
            ProcessedBuffer$ = MySQL.LoadBlob("test.bmp")
            MySQL.Query("insert into MyImageTable values('Label 1', '" + _
                        ProcessedBuffer$ + "')")
Using LOADBLOB eliminates the use of MySQL.EscapeString since it is just implemented internally for you. It simply takes a single argument (the name of the file to include), and returns the processed string. To retrieve a blob from the database and save it to a file, you can try this:
            WHILE MySQL.FetchRow
                MySQL.FieldSeek(0)
                '' MySQL.FetchLengths
                FOR I = 0 TO MySQL.NumField-1
                    MySQL.FetchField
                    IF MySQL.Field.Type = FIELD_TYPE_BLOB THEN
                        ''-- Save data to file
                        MySQL.SaveBlob(I, "temp.bmp")
                    ELSE
                        Buffer$ = MySQL.Row(I)
                    END IF
                NEXT
            WEND
In this instance we can ignore using MySQL.FetchLengths since it is, again, implemented internally for you. MySQL.SaveBlob takes two arguments. The first is the index (or field number if you will), and the second argument is the name of the file to save to. There are no return values associated with this function.

14.7 In conclusion
Using MySQL can save you a lot of time and effort, since you don't need to design your own database file structure, and searching is quite fast. Not to mention that MySQL is multiplatform, so you can use MySQL with Windows and Linux. If you already have prior knowledge with programming in MySQL, you'll probably notice some differences. For example,
            I = MySQL.SelectDB("mysql")
Under Rapid-Q, this function returns 0 if database cannot be opened, and a non-zero number otherwise. However, if you've used LIBMYSQL.DLL before, this function (called mysql_select_db) returns 0 on success and -1 on failure. So basically, just reverse your way of thinking when using Rapid-Q.


Chapter 15: COM Programming

Rapid-Q Documentation by William Yu (c)1999 Chapter 15

15. COM Programming

Component Object Model (COM) and Distributed COM (or DCOM), is a specification that defines object creation and communication between objects. Rapid-Q only supports client-side COM programming (ie. you will not be able to create COM servers in Rapid-Q). Since work is still be being done, some of the information in this chapter may change in the future.

15.1 Supported COM extensions
COM has many extended services which have grown over time. Unfortunately Rapid-Q is limited to only a few:
  • COM clients (or Automation controllers) is implemented in QOLEOBJECT
  • Active Documents is implemented in QOLECONTAINER
Automation controllers can be used to drive automation servers such as MS WORD over a local machine or remotely. So what are the benefits of automating a server? Well, since the server can be invoked by another machine, this can free up resources and CPU cycles needed on your client system. Since you could automate an application from across a network (or the internet), you don't need the application to reside on your machine to do some useful work on it. Imagine automating machinery from your home. Active documents is similar to automation, however, the "document" (more like ActiveX control) is embedded into your application. Once embedded, you can use automation to control the behaviour of the document. Rapid-Q does not support Type Libraries, so vtable binding is not possible. Speaking of binding, a COM server is usually registered on your computer the first time it is run or installed. For .DLLs or .OCXs, this may not always be the case, so to register a COM server manually, you can use Window's regsvr32 program.
    regsvr32 myprog.dll
You can type that in your MS-DOS command line prompt, or via Start|Run. There are also programming examples to register a COM object, see the Windows API help file for more information.

15.2 About QOLEOBJECT
As mentioned in the previous section, QOLEOBJECT implements an automation controller. This component works similarly to VB (no, VB does not have a QOLEOBJECT component), except for a few things which are either implemented in another way or is not yet supported. Let's look at some examples comparing the 2 methods:

    ' Both examples invoke MS WORD
    ' in VB
    DIM Obj AS OBJECT

    Set Obj = CreateObject("Word.Basic")
    ' or just DIM Obj AS Word.Basic
    Obj.AppShow

    ' in Rapid-Q
    DIM Obj AS QOLEOBJECT

    Obj.CreateObject("Word.Basic")
    Obj.AppShow
Note that type checking is off for OBJECT and QOLEOBJECT, so when you invoke Obj.AppShow this calls the method AppShow in MS WORD. You may notice that Rapid-Q also supports the Invoke method. This is to eliminate ambiguity but also to provide a work around. So what if MS WORD has a method called CreateObject? In Rapid-Q this causes a problem since CreateObject is a valid method of QOLEOBJECT, so that method will be called, not the one in MS WORD. The work around is to use the Invoke method.
    ' in Rapid-Q
    DIM Obj AS QOLEOBJECT

    Obj.CreateObject("Word.Basic")
    Obj.Invoke("CreateObject") ' Call CreateObject method in MS WORD
Obviously you shouldn't run the above example, MS WORD doesn't have a CreateObject method, but you get the idea. Setting and getting properties can be done similarly:
    ' in Rapid-Q
    DIM Obj AS QOLEOBJECT

    Obj.CreateObject("Gif89.Gif89.1")
    Obj.AutoStart = 1
    Obj.Invoke("AutoStart") = 1 ' this also works
So what's not supported in Rapid-Q? Several data types and arrays are not supported yet, as well as events. Also there isn't a "set" method available. ie:
    ' in VB
    DIM ADOCommand AS ADODB.Command
    DIM ADOConnection AS ADODB.Connection

    set ADOCommand.ActiveConnection = ADOConnection
The line in red is not yet available in Rapid-Q. See the Appendix section on QOLEOBJECT, you will find a method called InvokeCopy which does the samething, but unfortunately isn't fully functional as of this writing.

15.3 About QOLECONTAINER
QOLECONTAINER is basically a container for embedding ActiveX components or Active documents. This component is very similar to QOLEOBJECT, it is again type check free, so you can automate the control like you would automating servers. You may find yourself using the Invoke method more often than not, since QOLECONTAINER does have a lot of properties and methods already defined. Another way to avoid this problem is the assign the Container method of QOLEOBJECT. This creates a reference to the object, and so you can use QOLEOBJECT to automate the control. For those that aren't familiar, ActiveX controls are reusable visual controls which are heavily used in VB. Again, the limitations are obvious, Rapid-Q doesn't support ActiveX events, type libraries, and a few others mentioned before.
    '-- A short example
    DIM Form AS QFORM
    DIM Obj AS QOLECONTAINER

    Obj.Parent = Form
    Obj.CreateObject("gif89.gif89.1")
Since an ActiveX control is a visible component, you'll note that the QOLECONTAINER requires a parent property. You'll also have to be wary of the fact that the ActiveX component could update/refresh the component even before the form is shown, so you'll receive a Can't focus a disabled or invisible window when that happens. QOLECONTAINER has an AutoShow property which can be set to False meaning that the ActiveX control should not be displayed when created. You can use the method Show of QOLECONTAINER to display the control at anytime after creating the object. There is also another way to avoid the error message from popping up, see the Appendix section on QOLECONTAINER for a complete example.


CLIPBOARD

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: CLIPBOARD

CLIPBOARD Component

This object is global, and need not be created.

ClipBoard Properties
Field | Type | R/W | Default
Format | ARRAY of WORD | RW
Format is a list of all the format the Clipboard contains. There are too may formats to fit on this page, not to mention all the custom formats you may have registered. Check your WinAPI help file for a list.
FormatCount | INTEGER | R
FormatCount contains the number of formats in the Format array.
Text | STRING | RW
Text specifies the current contents of the Clipboard as a string.

ClipBoard Methods
Method | Type | Description | Params
Clear | SUB | Clear clipboard | 0
Deletes contents of the Clipboard.
Close | SUB | Free clipboard for other processes | 0
Closes the Clipboard if it is open. The Clipboard can be opened multiple times, so the Clipboard will remain opened until it has been closed the same number of times it has been opened.
GetAsHandle | FUNCTION (Format AS WORD) AS LONG | Returns handle of specified format | 1
GetAsHandle returns the data from the Clipboard in a raw Windows handle for the specified format.
GetAsText | FUNCTION (length%) AS STRING | Returns text of length% | 1
GetAsText returns the text contents of the Clipboard. See also Text property.
HasFormat | FUNCTION (Format AS WORD) AS SHORT | Returns true or false if the format exists or not | 1
HasFormat indicates if the Clipboard object contains a particular format. Returns 0 if format is absent, non-zero otherwise if format is present.
Open | SUB | Begin critcal section | 0
Opens the Clipboard and prevents other applications from changing its contents until the Clipboard is closed.
SetAsHandle | SUB (Format AS WORD, Handle AS LONG) | Set handle and format | 2
SetAsHandle places the data in the given format as a Windows handle.
SetAsText | SUB (Text$) | Set text of clipboard | 1
SetAsText sets the text contents of the Clipboard. See also Text property.

ClipBoard Examples
ClipBoard.Open
PRINT ClipBoard.Text
ClipBoard.Close


PRINTER

Rapid-Q Documentation by William Yu (c)1999 Appendix A: PRINTER

PRINTER Component

This object is global, and need not be created. Please note that some printers do not support Draw or CopyRect. The printer component is mainly used for graphics, although it may also be suitable for text, please refer to LPRINT for text-only printing.

Printer Properties
Field | Type | R/W | Default
Aborted | INTEGER | R
Aborted determintes if the user aborted the print job.
Capabilities.Copies | INTEGER | R
Capabilities.Copies indicates whether the print is capable of printing multiple copies.
Capabilities.Orientation | INTEGER | R
Capabilities.Orientation indicates whether the print is capable of different orientations.
Capabilities.Collate | INTEGER | R
Capabilities.Collate indicates whether the print is capable of collating.
Copies | INTEGER | RW
Number of copies to print.
CopyMode | INTEGER | RW | cmBlackNess
Font | QFONT | W
Fonts | ARRAY of STRING | R
FontsCount | INTEGER | R
Handle | INTEGER | R
Orientation | INTEGER | RW
Orientation determines if the print job prints vertically or horizontally on a page.
Valid orientation values are:
0 = poPortrait (Vertical print)
1 = poLandscape (Horizontal print)
PageHeight | INTEGER | R
PageNumber | INTEGER | R
PageWidth | INTEGER | R
PrinterIndex | INTEGER | RW
Printers | ARRAY of STRING | R
PrintersCount | INTEGER | R
Printing | INTEGER | R
Title | STRING | RW
Title is the text that appears in the Print Manager and on network header pages.

Printer Methods
Method | Type | Description | Params
Abort | SUB | Abort printing the document | 0
BeginDoc | SUB | Starts new document to print | 0
BeginDoc sends a print job to the printer.
EndDoc | SUB | Nothing is printed until this is called | 0
EndDoc will start the print job.
NewPage | SUB | Start printing on a new page | 0
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap on Canvas | 3
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to printer | 5

Printer Examples
DECLARE SUB ButtonClick

SUB ComboBoxChange(Sender AS QComboBox)
  Printer.PrinterIndex = Sender.ItemIndex   '-- Change default printer
END SUB

DIM Font AS QFont
    Font.Color = &HFF0000
    Font.Name = "Arial"
    Font.Size = 20
DIM Bitmap AS QBitmap
Bitmap.BMP = "rapidq.bmp"

CREATE Form AS QForm
  CREATE ComboBox AS QComboBox
    Left = 5
    Top = 5
    Width = 150
    OnChange = ComboBoxChange
  END CREATE
  CREATE Button AS QButton
    Caption = "&Print"
    Top = 3
    Left = 180
    OnClick = ButtonClick
  END CREATE
  CREATE GroupBox AS QGroupBox
    Caption = "Print Preview..."
    Top = 35
    Width = Form.ClientWidth
  END CREATE
  Center
END CREATE

FOR I = 0 TO Printer.PrintersCount-1
  ComboBox.AddItems(Printer.Printers(I))    '-- Add printer list to combobox
NEXT
ComboBox.ItemIndex = Printer.PrinterIndex

Form.ShowModal

SUB ButtonClick
  Printer.Orientation = 1   ' Landscape
  Printer.BeginDoc
  Printer.TextOut(1000,1000,"Hi World!",0,-1)
  Printer.Font = Font
  Printer.TextOut(10,10,"Does this print?",0,-1)
  Printer.Line(10,10,500,500,0)
  Printer.EndDoc
END SUB


: QBITMAP

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QBITMAP

QBITMAP Component

QBitmap is a non-visible component, used to store/retrieve BMP images.

QBitmap Properties
Field | Type | R/W | Default | Support
BMP | STRING | RW | W
Use BMP to assign a new bitmap file, or to store BMP in the image cache.
Examples:
DIM Bitmap AS QBITMAP
Bitmap.BMP = "whatever.bmp"
BMPHandle | RESOURCE | W | W
CopyMode INTEGER RW cmBlackness

CONST cmBlackness = 0 ' Fill Destination rectange on the canvas with black
CONST cmDstInvert = 1
CONST cmMergeCopy = 2
CONST cmMergePaint = 3
CONST cmNotSrcCopy = 4
CONST cmNotSrcErase = 5
CONST cmPatCopy = 6
CONST cmPatInvert = 7
CONST cmPatPaint = 8
CONST cmSrcAnd = 9
CONST cmSrcCopy = 10 ' Copies source image to the canvas
CONST cmSrcErase = 11
CONST cmSrcInvert = 12
CONST cmSrcPaint = 13
CONST cmWhiteness = 14 ' Fill Destination rectange on the canvas with white

W
Empty | INTEGER | R | W
Font | QFONT | W | W
Handle | INTEGER | RW | W
Height | INTEGER | RW | WG
Monochrome | INTEGER | RW | W
Pixel | 2D ARRAY of INTEGER | RW | WG
PixelFormat INTEGER RW pfDevice
'-- QBITMAP Pixel Formats
CONST pfDevice = 0
CONST pf1bit = 1
CONST pf4bit = 2
CONST pf8bit = 3
CONST pf15bit = 4
CONST pf16bit = 5
CONST pf24bit = 6
CONST pf32bit = 7 		W
Top | INTEGER | RW | WG
Transparent | INTEGER | RW | False | W
TransparentColor | INTEGER | RW | W
TransparentMode INTEGER RW 0
'-- QBITMAP TransparentMode
CONST tmAuto = 0
CONST tmFixed = 1 		W
Width | INTEGER | RW | WG

QBitmap Methods
Method | Type | Description | Params | Support
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6 | WG
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W
Example (copies QIMAGE to bitmap at 10,10):
DIM Destination AS QRECT
DIM Source AS QRECT
DIM Image AS QIMAGE
DIM Bitmap AS QBITMAP
Image.BMP = "whatever.bmp"

WITH Destination
.Top = 10
.Left = 10
.Right = .Left+Image.Width
.Bottom = .Top+Image.Height
END WITH
WITH Source
.Top = 0
.Left = 0
.Right = Image.Width
.Bottom = Image.Height
END WITH
Bitmap.CopyRect(Destination, Image, Source)
Draw | SUB (x%, y%, BMP) | Draw Bitmap on Canvas | 3 | WG
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | WG
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5 | WG
LoadFromFile | SUB (FileName$) | Load BMP from a file | 1 | W
LoadFromStream | SUB (Stream) | Load BMP from a stream | 1 | W
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | WG
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | WG
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | WG
Rotate | SUB (xOrigin%, yOrigin%, Angle%) | Rotates entire bitmap at specified origin | 3 | W
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W
SaveToFile | SUB (FileName$) | Save BMP to a file | 1 | W
SaveToStream | SUB (Stream) | Save BMP to a stream | 1 | W
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5 | WG

QBitmap Examples
DIM BitMap AS QBitMap

BitMap.BMP = "close.bmp"

CREATE Form AS QForm
  CREATE Image1 AS QImage
    Left = 100
    Draw 5, 5, BitMap.BMP
  END CREATE
  Center
  ShowModal
END CREATE


QBUTTON

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QBUTTON

QBUTTON Component

QButton is a general purpose button control.

QButton Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
BMP | STRING | RW | W
Use BMP to assign a new bitmap file, or to use BMP in a draw statement.
Examples:
DIM button AS QBUTTON
button.BMP = "whatever.bmp"
Details:
You can hold multiple images on a single bitmap, but they must be of the same size and next to each other in a horizontal row.
The "first" bitmap appears when the button is up.
The "second" bitmap appears when the button disabled.
The "third" bitmap appears when the button is down (clicked).
You have to tell Rapid-Q how many images are in your bitmap by assigning the number to NumBMPs.
BMPHandle | RESOURCE | W | W
Assign a BMP resource handle to appear on the selected button.
Example:
$RESOURCE game_BMP AS "game.bmp"
DIM button AS QBUTTON
button.bmpHandle = game_BMP
Cancel | INTEGER | RW | False | W
If Cancel is True, the button's OnClick event handler executes when the user presses the Escape key.
Caption | STRING | RW | WXG
Caption specifies the text that appears on the button. To underline a character, include an ampersand (&) symbol before the character.
Color | INTEGER | RW | X
Cursor | INTEGER | RW | crDefault | W
Default | INTEGER | RW | False | W
If Default is True, the button's OnClick event handler executes when the user presses the Enter key.
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Handle | INTEGER | R | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Kind INTEGER
'-- Button Kind
CONST bkCustom = 0 '-- None
CONST bkOK = 1 '-- Check Bitmap
CONST bkCancel = 2 '-- X Bitmap
CONST bkHelp = 3 '-- ? Bitmap
CONST bkYes = 4
CONST bkNo = 5
CONST bkClose = 6
CONST bkAbort = 7
CONST bkRetry = 8
CONST bkIgnore = 9
CONST bkAll = 10 		RW bkCustom W
Layout | INTEGER | RW | blBMPLeft | W
Layout determines where the bitmap image appears on the button.
0 = blBMPLeft -- image appears at the left side of the caption
1 = blBMPRight -- image appears at the right side of the caption
2 = blBMPTop -- image appears above the caption
3 = blBMPBottom -- image appears below the caption
Left | INTEGER | RW | 0 | WXG
ModalResult | INTEGER | RW | mrNone | W
NumBMPs | INTEGER | RW | W
NumBMPs determines the number of images within the bitmap button.
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | WXG
Spacing | INTEGER | RW | 4 | W
Determines the separation, in pixels, between the image and the caption.
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Width | INTEGER | RW | WXG
Visible | INTEGER | RW | True | WXG

QButton Methods
Method | Type | Description | Params | Support
StartDrag | SUB | Allows Button to be dragged | 0 | W

QButton Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on the button | 0 | WXG
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2 | W
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | W
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WXG
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WXG
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WXG

QButton Examples
  '-- A drag button

  DIM Form AS QForm
  DIM Button AS QButton

  SUB MouseDown
      Button.StartDrag
      SHOWMESSAGE STR$(Button.Left)+", "+STR$(Button.Top)
  END SUB

  Button.Parent = Form
  Button.OnMouseDown = MouseDown

  Form.ShowModal
D>


QCANVAS

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QCANVAS

QCANVAS Component

QCanvas is an empty image for painting on. Instead of loading your images, you must draw them on the QCanvas.

QCanvas Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
ClientHeight | INTEGER | RW | W
ClientWidth | INTEGER | RW | W
Color | INTEGER | RW | WXG
CopyMode | INTEGER | RW | cmBlackness | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | W
Left | INTEGER | RW | 0 | WXG
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
Pixel | 2D ARRAY of INTEGER | RW | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Width | INTEGER | RW | WXG
Visible | INTEGER | RW | True | WXG

QCanvas Methods
Method | Type | Description | Params | Support
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6 | WXG
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W
Example (copies QIMAGE to canvas at 10,10):
DIM Destination AS QRECT
DIM Source AS QRECT
DIM Image AS QIMAGE
Image.BMP = "whatever.bmp"

SUB CanvasPaint (Sender AS QCANVAS)
WITH Destination
.Top = 10
.Left = 10
.Right = .Left+Image.Width
.Bottom = .Top+Image.Height
END WITH
WITH Source
.Top = 0
.Left = 0
.Right = Image.Width
.Bottom = Image.Height
END WITH
Sender.CopyRect(Destination, Image, Source)
END SUB

DIM Canvas AS QCANVAS
Canvas.OnPaint = CanvasPaint
Draw | SUB (x%, y%, BMP) | Draw Bitmap on Canvas | 3 | WG
Details:
BMP can be any BMP property from QBitmap, QImage, QImageList, etc. any component with a BMP property is fine.
Examples:
DIM Image1 AS QIMAGE
Image1.BMP = "whatever.bmp"
DIM Image2 AS QBITMAP
Image2.BMP = "whatever.bmp"

SUB CanvasPaint (Sender AS QCANVAS)
Sender.Draw(0, 0, Image1.BMP)
Sender.Draw(50, 50, Image2.BMP)
END SUB

DIM Canvas AS QCANVAS
Canvas.OnPaint = CanvasPaint
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | WXG
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5 | WXG
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | WXG
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | WXG
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | WXG
Repaint | SUB | Force repainting | 0 | W
Rotate | SUB (xOrigin%, yOrigin%, Angle%) | Rotates entire canvas at specified origin | 3 | W
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw image and stretch to fit inside Rect | 2 | W
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5 | WXG

QCanvas Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on canvas | 0 | WXG
OnDblClick | VOID | User double clicked on canvas | 0 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WXG
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WXG
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WXG
OnPaint | VOID | Receives WM_PAINT message | 0 | WXG

QCanvas Examples
'  Pixel by pixel credit scroller for Rapid-Q by William Yu

DIM Canvas AS QCanvas
DIM Form AS QForm
DIM Timer1 AS QTimer
DIM Font AS QFont
DIM Y AS INTEGER
    Y = -20

SUB Resize
  Canvas.Height = Form.ClientHeight
  Canvas.Width = Form.ClientWidth
END SUB

SUB Paint
  Canvas.Textout (65,Y-30,"Beware the power of Rapid-Q!", &H00FF00, 0)
  Canvas.Textout (30,Y,"Credit Scroller written in Rapid-Q by William Yu", &HFFFFFF, 0)
END SUB

SUB TimerOver
  Timer1.Interval = 1  '' Can't go any lower!
  Y = Y + 1            '' Pixel by pixel!
  Paint
END SUB

Form.Width = 400
Form.Height = 200
Form.Center
Form.Color = 0

Font.Name = "Arial"
Font.Size = 12
Font.Color = &H00FF00
Canvas.Parent = Form
Canvas.Font = Font
Canvas.Color = 0
Canvas.OnPaint = Paint

Timer1.Interval = 1
Timer1.OnTimer = TimerOver

Form.Onresize = Resize
Form.ShowModal
D>


QCOMBOBOX

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QCOMBOBOX

QCOMBOBOX Component

QCombobox implements a simple pull down listbox. The first item in any combobox is 0, the next is 1, and so on...

QCombobox Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
Color | INTEGER | RW | W
CopyMode | INTEGER | RW | cmBlackness | W
Cursor | INTEGER | RW | crDefault | W
DropDownCount | INTEGER | RW | 8 | W
DropDownCount is the maximum number of items displayed in the drop-down list.
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Item | ARRAY of STRING | RW | WXG
ItemCount | INTEGER | R | WXG
ItemHeight | INTEGER | RW | W
ItemIndex | INTEGER | RW | -1 | WXG
ItemIndex indicates which item in the drop-down list is selected. If no item is selected, then ItemIndex is -1.
Left | INTEGER | RW | 0 | WXG
MaxLength | INTEGER | RW | W
MaxLength is the maximum number of characters the user can type into the edit portion of the combobox.
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | WXG
Sorted | INTEGER | RW | False | WG
Style | INTEGER | RW | csDropDown | W
Style determines the display style of the combobox.
0 = csDropDown -- A drop-down list with an edit box for manually entered text.
1 = csSimple -- A drop-down list with an edit box and a fixed list (list box) underneath.
2 = csDropDownList -- A drop-down list with no edit box for manual entry.
3 = csOwnerDrawFixed -- Owner-draw drop-down list with an edit box. Each item in the list is the height specified by the ItemHeight property.
4 = csOwnerDrawVariable -- Owner-draw drop-down list with an edit box. Each item can have varying heights.
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Text | STRING | RW | W
Top | INTEGER | RW | 0 | WXG
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG

QCombobox Methods
Method | Type | Description | Params | Support
AddItems | SUBI | Add items to combobox | STRINGs, Infinite | WXG
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6 | W
Clear | SUB | Clears entire Combobox | 0 | WXG
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W
DelItems | SUBI | Delete items by their index | Index #s, Infinite | WXG
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3 | W
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | W
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2 | WXG
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5 | W
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | W
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | W
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | W
Repaint | SUB | Force repainting of combobox | 0 | W
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5 | W

QCombobox Events
Event | Type | Occurs when... | Params | Support
OnChange | VOID | User selects a different item | 0 | WXG
OnDrawItem | SUB (Index%, State%, R AS QRect) | Items are redrawn for ownerdraw comboboxes | 3 | W
OnMeasureItem | SUB (Index%, Height%) | Calculate Height for ownerdraw variable comboboxes | 3 | W

QCombobox Examples
  DIM Form AS QForm
  DIM ComboBox AS QComboBox

  SUB ItemChanged
    PRINT ComboBox.Item(ItemIndex)
  END SUB

  ComboBox.Parent = Form
  ComboBox.OnChange = ItemChanged
  ComboBox.AddItems "1. Apples", "2. Oranges", "3. Bananas"

  Form.ShowModal
D>


QCHECKBOX

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QCHECKBOX

QCHECKBOX Component

QCheckbox is a wrapper for Window's check box control

QCheckbox Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Caption | STRING | RW | WXG
Checked | INTEGER | RW | False | WXG
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Left | INTEGER | RW | 0 | WXG
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | WXG
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG

QCheckbox Methods
Method Type Description Params Support

QCheckbox Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked check box | 0 | WXG

QCheckbox Examples
  DIM Form AS QForm
  DIM Checkbox as QCheckBox

  SUB Check
    IF CheckBox.Checked THEN
       SHOWMESSAGE "Checked!"
    END IF
  END SUB

  CheckBox.Parent = Form
  CheckBox.OnClick = Check

  Form.ShowModal
D>


QCOMPORT

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QCOMPORT

QCOMPORT Component

QComPort provides an easy to use interface to communicate with the com ports. This component was made possible by Dejan Crnila. This component is currently being tested for stability, more functionality is expected in the future. Make sure to download the optional comport libraries to use this component.

QComPort Properties
Field | Type | R/W | Default
BaudRate | INTEGER | RW | br110
Connected | INTEGER | R
DataBits | INTEGER | RW | 8
Handle | INTEGER | R
InQue | INTEGER | R
OutQue | INTEGER | R
Parity | INTEGER | RW | prNone
PendingIO | INTEGER | R
Port | INTEGER | RW | 1
ReadBufSize | INTEGER | RW | 1024
StopBits | INTEGER | RW | sbOneStopBit
WriteBufSize | INTEGER | RW | 1024

QComPort Methods
Method | Type | Description | Params
AbortAllIO | SUB | Aborts all asynchronous read/write operations | 0
Close | SUB | Closes communication port | 0
Open | SUB | Opens communication port | 0
PurgeIn | SUB | Clears input buffer and stops all input functions | 0
PurgeOut | SUB | Clears output buffer and stops all output functions | 0
Read | SUB Read(QFile/QMemoryStream, Count%, Wait%) | Reads stream data from com port, Count% < 32000 | 3
ReadString | FUNCTION ReadString$(Count%, Wait%) | Returns a string representation bytes read from comport | 2
WaitForLastIO | SUB | Blocks until last IO is completed | 0
Write | SUB Write(QFile/QMemoryStream, Count%, Wait%) | Writes stream to com port, Count% < 32000 | 3
WriteString | SUB WriteString(Str$, Wait%) | Writes string to communication port | 2

QComPort Events
Event | Type | Occurs when... | Params
OnBreak | VOID | A line break is detected, input and output is suspended until break is cleared | 0
OnClose | VOID | Com port is closed | 0
OnError | VOID | A line error occurs | 0
OnOpen | VOID | Com port is successfully opened | 0
OnRing | VOID | A ring signal is detected, used only with modems. | 0
OnRxChar | SUB (InQue AS INTEGER) | A character(s) arrives in the input buffer. | 1
OnTxEmpty | VOID | Output buffer is flushed | 0

QComPort Examples
$TYPECHECK ON

CONST sbOneStopBit = 0
CONST prNone = 0

DECLARE SUB CommRxChar (InQue AS INTEGER)
DECLARE SUB OpenClick
DECLARE SUB SendClick
DECLARE SUB FormClose

DIM Comm AS QComPort
    Comm.OnRxChar = CommRxChar
    Comm.DataBits = 8
    Comm.StopBits = sbOneStopBit
    Comm.Parity = prNone

CREATE Form AS QFORM
    Caption = "Form1"
    Width = 302
    Height = 240
    Center
    CREATE Label1 AS QLABEL
        Caption = "Com Port:"
        Left = 5
        Top = 9
        Width = 51
    END CREATE
    CREATE ComboBox1 AS QCOMBOBOX
        AddItems "COM1", _
                 "COM2", _
                 "COM3", _
                 "COM4"
        Left = 55
        Width = 65
        Top = 5
        ItemIndex = 0
    END CREATE
    CREATE ComboBox2 AS QCOMBOBOX
        AddItems "110", "300", "600", "1200", "2400", "4800", "9600", _
                 "14400", "19200", "38400", "56000", "57600", "115200"
        Left = 130
        Width = 70
        Top = 5
        ItemIndex = 0
    END CREATE
    CREATE OpenButton AS QBUTTON
        Caption = "&Open"
        Left = 210
        Top = 4
        OnClick = OpenClick
    END CREATE
    CREATE Edit1 AS QEDIT
        Text = ""
        Left = 12
        Top = 40
        Width = 186
    END CREATE
    CREATE SendButton AS QBUTTON
        Caption = "&Send"
        Left = 210
        Top = 38
        Enabled = 0
        OnClick = SendClick
    END CREATE
    CREATE RichEdit1 AS QRICHEDIT
        Left = 11
        Top = 73
        Width = 274
        Height = 132
        PlainText = 1
        ReadOnly = 1
        ScrollBars = 3
        WordWrap = 0
    END CREATE
    OnClose = FormClose
END CREATE

SUB OpenClick
    IF Comm.Connected THEN
       PRINT Comm.InQue
       EXIT SUB
    END IF
    Comm.Port = ComboBox1.ItemIndex + 1
    Comm.BaudRate = ComboBox2.ItemIndex
    Comm.Open
    IF Comm.Connected THEN
       SendButton.Enabled = 1
    ELSE
       ShowMessage("Cannot open port, try another")
    END IF
END SUB

SUB SendClick
    Comm.WriteString(Edit1.Text+CHR$(13)+CHR$(10), 1)
    Comm.WaitForLastIO
END SUB

SUB CommRxChar (InQue AS INTEGER)
    RichEdit1.AddStrings(Comm.ReadString(InQue, 1))
END SUB

SUB FormClose
    IF Comm.Connected THEN
       Comm.Close
    END IF
END SUB

Form.ShowModal
D>


QCOOLBTN

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QCOOLBTN

QCOOLBTN Component

QCoolbtn is an extension of QButton, but allows Flat buttons, and toggle buttons (via GroupIndex).

QCoolbtn Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
AllowAllUp | INTEGER | RW | False | W
AllowAllUp specifies whether all buttons in the group can be unselected at the same time.
BMP | STRING | W | WX
Use BMP to assign a new bitmap file, or to use BMP in a draw statement.
Examples:
DIM coolbutton AS QCOOLBTN
coolbutton.BMP = "whatever.bmp"
Details:
You can hold multiple images on a single bitmap, but they must be of the same size and next to each other in a horizontal row.
The "first" bitmap appears when the button is up.
The "second" bitmap appears when the button disabled.
The "third" bitmap appears when the button is clicked.
The "fourth" bitmap appears when the button stays down.
You have to tell Rapid-Q how many images are in your bitmap by assigning the number to NumBMPs.
BMPHandle | RESOURCE | W | W
Caption | STRING | RW | WXG
Cursor | INTEGER | RW | crDefault | W
Down | INTEGER | RW | False | WX
Down specifies whether the button is selected (down) or unselected (up).
Enabled | INTEGER | RW | True | WXG
Flat | INTEGER | RW | False | WX
Flat determines whether the button has a 3D border that provides a raised or lowered look.
Font | QFONT | W | W
GroupIndex | INTEGER | RW | 0 | W
GroupIndex allows buttons to work together as a group. If GroupIndex is 0, the button behaves independently of all other buttons.
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Layout | INTEGER | RW | blBMPLeft | W
Layout determines where the bitmap image appears on the button.
0 = blBMPLeft -- image appears at the left side of the caption
1 = blBMPRight -- image appears at the right side of the caption
2 = blBMPTop -- image appears above the caption
3 = blBMPBottom -- image appears below the caption
Left | INTEGER | RW | 0 | WXG
NumBMPs | INTEGER | RW | W
NumBMPs determines the number of images within the bitmap button.
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
ShowHint | INTEGER | RW | False | WXG
Spacing | INTEGER | RW | 4 | W
Determines the separation, in pixels, between the image and the caption.
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Width | INTEGER | RW | WXG
Visible | INTEGER | RW | True | WXG

QCoolbtn Methods
Method | Type | Description | Params | Params
StartDrag | SUB | Allows Button to be dragged | 0 | W

QCoolbtn Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on the button | 0 | WXG
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WX
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WX
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WX

QCoolbtn Examples
  '-- An example of toggle buttons (via GroupIndex)

  CONST False = 0: CONST True = 1

  DIM Form AS QForm
  DIM Cool1 AS QCoolbtn
  DIM Cool2 AS QCoolbtn

  Cool1.Parent = Form
  Cool1.GroupIndex = 1       '' Must be > 0
  Cool1.Down = True          '' Button initially down
  Cool2.Parent = Form
  Cool2.GroupIndex = 1       '' Same group as Cool1
  Cool2.Left = 40

  Form.ShowModal
D>


QDIRTREE

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QDIRTREE

QDIRTREE Component

QDirTree is a custom component used to provide users with a Windows Explorer like directory list. It eats up a lot of resources, so use with caution. You don't usually need more than one of these.

QDirTree Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Directory | STRING | RW | False
Enabled | INTEGER | RW | True
FastLoad | INTEGER | RW | False
Font | QFONT | W
Height | INTEGER | RW
HideSelection | INTEGER | RW | False
Hint | STRING | RW
InitialDir | STRING | RW
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ReadOnly | INTEGER | RW | False
ReadOnStart | INTEGER | RW | False
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QDirTree Methods
Method | Type | Description | Params
AddDirTypes | SUB | Add directory types | 0
AddDriveTypes | SUB | Add drive types | 0
DelDirTypes | SUB | Del directory types | 0
DelDirTypes | SUB | Del drive types | 0
FullCollapse | SUB | Collapse entire directory list | 0
FullExpand | SUB | Expand entire directory list (slow!) | 0
Reload | SUB | Re-read directories | 0

QDirTree Events
Event | Type | Occurs when... | Params
OnChange | VOID | Current directory changes | 0

QDirTree Examples
'' A Directory Tree like Windows Explorer.
'' QDIRTREE Component courtesy of Markus Stephany.
'' I took out removable drives because it doesn't work properly.
'' So you won't be able to view your floppy disk drives.  CD-ROM drives
'' are fine, as far as I know...

$TYPECHECK ON

DECLARE SUB ChangeDirectory

CREATE Form AS QForm
  Caption = "Directory Tree"
  Center
  CREATE DirTree AS QDirTree
    InitialDir = CURDIR$
    Width = Form.ClientWidth
    Height = Form.ClientHeight
    OnChange = ChangeDirectory
  END CREATE
  ShowModal
END CREATE

SUB ChangeDirectory
  ShowMessage DirTree.Directory
END SUB
D>


QEDIT

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QEDIT

QEDIT Component

QEdit is a single-line edit control. More or less used to take input from user.

QEdit Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
AutoSize | INTEGER | RW | True | W
AutoSize determines whether the edit control should adjust its size automatically to accomodate the height of the text.
BorderStyle | INTEGER | RW | bsSingle | W
CharCase | INTEGER | RW | ecNormal | W
CharCase determines the case of the text within the edit control.
0 = ecNormal -- The text of the edit box displays in mixed case.
1 = ecUpperCase -- The text of the edit box displays in uppercase.
2 = ecLowerCase -- The text of the edit box displays in lowercase.
Color | INTEGER | RW | W
EditText | STRING | RW | W
EditText is the value of the text for the edit control after it is formatted using InputMask
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Handle | INTEGER | R | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
InputMask | STRING | RW | W
InputMask is the mask that represents what text is valid for the edit control
IsMasked | INTEGER | R | False | W
IsMasked indicates whether a mask exists for the edit control.
Left | INTEGER | RW | 0 | WXG
MaxLength | INTEGER | RW | 0 | WXG
Modified | INTEGER | RW | W
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PasswordChar | STRING | RW | W
PasswordChar indicates the character, if any, to display in place of the actual characters typed in the control. An empty string indicates that text should be displayed normally.
PopupMenu | QPOPUPMENU | W | W
ReadOnly | INTEGER | RW | False | WXG
SelLength | INTEGER | RW | W
SelStart | INTEGER | RW | W
SelText | STRING | RW | W
ShowHint | INTEGER | RW | False | WXG
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Text | STRING | RW | WXG
Top | INTEGER | RW | 0 | WXG
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG

QEdit Events
Event | Type | Occurs when... | Params | Support
OnChange | VOID | Text changed | 0 | WXG
OnKeyDown | SUB (Key AS WORD, Shift AS INTEGER) | Key held down | 2 | W
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | W
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 | W
WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages sent to QEdit | 4 | W

QEdit Examples
  DIM Form AS QForm
  DIM Edit1 AS QEdit

  Edit1.Parent = Form

  Edit1.Text = "Hello"   '' Set as default text
  Form.ShowModal

'--------------------------------------------------------------

' Example on how to handle OnKeyDown event

SUB EditKeyDown (Key AS WORD, Shift AS INTEGER, Sender AS QEDIT)
    SELECT CASE Key
        CASE 27
            SHOWMESSAGE "Escape key pressed!"
        CASE 13
            SHOWMESSAGE "Enter key pressed!"
    END SELECT
END SUB

CREATE Form AS QFORM
    Center
    CREATE Edit AS QEDIT
        OnKeyDown = EditKeyDown
    END CREATE
    ShowModal
END CREATE
QEdit Input Masks
 !	If a ! character appears in the mask, optional characters are represented
        in the EditText as leading blanks. If a ! character is not present, optional
        characters are represented in the EditText as trailing blanks.
 >	If a > character appears in the mask, all characters that follow are in
        uppercase until the end of the mask or until a < character is encountered.
 <      If a < character appears in the mask, all characters that follow are in
        lowercase until the end of the mask or until a > character is encountered.

 <>     If these two characters appear together in a mask, no case checking is
        done and the data is formatted with the case the user uses to enter the data.
 \	The character that follows a \ character is a literal character. Use this
        character to use any of the mask special characters as a literal in the data.
 L	The L character requires an alphabetic character only in this position.
        For the US, this is A-Z, a-z.
 l	The l character permits only an alphabetic character in this position, but
        doesn't require it.

 A	The A character requires an alphanumeric character only in this position.
        For the US, this is A-Z, a-z, 0-9.
 a	The a character permits an alphanumeric character in this position, but
        doesn't require it.
 C	The C character requires an arbitrary character in this position.
 c	The c character permits an arbitrary character in this position, but
        doesn't require it.
 0	The 0 character requires a numeric character only in this position.
 9	The 9 character permits a numeric character in this position, but doesn't
        require it.

 #	The # character permits a numeric character or a plus or minus sign in
        this position, but doesn't require it.
 :	The : character is used to separate hours, minutes, and seconds in times.
        If the character that separates hours, minutes, and seconds is different
        in the regional settings of the Control Panel utility on your computer
        system, that character is used instead.
 /	The / character is used to separate months, days, and years in dates.
        If the character that separates months, days, and years is different
        in the regional settings of the Control Panel utility on your computer
        system, that character is used instead.

 ;	The ; character is used to separate the three fields of the mask.
 _	The _ character automatically inserts spaces into the text. When the
        user enters characters in the field, the cursor skips the _ character.


QFILELISTBOX

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QFILELISTBOX

QFILELISTBOX Component

Use QFileListBox when you want to maintain a listbox with all the files in a specific directory. It can also list directories as well.

QFileListBox Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Directory | STRING | RW
Directory is the directory that contains all the files listed in the file listbox.
Drive | STRING | RW
Enabled | INTEGER | RW | True
ExtendedSelect | INTEGER | RW | True
ExtendedSelect determines if the user can select a sequential range of items in the file listbox.
Filename | STRING | R
FileName is the name of the selected file in the listbox, including the pathname. Read Only!
Font | QFONT | W
Height | INTEGER | RW
Hint | STRING | RW
Item | ARRAY of STRING Filename without pathname | RW
ItemCount | INTEGER | R
ItemHeight | INTEGER | RW
ItemIndex | INTEGER | R
ItemIndex specifies the index of the selected item in the file listbox. If no item is selected, ItemIndex equals -1. Read Only!
Left | INTEGER | RW | 0
Mask STRING RW *.*
MultiSelect | INTEGER | RW | False
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
SelCount | INTEGER | R
Selected | ARRAY of INTEGER | RW
ShowHint | INTEGER | RW | False
ShowIcons | INTEGER | RW | False
ShowIcons determines whether images should appear next to the file names.
TabOrder | INTEGER | RW
Tag | INTEGER | RW
TopIndex | INTEGER | RW
TopIndex specifies the index number of the item that appears at the top of the file listbox.
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QFileListBox Methods
Method | Type | Description | Params
AddFileTypes | SUBI | Add certain file types to list box | INTEGER, Infinite
FileTypes determine which files are displayed in the file listbox according to their attributes.
0 = ftReadOnly -- Display files with read-only attribute.
1 = ftHidden -- Display files with hidden attribute.
2 = ftSystem -- Displays system files.
3 = ftVolumeID -- Displays volume name.
4 = ftDirectory -- Displays directories.
5 = ftArchive -- Display files with archive attribute.
6 = ftNormal -- Display files with no special attributes.
Example:
$INCLUDE "RAPIDQ.INC"
DIM FileListBox AS QFILELISTBOX
FileListBox.AddFileTypes(ftDirectory, ftHidden)
DelFileTypes | SUBI | Remove certain file types from list | INTEGER, Infinite
Update | SUB | Updates/refreshes file list | 0

QFileListBox Events
Event | Type | Occurs when... | Params
OnChange | VOID | Directory changes | 0
OnClick | VOID | File was clicked on | 0
OnDblClick | VOID | Selection was double clicked on | 0

QFileListBox Examples
'' Simple Application Launcher
'' How to use the File List Box as a Directory List Box in Rapid-Q by William Yu

$INCLUDE "RAPIDQ.INC"

DECLARE SUB ChangeDirectories
DECLARE SUB ExecuteApplication
DECLARE SUB ResizeForm

CREATE Form AS QForm
  Height = 300
  Width = 450
  CREATE DirList AS QFileListBox     '' Can double as a Directory list box
   ShowIcons = True
   Mask = "*.*"
   AddFileTypes(ftDirectory)          '' Add Directories
   DelFileTypes(ftNormal)             '' Remove files (see RAPIDQ.INC for values)
   OnDblClick = ChangeDirectories
   Height = Form.ClientHeight
   Width = 200
  END CREATE
  CREATE EXEList AS QFileListBox
   ShowIcons = True
   Mask = "*.EXE"
   OnDblClick = ExecuteApplication
   Left = 215
   Height = Form.ClientHeight
   Width = 225
  END CREATE
  Center
  Caption = DirList.Directory
  OnResize = ResizeForm
  ShowModal
END CREATE

SUB ChangeDirectories
  ChDir(DirList.Item(DirList.ItemIndex) - "[" - "]")
  DirList.Directory = CurDir$:  EXEList.Directory = CurDir$
  Form.Caption = CurDir$
END SUB

SUB ExecuteApplication
  RUN EXEList.FileName    ' Non-Blocking
'  SHELL EXEList.FileName  ' Blocks, until program terminates
                           ' Becareful running 16-bit applications
END SUB

SUB ResizeForm
  DirList.Height = Form.ClientHeight
  EXEList.Height = Form.ClientHeight
  EXEList.Width = Form.ClientWidth - 215
END SUB
ext Component


QFILESTREAM

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QFILESTREAM

QFILESTREAM Component

QFilestream is Rapid-Q's way of handling files. It's more elegant than the GET, and PUT method of traditional BASIC.

QFilestream Properties
Field | Type | R/W | Default | Support
EOF | INTEGER | R | WXG
EOF specifies whether the file pointer has reached the end of file.
Handle | INTEGER | R | W
LineCount | INTEGER | R | WXG
LineCount determines how many lines there are in the file. Note that LineCount ignores the CR character, and will only detect LF, so it treats CRLF as one line, but LFLF as 2 lines.
Position | INTEGER | RW | WXG
Position specifies the current position of the file pointer, any read/write operations will begin from here.
Size | INTEGER | R | WXG
Size determines the size of the file in bytes.

QFilestream Methods
Method | Type | Description | Params | Support
Close | SUB | Close the stream | 0 | WXG
CopyFrom SUB (Stream, Bytes%) Copy from another stream
Either QFileStream or QMemoryStream
If Bytes%=0 then the whole stream is copied 		2 W
Use CopyFrom to copy a QFILESTREAM or a QMEMORYSTREAM to the current filestream.
Details:
If Bytes% = 0 then the Stream is reset to position 0 and the whole stream is then copied.
Example:
$INCLUDE "RAPIDQ.INC"
DIM File1 AS QFILESTREAM
DIM File2 AS QFILESTREAM

File1.Open("test.txt", fmCreate)
File2.Open("oldtest.txt", fmOpenRead)
File1.CopyFrom(File2, 123) '-- Copy 123 bytes from File2
ExtractRes | SUB (Resource AS LONG) | Extract resource to filestream | 1 | WXG
Extracts a resource from your program to the filestream.
Details:
The parameter Resource is not the resource handle, but the absolute position of the resource within your file. This requires that you use the keyword Resource(n) to specify the resource number.
Example (dumping all resources):
$INCLUDE "RAPIDQ.INC"
$RESOURCE res_1 as "res.1"
$RESOURCE res_2 as "res.2"

DIM File1 AS QFILESTREAM

File1.Open("test.txt", fmCreate)

FOR I = 0 TO ResourceCount-1
    File1.ExtractRes(Resource(I))
NEXT
LoadArray | SUB (Array(), NumElements&) | Load data into array | 2 | WXG
Open SUB (FileName$, Method%) Open a file, Method% see RAPIDQ.INC '-- File Mode
CONST fmCreate = 65535
CONST fmOpenRead = 0
CONST fmOpenWrite = 1
CONST fmOpenReadWrite = 2
2 WXG
Read | SUB (variable) | Generic Read, determines the storage space and saves data in variable | 1 | WXG
Datasize is automatically determined, and the value is stored into the variable.
Example:
$INCLUDE "RAPIDQ.INC"
DIM File1 AS QFILESTREAM
DIM B AS BYTE, I AS INTEGER

File1.Open("test.txt", fmOpenRead)
File1.Read(B) '-- Read a byte
File1.Read(I) '-- Read an integer
ReadLine | FUNCTION () AS STRING | Reads an entire line, supports UNIX files | 0 | WXG
ReadNum FUNCTION (Num_Type) AS DOUBLE Returns number '-- ie. PRINT File.ReadNum(Num_SINGLE)

Num_Type can be next
CONST Num_BYTE = 1
CONST Num_SHORT = 2
CONST Num_WORD = 3
CONST Num_LONG = 4
CONST Num_DWORD = 5
CONST Num_SINGLE = 6
CONST Num_DOUBLE = 8

1 WXG
ReadBinStr | FUNCTION (n) AS STRING | Read n bytes, returns the binary string | 1 | WXG
ReadStr | FUNCTION (n) AS STRING | Read n bytes, returns the text string | 1 | WXG
ReadUDT | SUB (MyType) | Read and store data in a MyType structure | 1 | WXG
SaveArray | SUB (Array(), NumElements&) | Save array | 2 | WXG
Seek SUB (Position%, From%) Seek to Position%, From% see RAPIDQ.INC
'-- Offsets
CONST soFromBeginning = 0 '-- Seek (offset) from Beginning
CONST soFromCurrent = 1 '-- Seek (offset) from Current position
CONST soFromEnd = 2 '-- Seek (offset) from End
2 WXG
Write | SUB (variable) | Generic Write, determines the storage space and saves data to file | 1 | WXG
WriteLine | SUB (S AS STRING) | Writes string with CR+LF | 1 | WXG
WriteNum | SUB (number, bytes%) | Writes a number to file | 2 | WXG
WriteBinStr | SUB (string, bytes%) | Writes a binary string to file | 2 | WXG
WriteStr | SUB (string, bytes%) | Writes a text string to file (fast) | 2 | WXG
WriteUDT | SUB (MyType) | Write data stored in a MyType structure | 1 | WXG

QFileStream Examples
  $INCLUDE "RAPIDQ.INC"

  DIM File AS QFileStream

  File.Open("test.bas", fmOpenRead)
  S$ = File.ReadStr(File.Size)         '' Read entire file
  PRINT S$                             '' print it
  File.Close

'------------------------------------------------------
  $INCLUDE "RAPIDQ.INC"

  TYPE MyType
      Name AS STRING*30
      Phone AS STRING*8
      Age AS INTEGER
  END TYPE

  DIM Person AS MyType
      Person.Name = "Joe"
      Person.Phone = "555-5555"

  DIM File AS QFileStream
      File.Open("test", fmCreate)
      File.WriteUDT(Person)
>


QFONT

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QFONT

QFONT Component

QFont is a component used to specify the font, color, and size for your text. It's not meant to be used as a stand-alone component, it has no effect until you assign a QFONT component to a component that uses it.

QFont Properties
Field | Type | R/W | Default | Support
Charset | INTEGER | RW | DEFAULT_CHARSET | W
Color | INTEGER | RW | W
FontCount | INTEGER | R | W
FontName | ARRAY of STRING | R | W
Handle | INTEGER | RW | W
Name | STRING | RW | WX
Pitch | INTEGER | RW | fpDefault | W
Size | INTEGER | RW | WX

QFont Methods
Method | Type | Description | Params | Support
AddStyles | SUBI | Add styles [bold, italic, etc] | INTEGER, Infinite | W
DelStyles | SUBI | Delete styles [bold, italic, etc] | INTEGER, Infinite | W

QFont Examples
  $INCLUDE "RAPIDQ.INC"

  DIM Font AS QFONT
  DIM Label AS QLABEL

  Font.Name = "Arial"
  Font.AddStyles(fsBold, fsItalic)
  Label.Font = Font      '' Assign font values


QFONTDIALOG

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QFONTDIALOG

QFONTDIALOG Component

QFontDialog displays Window's font selection dialog

QFontDialog Properties
Field | Type | R/W | Default
Color | INTEGER | RW
FontCount | INTEGER | R
FontName | ARRAY of STRING | R
MaxFontSize | INTEGER | RW
MinFontSize | INTEGER | RW
Name | STRING | RW
Size | INTEGER | RW

QFontDialog Methods
Method | Type | Description | Params
AddStyles | SUBI | Add styles [bold, italic, etc] | INTEGER, Infinite
DelStyles | SUBI | Delete styles [bold, italic, etc] | INTEGER, Infinite
AddOptions | SUBI | Add options [fdLimitSize, fdNoSizeSel, etc.] | INTEGER, Infinite
DelOptions | SUBI | Delete options [fdNoStyleSel, fdScalableOnly, etc.] | INTEGER, Infinite
Execute | FUNCTION | Returns TRUE or FALSE | 0
GetFont | SUB GetFont(F AS QFONT) | Get font attributes | 1
SetFont | SUB SetFont(F AS QFONT) | Set font attributes | 1

QFontDialog Events
Event | Type | Occurs when... | Params
OnApply | VOID | User clicks on apply button | 0

QFontDialog Examples
  '-- Simple demo
  DIM FontDialog AS QFontDialog
  DIM Font AS QFont
      Font.Name = "Arial"

  FontDialog.GetFont(Font)
  IF FontDialog.Execute THEN
    ShowMessage "You selected "+FontDialog.Name
    FontDialog.SetFont(Font)
  END IF
D>


QFORM

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QFORM

QFORM Component

QForm is a standard application Window. You can put any visible control component on a QForm, such as QEdit, QLabel, QButton, etc...

W = Windows, X = Rapid-Q/XForms, G = Rapid-Q/GTK

QForm Properties
Field | Type | Read/Write | Default Value | Support
AutoScroll | INTEGER | RW | True | W
Specify whether scroll bars should appear automatically on the form if it is not large enough to display all of its controls
BorderStyle | INTEGER | RW | bsSizeable | WXG
BorderStyle specifies the appearance and behaviour of the form border.
0 = bsNone -- Not resizeable; no visible border line or caption bar
1 = bsSingle -- Not resizeable; single-line border
2 = bsSizeable -- Standard resizeable border
3 = bsDialog -- Not resizeable; standard dialog box border
4 = bsToolWindow -- Like bsSingle but with a smaller caption
5 = bsSizeToolWin -- Like bsSizeable but with a smaller caption
Caption | STRING | RW | WXG
Caption is the text that appears as the title of your form.
ClientHeight | INTEGER | RW | WXG
The height of the form's client area, ie. the usable area inside the form's border.
ClientWidth | INTEGER | RW | WXG
The width of the form's client area, ie. the usable area inside the form's border.
Color | INTEGER | RW | clBtnFace | W
Color of the form.
Cursor | INTEGER | RW | crDefault | W
Cursor that appears when the mouse pointer is over the form.
Font | QFONT | W | W
Sets font property. Used for TextOut method.
FormStyle | INTEGER | RW | fsNormal | W
Get or set the form's style. Only fsNormal is supported. (fsStayOnTop is also)
fsNormal = 0
fsMDIChild = 1
fsMDIForm = 2
fsStayOnTop = 3
Handle | INTEGER | R | W
Get the form's handle for WinAPI calls.
Height | INTEGER | RW | WXG
Get or set the form's vertical size (in pixels).
Hint | STRING | RW | W
The hint string that appears when the user moves the mouse pointer over the form. It is not displayed unless ShowHint is true.
IcoHandle | RESOURCE | W | W
Assign an icon resource handle to appear as the icon for your form.
Example:
$RESOURCE game_ICO AS "game.ico"
DIM Form AS QFORM
Form.IcoHandle = game_ICO
Icon | STRING | W | W
Assign an icon filename to appear as the icon for your form.
KeyPreview | INTEGER | RW | False | W
Specify whether keyboard events should occur on the form before they occur on the active control. Not all keys will be redirected.
Left | INTEGER | RW | 0 | WXG
Specifies the left edge of the form relative to the desktop screen.
ModalResult | INTEGER | W | W
Assigning a value to ModalResult will close the form when it is displayed modally.
0 = mrNone
1 = mrOk
2 = mrCancel
3 = mrAbort
4 = mrRetry
5 = mrIgnore
6 = mrYes
7 = mrNo
8 = mrAll
Parent | QFORM | W | W
Assigning a parent will remove the second form from the taskbar.
PopupMenu | QPOPUPMENU | W | W
Popupmenus are displayed when user right clicks on the form.
Example:
DIM PopupMenu AS QPOPUPMENU
DIM Form AS QFORM
Form.PopupMenu = PopupMenu
ShowHint | INTEGER | RW | False | W
If True then the hint popup message can be displayed.
Top | INTEGER | RW | 0 | WXG
Visible | INTEGER | RW | False | WXG
Specifies the visibility of the form.
Width | INTEGER | RW | 320 | WXG
WindowState | INTEGER | RW | wsNormal | W
Specifies how the form appears on the screen.
0 = wsNormal -- form appears neither maximized nor minimized
1 = wsMinimized -- form is minimized
2 = wsMaximized -- form is maximized

 QForm Methods
Method | Type | Description | Params | Support
AddBorderIcons | SUBI | Add Border Icons | INTEGER, Infinite | W
Valid border icons are:
0 = biSystemMenu -- The form icon
1 = biMinimize -- The minimize icon
2 = biMaximized -- The maximize icon
3 = biHelp -- The help icon
Example:
$INCLUDE "RAPIDQ.INC"
DIM Form AS QFORM
Form.AddBorderIcons(biHelp)
Center | SUB | Used to center a form | 0 | WXG
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle/Ellipse | 6 | W
Close | SUB | Close form | 0 | WXG
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W
Example (copies QIMAGE to form at 10,10):
DIM Destination AS QRECT
DIM Source AS QRECT
DIM Image AS QIMAGE
Image.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
WITH Destination
.Top = 10
.Left = 10
.Right = .Left+Image.Width
.Bottom = .Top+Image.Height
END WITH
WITH Source
.Top = 0
.Left = 0
.Right = Image.Width
.Bottom = Image.Height
END WITH
Sender.CopyRect(Destination, Image, Source)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
DelBorderIcons | SUBI | Remove Border Icons | INTEGER, Infinite | W
Valid border icons are:
0 = biSystemMenu -- The form icon
1 = biMinimize -- The minimize icon
2 = biMaximized -- The maximize icon
3 = biHelp -- The help icon
Example:
$INCLUDE "RAPIDQ.INC"
DIM Form AS QFORM
Form.DelBorderIcons(biMinimize)
Details:
Deleting icon may not necessarily remove it from the form's title bar, but the icon will be greyed out.
Draw | SUB (x%, y%, BMP) | Draw Bitmap on Canvas | 3 | W
Details:
BMP can be any BMP property from QBitmap, QImage, QImageList, etc. any component with a BMP property is fine.
Examples:
DIM Image1 AS QIMAGE
Image1.BMP = "whatever.bmp"
DIM Image2 AS QBITMAP
Image2.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
Sender.Draw(0, 0, Image1.BMP)
Sender.Draw(50, 50, Image2.BMP)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | W
HideTitleBar | SUB | Hides Caption | 0 | W
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draw line on form | 5 | W
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | W
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | W
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | W
Repaint | SUB | Repaints the entire form | 0 | W
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W
ShapeForm | SUB (Filename$|Resource, TransparentColor&) | Shapes form as outline of image | 2 | W
Details:
The first parameter can either be a filename to the BMP file, or a BMP resource file. The second parameter indicates which color is transparent.
Example 1:
DIM Form AS QFORM
Form.ShapeForm("image.bmp", &HFFFFFF)
Example 2:
$RESOURCE image_BMP AS "image.bmp"

DIM Form AS QFORM
Form.ShapeForm(image_BMP, &HFFFFFF)
Show | SUB | Used to show form when hidden | 0 | WX
ShowModal | FUNCTION AS SHORT | Display form and wait for result | 0 | WXG
ShowTitleBar | SUB | Displays Caption | 0 | W
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W
Details:
BMP can be any BMP property from QBitmap, QImage, QImageList, etc. any component with a BMP property is fine.
Examples (Double original size):
DIM Image1 AS QIMAGE
Image1.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
DIM R AS QRECT
R.Left = 0
R.Top = 0
R.Right = Image1.Width*2
R.Bottom = Image1.Height*2
Sender.StretchDraw(R Image1.BMP)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W
TextOut | SUB (x%, y%, s$, fc%, bc%) | Write text to form | 5 | W
Details:
fc% = foreground color
bc% = background color
For a transparent background, set bc% parameter to -1

QForm Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicks on open area of form | 0 | W
OnClose SUB (Action AS INTEGER) Form closes
-- Close Actions
CONST caNone = 0 '-- Don't close the form
CONST caHide = 1 '-- Just hide the form
CONST caFree = 2
CONST caClose = caFree '-- Close form
CONST caMinimize = 3 '-- Minimize instead of closing
1 W
OnHint | SUB (Hint AS STRING) | Hint is displayed | 1 | W
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2 | W
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | W
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | W
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | W
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | W
OnPaint | VOID | Form requires repainting | 0 | W
OnResize | VOID | Form is resized | 0 | W
OnShow | VOID | Form is displayed | 0 | W
WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages posted/sent to form | 4 | W
Only one WndProc per Form is allowed. So if you have multiple forms, only one may be able to receive messages at a time. (Future consideration to correct this)

QForm Examples
  DIM Form AS QForm
  DIM Button AS QBUTTON

  Button.Parent = Form     '' Add button to form container
  Form.Center
  Form.Caption = "Hello world!"

  IF Form.ShowModal THEN
    PRINT "Return result is TRUE"
  ELSE
    PRINT "Return result is FALSE"
  END IF

DECLARE SUB Form_Close(Action AS INTEGER)

CREATE Form AS QFORM
    Center
    OnClose = Form_Close
END CREATE

Form.ShowModal

SUB Form_Close
    IF MessageDlg("Do you wish to exit now?", 0, 1 OR 2, 0) = 7 THEN
        Action = 0
    END IF
END SUB

ent


QGAUGE

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QGAUGE

QGAUGE Component

QGauge is a sophisticated progress monitor. Used visually to give users the progress of an operation.

QGauge Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
BackColor | INTEGER | RW | clWhite
BackColor specifies the background color of the component.
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
ForeColor | INTEGER | RW
ForeColor specifies the color of the progress meter.
Height | INTEGER | RW
Hint | STRING | RW
Kind | INTEGER | RW | gkHorizontalBar
Left | INTEGER | RW
Max | INTEGER | RW | 100
Min | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
Position | INTEGER | RW | 0
ShowHint | INTEGER | RW | False
ShowText | INTEGER | RW | True
ShowText determines whether the progress text (as a percent) should be displayed.
Top | INTEGER | RW
Visible | INTEGER | RW | True
Width | INTEGER | RW

QGauge Examples
$INCLUDE "RAPIDQ.INC"

CREATE Form AS QForm
  Center
  CREATE Gauge AS QGauge
    Position = 20
    Kind = gkPie
  END CREATE
  ShowModal
END CREATE


QGLASSFRAME

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QGLASSFRAME

QGLASSFRAME Component

QGlassFrame is a 3rd party Rapid-Q component, that makes your form look transparent and shaded, made possible by Aleksey Xacker. No support is offered for this component, there are some special cases in using this component.

QGlassFrame Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
ClientHeight | INTEGER | RW
ClientWidth | INTEGER | RW
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Handle | INTEGER | RW
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW
Moveable | INTEGER | RW | True
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ShowHint | INTEGER | RW | False
Top | INTEGER | RW
Transparency | INTEGER | RW | 60
TransparentColor | INTEGER | RW | 0
Width | INTEGER | RW

QGlassFrame Methods
Method Type Description Params

QGlassFrame Examples
$INCLUDE "RAPIDQ.INC"

CREATE Form AS QForm
  Caption = "Transparent Form"
  Center
  CREATE GlassFrame AS QGlassFrame
      Align = alClient
  END CREATE
  ShowModal
END CREATE

'------- Weird transparency color error
$INCLUDE "RAPIDQ.INC"

CREATE Form AS QForm
  Caption = "Transparent Form"
  Center
  CREATE GlassFrame AS QGlassFrame
      Align = alClient
      TransparentColor = &HFF0000
  END CREATE
  Show
END CREATE

'-- I don't know what's wrong, but doing this seems to
'-- work better than using ShowModal when changing colors

DO
    DoEvents
LOOP UNTIL Form.Visible = 0


QGROUPBOX

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QGROUPBOX

QGROUPBOX Component

QGroupBox implements Window's group box.

QGroupBox Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Caption | STRING | RW
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Visible | INTEGER | RW | True
Width | INTEGER | RW

QGroupBox Methods
Method | Type | Description | Params
Repaint | SUB | Repaint groupbox, and anything inside it | 0

QGroupBox Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on groupbox | 0
OnDblClick | VOID | User double clicked on groupbox | 0
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4

QGroupBox Examples
CREATE Form AS QForm
  CREATE GroupBox AS QGroupBox
    Caption = " Group Box "
    Left = 100
    CREATE Button AS QButton
      Caption = "Button"
    END CREATE
  END CREATE
  Center
  ShowModal
END CREATE
D>


QHEADER

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QHEADER

QHEADER Component

QHeader is a set of column headers that the user can resize at runtime.

QHeader Internal Types
   TYPE SectionsType       '' ie. Header.Sections(0).Caption
     Alignment AS INTEGER  '' Default taLeftJustify
     AllowClick AS INTEGER '' True
     Caption AS STRING
     MaxWidth AS INTEGER   '' Default  10000
     MinWidth AS INTEGER   '' Default 0
     Style AS INTEGER      '' Default hsText
     Width AS INTEGER      '' Default 50
   END TYPE
QHeader Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
ClientHeight | INTEGER | RW
ClientWidth | INTEGER | RW
CopyMode | INTEGER | RW | cmBlackness
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | RW
Height | INTEGER | RW
Hint | STRING | RW
HotTrack | INTEGER | RW | False
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
Pixel | 2D ARRAY of INTEGER | RW
PopupMenu | QPOPUPMENU | W
Sections | ARRAY of SectionsType | RW
SectionsCount | INTEGER | R
ShowHint | INTEGER | RW | False
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QHeader Methods
Method | Type | Description | Params
AddSections | SUBI | Add new sections to header | STRING, Infinite
Clear | SUB | Clears all sections | 0
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
Repaint | SUB | Force repainting of header | 0
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5

QHeader Events
Event | Type | Occurs when... | Params
OnDrawSection | SUB (Index%, Pressed%, Rect AS QRECT) | A header section needs to be redisplayed. Header section's Style property must be hsOwnerDraw | 3
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4
OnResize | VOID | Size of header control changes | 0
OnSectionClick | SUB (Index%) | Header section Index% is clicked | 1
OnSectionResize | SUB (Index%) | Header section is resized | 1
OnSectionTrack | SUB (Index%, Width%, State%) | Header section is dragged | 3

QHeader Examples
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

DECLARE SUB DrawSection (Index AS INTEGER, Pressed AS INTEGER, Rect AS QRECT, Sender AS QHEADER)

DECLARE SUB SectionTrack (Index AS INTEGER, Width AS INTEGER, State AS INTEGER, Sender AS QHEADER)

CREATE Form AS QFORM
    Caption = "QHeader example"
    Center
    CREATE Header AS QHEADER

        AddSections "1", "2", "3"
        Sections(1).AllowClick = FALSE
        Sections(0).Style = hsOwnerDraw
        Sections(0).Width = 100
        Sections(1).Style = hsOwnerDraw
        Sections(2).Style = hsOwnerDraw
        OnDrawSection = DrawSection
        OnSectionTrack = SectionTrack
    END CREATE
    CREATE ListBox1 AS QLISTBOX
        Align = alLeft
        Width = 100
        AddItems "1. Rapid-Q", "2. Taxes"
    END CREATE
    CREATE StatusBar AS QSTATUSBAR
        SimplePanel = TRUE
        SimpleText = "Not moving"
    END CREATE
    ShowModal
END CREATE

SUB DrawSection (Index AS INTEGER, Pressed AS INTEGER, Rect AS QRECT, Sender AS QHEADER)

    Sender.TextOut(Rect.Left+5,Rect.Top+1, STR$(Index+1), &HFF0000, -1)
    SELECT CASE Index
        CASE 0
            Sender.FillRect(Rect.Left+20,Rect.Top+2,Rect.Right-20,Rect.Bottom-2, &H00FF00)
        CASE 1
            Sender.Circle(Rect.Left+20,Rect.Top+2,Rect.Right-20,Rect.Bottom-2, &HFF, &HFF)
        CASE 2
    END SELECT
END SUB

SUB SectionTrack (Index AS INTEGER, Width AS INTEGER, State AS INTEGER, Sender AS QHEADER)

    StatusBar.SimpleText = "Moving "+STR$(Width)
    SELECT CASE Index
        CASE 0
            ListBox1.Width = Width
    END SELECT
END SUB
D>


QIMAGE

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QIMAGE

QIMAGE Component

QImage is used to display a graphical image (BMP/ICON). It can also be used to draw primitive graphics.

QImage Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
Autosize | INTEGER | RW | False
AutoSize determines whether the image control resizes to accommodate the image it displays.
BMP | STRING | RW
Use BMP to assign a new bitmap file, or to store BMP in the image cache.
Examples:
DIM Image AS QIMAGE
Image.BMP = "whatever.bmp"
BMPHandle | RESOURCE | W
Center | INTEGER | RW | False
Center positions the image so that it is centered in the image control.
CopyMode | INTEGER | RW | cmBlackness
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | RW
Height | INTEGER | RW
Hint | STRING | RW
ICOHandle | RESOURCE | W
Icon | STRING | W
IncrementalDisplay | INTEGER | RW | False
IncrementalDisplay specifies whether partial renderings of the image are drawn periodically during slow operations or on large compressed images.
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
Pixel | 2D ARRAY of INTEGER | RW
PopupMenu | QPOPUPMENU | W
ShowHint | INTEGER | RW | False
Stretch | INTEGER | RW | False
Stretch resizes the image so that it exactly fits the bounds of the image control.
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Transparent | INTEGER | RW | False
Width | INTEGER | RW
Visible | INTEGER | RW | True

QImage Methods
Method | Type | Description | Params
Center | SUB | Centers image | 0
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
Repaint | SUB | Force repainting of image | 0
Rotate | SUB (xOrigin%, yOrigin%, Angle%) | Rotates entire image at specified origin | 3
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5

QImage Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on image | 0
OnDblClick | VOID | User double clicked on image | 0
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4

QImage Examples
  '-- How to use a resource file

  CONST False = 0
  CONST True = 1

  $RESOURCE RES_BMP1 AS "C:\WINDOWS\CLOUDS.BMP"

  DIM Form AS QForm
  DIM Image AS QImage

  Image.Parent = Form
  Image.Autosize = True
  Image.BMPHandle = RES_BMP1
  Form.ShowModal
D>


QIMAGELIST

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QIMAGELIST

QIMAGELIST Component

QImageList is an array of images, all of the same/fixed size.

QImageList Properties
Field | Type | R/W | Default
BkColor | INTEGER | RW | clNone
BkColor determines which background color to use when drawing an image. Setting BkColor to clNone specifies no background color, ie. the image is drawn transparently. Setting BkColor to clDefault specifies using the imagelists background color when drawing.
BlendColor | INTEGER | RW | clNone
BlendColor determines which foreground color to use when drawing an image. Setting BlendColor to clNone specifies no blend color, while setting BlendColor to clDefault specifies the system highlight color for the foreground.
Count | INTEGER | R
Count returns the number of images in the imagelist.
DrawingStyle | INTEGER | RW | dsNormal
DrawingStyle specifies the style to be used when the imagelist is drawing an image.
0 = dsFocused -- Draws the image blending 25% with the system highlight color. This only affects imagelists which contain masks.
1 = dsSelected -- Draws the image blending 50% with the system highlight color. This only affects imagelists which contain masks.
2 = dsNormal -- Draws the image using the color specified in the BkColor property. If the BkColor is clNone then the image is drawn transparently using the mask.
3 = dsTransparent -- Draws using the mask regardless of the BkColor setting.
GetBMP | ARRAY of IMAGES/BMP | R
GetBMP returns the image specified by their index.
Examples:
DIM ImageList AS QIMAGELIST
DIM Button AS QBUTTON

ImageList.AddBMPFile("whatever.bmp", 0)
Button.BMP = Imagelist.GetBMP(0)
GetICO | ARRAY of IMAGES/ICO | R
Handle | INTEGER | RW
Height | INTEGER | RW
ImageType | INTEGER | RW | itImage
ImageType determines whether the imagelist will use the image or the associated image mask when drawing.
Masked | INTEGER | RW | True
Masked specifies whether the imagelist contains transparent or non-transparent images.
Width | INTEGER | RW

QImageList Methods
Method | Type | Description | Params
AddBMPFile | SUB (FileName$, MaskColor%) | Add BMP file to Imagelist | 2
AddICOFile | SUB (FileName$) | Add Icon file to Imagelist | 1
AddBMPHandle | SUB (BMP_Resource, MaskColor%) | Add BMP to Imagelist | 2
AddICOHandle | SUB (ICO_Resource) | Add Icon to Imagelist | 1
Clear | SUB | Removes all images | 0
Delete | SUB (Index%) | Delete image at Index% | 1
Draw | SUB (QIMAGE/QBITMAP/QCANVAS/QDXSCREEN, X%, Y%, Index%) | Draw on canvas at (X,Y) with image index% in ImageList | 4
InsertBMPFile | SUB (Index%, Filename$, Mask%) | Insert BMP file at Index% | 3
InsertICOFile | SUB (Index%, Filename$) | Insert Icon file at Index% | 2
InsertBMPHandle | SUB (Index%, BMP_Resource, Mask%) | Insert BMP at Index% | 3
InsertICOHandle | SUB (Index%, ICO_Resource) | Insert Icon at Index% | 2

QImageList Examples
' Imagelist demo

$resource bmp_handle as "nolight.bmp"
$resource ico_handle as "close.ico"

DIM ImageList AS QImageList
DIM Form AS QForm
DIM Button AS QButton

ImageList.Width = 9
ImageList.Height = 17
ImageList.AddBMPHandle bmp_handle,0
'ImageList.AddBMPFile "nolight.bmp", 0
ImageList.AddICOHandle ico_handle
'ImageList.AddICOFile "close.ico"

Button.Parent = Form
Button.BMP = Imagelist.GetBMP(0)

Form.Icon = ImageList.GetICO(1)

Form.Showmodal


QLABEL

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QLABEL

QLABEL Component

QLabel is a non-windowed control used to display 2D, 3D, and/or rotated text on a form/container. Note that rotated labels only work with true type fonts.

QLabel Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
Alignment | INTEGER | RW | taLeftJustify | W
Alignment determines the horizontal placement of the text within the label.
0 = taLeftJustify -- The text appears lined up along the left edge of the label.
1 = taRightJustify -- The text appears lined up along the right edge of the label.
2 = taCenter -- The text is horizontally centered in the label.
Angle | INTEGER | RW | 0 | W
Angle determines how the label is rotated. Specify a degree from 0 to 360.
Autosize | INTEGER | RW | False | W
AutoSize determines whether the size of the label automatically resizes to accommodate the text.
Caption | STRING | RW | WXG
Color | INTEGER | RW | WX
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Handle | INTEGER | R | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
LabelStyle | INTEGER | RW | tsNone | W
LabelStyle determines whether the label is displayed as 3D or 2D.
0 = lsNone -- The text appears as normal 2d text.
1 = lsRaised -- The text appears as 3d.
2 = lsRecessed -- The text appears engraved.
Layout | INTEGER | RW | tlTop | W
Layout determines the vertical placement of the text within the label.
0 = tlTop -- The text appears at the top of the label.
1 = tlCenter -- The text is vertically centered in the label.
2 = tlBottom -- The text appears along the bottom of the label.
Left | INTEGER | RW | 0 | WXG
LowerColor | INTEGER | RW | clBtnShadow | W
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | WXG
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Transparent | INTEGER | RW | False | W
UpperColor | INTEGER | RW | clBtnHighlight | W
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG
Wordwrap | INTEGER | RW | False | W

QLabel Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicks on label | 0 | W
OnDblClick | VOID | User double clicked on label | 0 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 3 | W
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 2 | W
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 3 | W
WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages sent to QLabel | 4 | W

QLabel Examples
  DIM Form AS QForm
  DIM Label1 AS QLabel

  Label1.Parent = Form

  Label1.Text = "Hello"
  Form.ShowModal

'--------------------------------------------------------

  ' Note that rotated labels only work with true type
  ' fonts, such as Arial and Courier New.

  DIM Form AS QForm
  DIM Label1 AS QLabel
  DIM Font AS QFont

  Font.Name = "Arial"

  Label1.Parent = Form
  Label1.Font = Font
  Label1.Text = "Hello"
  Label1.Angle = 45
  Form.ShowModal


QLISTBOX

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QLISTBOX

QLISTBOX Component

QListbox implements a generic (veritcal scrolling) Windows listbox. The first item in any listbox is 0, the next is 1, and so on...

QListbox Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
BorderStyle | INTEGER | RW | bsSingle | W
Color | INTEGER | RW | WX
Columns | INTEGER | RW | 0 | W
Columns specifies the number of columns, in a multi-column listbox, that are visible without having to scroll.
CopyMode | INTEGER | RW | cmBlackness | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WXG
ExtendedSelect | INTEGER | RW | True | WX
ExtendedSelect determines if the user can select a sequential range of items in the listbox.
Font | QFONT | W | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Item | ARRAY of STRING | RW | WXG
Item contains the strings that appear in the listbox.
ItemCount | INTEGER | R | WXG
ItemHeight | INTEGER | RW | W
ItemIndex | INTEGER | RW | WXG
Left | INTEGER | RW | 0 | WXG
MultiSelect | INTEGER | RW | False | WX
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
SelCount | INTEGER | R | W
Selected | ARRAY of INTEGER | RW | WX
ShowHint | INTEGER | RW | False | WXG
Sorted | INTEGER | RW | False | WG
Sorted specifies whether the items in a listbox are arranged alphabetically.
Style | INTEGER | RW | lbStandard | W
Style determines whether the listbox is standard or owner-draw.
0 = lbStandard -- All items are strings, with each item the same height.
1 = lbOwnerDrawFixed -- Each item in the listbox is the height specified by the ItemHeight property.
2 = lbOwnerDrawVariable -- Items in the listbox can be of varying heights.
TabOrder | INTEGER | RW | W
TabWidth | INTEGER | RW | 0 | W
Tag | INTEGER | RW | WXG
Text | STRING | RW | W
Text defines the items in the listbox as CRLF terminated strings.
Top | INTEGER | RW | 0 | WXG
TopIndex | INTEGER | RW | W
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG

QListbox Methods
Method | Type | Description | Params | Support
AddItems | SUBI | Add items to listbox | STRINGs, Infinite | WXG
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6 | W
Clear | SUB | Clears entire listbox | 0 | WXG
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W
DelItems | SUBI | Delete items by their index | Index #s, Infinite | WXG
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3 | W
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | W
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2 | WXG
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5 | W
LoadFromFile | SUB (FileName AS STRING) | Load file to list | 1 | W
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | W
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | W
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | W
Repaint | SUB | Force repainting of listbox | 0 | W
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W
SaveToFile | SUB (FileName AS STRING) | Save list to file | 1 | W
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5 | W

QListbox Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicks on item | 0 | WXG
OnDblClick | VOID | User double clicks on an item | 0 | WXG
OnDrawItem | SUB (Index%, State%, R AS QRect) | Items are redrawn for ownerdraw listboxes | 3 | W
OnEnter | VOID | User presses enter to select item | 0 | W
OnMeasureItem | SUB (Index%, Height%) | Calculate Height for ownerdraw variable listboxes | 3 | W
WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages sent to Listbox | 4 | W

QListbox Examples
  DIM Form AS QForm
  DIM ListBox AS QListBox

  ListBox.Parent = Form
  ListBox.AddItems "1. Apples", "2. Oranges", "3. Bananas"
  ListBox.DelItems 1,2       '' Deletes Oranges and Bananas

  ListBox.Item(0) = "1. Strawberries"   '-- Change the first item

  Form.ShowModal
D>


QLISTVIEW

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QLISTVIEW

QLISTVIEW Component

QListView provides 3 different ways of displaying items on a form. Items can be displayed in columns with column headers and sub-items, or individually with large/small icons.

QListView Internal Types
   TYPE ItemType            '' ie. ListView.Item(0).Caption
     Caption AS STRING
     Checked AS INTEGER     '' If CheckBoxes is enabled and item is checked
     Handle AS INTEGER      '' Read-only
     ImageIndex AS INTEGER
     Index AS INTEGER       '' Read-only
     Selected AS INTEGER
     StateIndex AS INTEGER
   END TYPE

   TYPE ColumnType          '' ie. ListView.Column(0).Width
     Caption AS STRING
     Width AS INTEGER
   END TYPE
QListView Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
BorderStyle | INTEGER | RW | bsSingle
CheckBoxes | INTEGER | RW | False
CheckBoxes specifies whether checkboxes appear next to the items in the listview.
Color | INTEGER | RW
Column | ARRAY of ColumnType | RW
ColumnClick | INTEGER | RW | True
ColumnClick determines whether the column header behaves like a button.
ColumnsCount | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
GridLines | INTEGER | RW | False
GridLines determines whether lines are drawn separating items in the list.
Handle | INTEGER | R
Height | INTEGER | RW
HideSelection | INTEGER | RW | False
HideSelection determines whether the listview gives a visual indication of which item is selected when focus shifts to another control.
Hint | STRING | RW
HotTrack | INTEGER | RW | False
HotTrack specifies whether list items are highlighted when the mouse passes over them.
Item | ARRAY of ItemType | RW
ItemCount | INTEGER | RW
ItemIndex INTEGER
Index of selected Item 		RW
LargeImages | QIMAGELIST | W
Left | INTEGER | RW | 0
MultiSelect | INTEGER | RW | False
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ReadOnly | INTEGER | RW | False
RowSelect | INTEGER | RW | False
RowSelect determines whether an entire row in the listview can be selected.
SelCount | INTEGER | RW
Selected | ARRAY of INTEGER | RW
ShowColumnHeaders | INTEGER | RW | True
ShowHint | INTEGER | RW | False
SmallImages | QIMAGELIST | W
SortType | INTEGER | RW | stNone
SortType determines if and how the items in the list are automatically sorted.
0 = stNone -- No sorting is done.
2 = stText -- Items are sorted according to their caption property.
StateImages | QIMAGELIST | W
SubItem | 2D ARRAY of STRING | RW
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
ViewStyle INTEGER
CONST vsIcon = 0 '-- View Style: Full sized icon, text on bottom
CONST vsSmallIcon = 1 '-- Small icons, text aligned to the right
CONST vsList = 2 '-- Same as above (nevermind this)
CONST vsReport = 3 '-- Each item appears on its own line with information
'-- arranged in columns
 RW vsIcon
Visible | INTEGER | RW | True

QListView Methods
Method | Type | Description | Params
AddColumns | SUBI | Add column headers to listview | STRING, Infinite
AddItems | SUBI | Add items to listview | STRING, Infinite
AddSubItem | SUB (Index%, String$) | Add sub item to Index% | 2
Clear | SUB | Clear all items in listview | 0
ClearColumns | SUB | Clear all columns in listview | 0
DelItems SUBI Delete items from listview by ItemIndex
example:
ListView.DelItems ListView.ItemIndex 		INTEGER, Infinite
DelSubItem | SUB (Index%, SubIndex%) | Delete subitem from listview | 2
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2
InsertSubItem | SUB (Index%, SubIndex%, String$) | Insert subitem | 3
SwapItem | SUB (Index1%, Index2%) | Swap items | 2

QListView Events
Event | Type | Occurs when... | Params
OnClick | VOID | Item was clicked on | 0
OnChange | SUB (Index%, Change AS BYTE) | Item changed (text, image, or state) | 2
OnColumnClick SUB (Column%) Column header was clicked
This sub is bugly! Always return 0 in Column%

See example2 to solve this problem

1
OnDblClick | VOID | Selection was double clicked on | 0
OnKeyPressed | SUB (Key AS BYTE) | Key was pressed | 1

QListView Examples
' Simple .ZIP viewer (doesn't extract or anything useful like that).
' You're free to modify and distribute the code without restrictions.
' Written in Rapid-Q by William Yu
' Demonstrates QOpenDialog, QFileStream, QListView, QMainMenu, QMenuItem
'              and QImageList.

$APPTYPE GUI
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

$RESOURCE ICO_ZIP AS "ZIP.ICO"
$RESOURCE ICO_APP AS "APP.ICO"

DECLARE SUB ZipView (ZIPFile AS STRING)
DECLARE SUB FormResize
DECLARE SUB OpenClick
DECLARE SUB ExitClick
DECLARE SUB IconClick
DECLARE SUB SmallIconClick
DECLARE SUB ReportClick
DECLARE SUB ItemDblClick

CONST SIG = &H04034B50         ' ZIP Signature/ID

TYPE ZFHeader
  Signature AS LONG
  Version AS WORD
  GPBFlag AS WORD              ' ?
  Compress AS WORD             ' Compression types
  DateTime AS LONG             ' Packed format
  CRC32 AS LONG
  CSize AS LONG                ' Compressed size
  USize AS LONG                ' Uncompressed size
  FileNameLen AS LONG
END TYPE

TYPE PackedDateType            ' I think this is it:
  Year AS SHORT                ' 7 bits
  Month AS BYTE                ' 4 bits
  Day AS BYTE                  ' 5 bits
  Hour AS BYTE                 ' 5 bits
  Minute AS BYTE               ' 6 bits
  Secs AS BYTE                 ' 5 bits
END TYPE                       ' Total = 32 bits

DIM CompType(0 TO 9) AS STRING
    CompType(0) = "Stored"
    CompType(1) = "Shrunk"
    CompType(2) = "Reduced1"
    CompType(3) = "Reduced2"
    CompType(4) = "Reduced3"
    CompType(5) = "Reduced4"
    CompType(6) = "Imploded"
    CompType(7) = "Defalted"
    CompType(8) = "DeflatN"      '' Could be DeflatX as well...
    CompType(9) = "DeflatX"

DIM OpenItem AS QMenuItem
    OpenItem.Caption = "&Open"
    OpenItem.OnClick = OpenClick
DIM BreakItem AS QMenuItem
    BreakItem.Caption = "-"
DIM ExitItem AS QMenuItem
    ExitItem.Caption = "E&xit"
    ExitItem.OnClick = ExitClick
DIM IconItem AS QMenuItem
    IconItem.Caption = "vs&Icon"
    IconItem.RadioItem = True
    IconItem.OnClick = IconClick
DIM SmallIconItem AS QMenuItem
    SmallIconItem.Caption = "vs&SmallIcon"
    SmallIconItem.RadioItem = True
    SmallIconItem.OnClick = SmallIconClick
DIM ReportItem AS QMenuItem
    ReportItem.Caption = "vs&Report"
    ReportItem.RadioItem = True
    ReportItem.Checked = True
    ReportItem.OnClick = ReportClick

DIM FileMenu AS QMenuItem
    FileMenu.Caption = "&File"
    FileMenu.AddItems OpenItem, BreakItem, ExitItem
DIM ViewMenu AS QMenuItem
    ViewMenu.Caption = "&View"
    ViewMenu.AddItems IconItem, SmallIconItem, ReportItem

DIM ImageList1 AS QImageList
    ImageList1.Height = 32
    ImageList1.Width = 32
    ImageList1.AddICOHandle ICO_APP
    ImageList1.AddICOHandle ICO_ZIP
DIM ImageList2 AS QImageList            ' Scale 16x16
    ImageList2.Height = 16
    ImageList2.Width = 16
    ImageList2.AddICOHandle ICO_APP
    ImageList2.AddICOHandle ICO_ZIP

CREATE Form AS QForm
  ICOHandle = ICO_ZIP
  Center
  OnResize = FormResize
  Height = 330
  Width = 525
  Caption = "Simple .ZIP Viewer for Rapid-Q"
  CREATE MainMenu AS QMainMenu
    AddItems FileMenu, ViewMenu
  END CREATE
  CREATE ListView AS QListView
    Width = Form.ClientWidth
    Height = Form.ClientHeight
    SmallImages = ImageList2
    LargeImages = ImageList1
    ViewStyle = vsReport
    AddColumns "FileName","Length","Method","Size","Rate","Date","Time","CRC-32"
    Column(0).Width = 200
    Column(4).Width = 40
    Column(5).Width = 70
    Column(7).Width = 70
    OnDblClick = ItemDblClick
  END CREATE
  ShowModal
END CREATE

'------------------------------------------------------------------

SUB ZipView (ZIPFile AS STRING)
  DIM Hdr      AS ZFHeader
  DIM ZF       AS QFileStream
  DIM PD       AS PackedDateType
  DIM FileName AS STRING
  DIM Index    AS INTEGER

  IF ZF.Open(ZIPFile, fmOpenRead) = False THEN
    ShowMessage("Problem with reading "+ZIPFile)
    EXIT SUB
  END IF

  ListView.Clear
  Hdr.Signature = ZF.ReadNum(4)

  Index = 0
  WHILE Hdr.Signature = SIG
    Hdr.Version  = ZF.ReadNum(2)
    Hdr.GPBFlag  = ZF.ReadNum(2)
    Hdr.Compress = ZF.ReadNum(2)
    Hdr.DateTime = ZF.ReadNum(4)
    Hdr.CRC32 = ZF.ReadNum(4)
    Hdr.CSize = ZF.ReadNum(4)
    Hdr.USize = ZF.ReadNum(4)
    Hdr.FileNameLen = ZF.ReadNum(4)

    FileName = ZF.ReadStr(Hdr.FileNameLen)

    PD.Year = ((Hdr.DateTime SHR 25) AND &H7F) + 1980
    PD.Month = (Hdr.DateTime SHR 21) AND &H0F
    PD.Day = (Hdr.DateTime SHR 16) AND &H1F
    PD.Hour = (Hdr.DateTime SHR 11) AND &H1F
    PD.Minute = (Hdr.DateTime SHR 5) AND &H3F
    PD.Secs = Hdr.DateTime AND &H1F
    ListView.AddItems FileName
    IF INSTR(UCASE$(FileName), ".ZIP") THEN
      ListView.Item(Index).ImageIndex = 1
    END IF
    ListView.AddSubItem Index, STR$(Hdr.USize)
    ListView.AddSubItem Index, CompType(Hdr.Compress)
    ListView.AddSubItem Index, STR$(Hdr.CSize)
    IF Hdr.USize = 0 THEN
      ListView.AddSubItem Index, "----"
    ELSE
      ListView.AddSubItem Index, STR$(INT((Hdr.USize - Hdr.CSize) / Hdr.USize * 100))+"%"
    END IF
    ListView.AddSubItem Index, STR$(PD.Month)+"-"+STR$(PD.Day)+"-"+STR$(PD.Year)
    ListView.AddSubItem Index, STR$(PD.Hour)+":"+STR$(PD.Minute)
    ListView.AddSubItem Index, LCASE$(HEX$(Hdr.CRC32))
    ZF.Seek(Hdr.CSize, soFromCurrent)
    Hdr.Signature = ZF.ReadNum(4)
    Index = Index + 1
  WEND

  IF Index = 0 THEN
     '-- Likely not a .ZIP file
     ShowMessage(ZIPFile+" is not a valid ZIP file!")
  END IF
END SUB

SUB OpenClick
  DIM OpenDialog AS QOpenDialog

  OpenDialog.InitialDir = CurDir$
  OpenDialog.Filter = "ZIP Files (*.zip)|*.zip|All Files (*.*)|*.*"

  IF OpenDialog.Execute THEN
    ZipView(OpenDialog.FileName)
  END IF
END SUB

SUB ExitClick
  Form.Close
END SUB

SUB FormResize
  ListView.Height = Form.ClientHeight
  ListView.Width = Form.ClientWidth
END SUB

SUB IconClick
  IconItem.Checked = True
  ListView.ViewStyle = vsIcon
END SUB

SUB SmallIconClick
  SmallIconItem.Checked = True
  ListView.ViewStyle = vsSmallIcon
END SUB

SUB ReportClick
  ReportItem.Checked = True
  ListView.ViewStyle = vsReport
END SUB

SUB ItemDblClick
  IF ListView.ItemIndex >= 0 THEN
    ShowMessage("Can't extract "+ListView.Item(ListView.ItemIndex).Caption);
  END IF
END SUB

Example2  (Oscar Fernandez)
$TYPECHECK ON
 $INCLUDE "RAPIDQ.INC"

 TYPE RECTA
 Left As Long
 Top As Long
 Right As Long
 Bottom As Long
 END TYPE

 CONST LVM_FIRST = &H1000
 Const LVM_GETHEADER = (LVM_FIRST + 31)

 Const HDM_FIRST = &H1200
 Const HDM_HITTEST = HDM_FIRST + 6

 Declare Function SendMessagea Lib "user32" Alias_
 "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long,_
 ByVal wParam As Integer, ByVal lParam As LONG) As Long

 Declare Function GetWindowRect Lib "user32" Alias_
 "GetWindowRect" (ByVal hwnd As Long, lpRect As RECTA)AS Long

 Declare Function GetParent Lib "user32"_
 Alias "GetParent" (ByVal hwnd As Long) As Long

 DECLARE SUB OK(COLUMN%, sender as qlistview)

 dim r as rectA
 dim rh as rectA

 dim IDcolumn as integer
 dim ccount as integer
 CREATE Form AS QForm
 Center
 Caption = "Sorting Listview Click in the Buttons Headers"
 Height = 330
 Width = 525

 CREATE ListView AS QListView
 ColumnClick = TRUE
 ALIGN=5
 Gridlines=1
 Width = Form.ClientWidth
 Height = Form.ClientHeight
 ViewStyle = vsReport
 AddColumns "Group","Lead Guitar","Rithms Guitar","Bass","Drums", "Others"
 Column(0).Width = 110
 Column(1).Width = 80
 Column(2).Width = 80
 Column(3).Width = 80
 Column(4).Width = 80
 Column(5).Width = 80

 AddItems "The Rolling Stones"
 AddSubItem 0, "Keith"
 AddSubItem 0, "Brian"
 AddSubItem 0, "Bill"
 AddSubItem 0, "Charlie"
 AddSubItem 0, "Mick"

 AddItems "The Beatles"
 AddSubItem 1, "George"
 AddSubItem 1, "John"
 AddSubItem 1, "Paul"
 AddSubItem 1, "Ringo"

 AddItems "Yes"
 AddSubItem 2, "Steve"
 AddSubItem 2, "Jon"
 AddSubItem 2, "Chris"
 AddSubItem 2, "Alan"
 AddSubItem 2, "Rick"

 AddItems "Nirvana"
 AddSubItem 3, "Kurt"
 AddSubItem 3, ""
 AddSubItem 3, "Kris"
 AddSubItem 3, "Dave"

 ONCOLUMNCLICK=OK
 END CREATE
 END CREATE

 Form.ShowModal

 SUB OK(COLUMN%, sender as qlistview)

with sender

defint i,cw,lvh,cc,hh,parw

 lvh=ListView.Handle
 hh=sendMESSAGEa(lvh, (LVM_GETHEADER),0,0)'get handler of header

 ccount=sendMESSAGEa (  hh, (HDM_FIRST + 0),0, 0) 'get number of columns
 parw=getparent(lvh)
 getWINDOWrect(hh,Rh) ' rect of  header !!'

 cc=0:cw=0

 for i=0 to ccount-1
 cw=.column(i).width
 cc=cw+cc
 if cc+Rh.left>screen.mousex then exit for
 next

 idcolumn=i

print "idcolumn=",idcolumn

end with
 END SUB
ent


QMAINMENU

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QMAINMENU

QMAINMENU Component

QMainmenu implements a container for your menu items. Use it to add a drop-down main menu to a form.

QMainMenu Properties
Field | Type | R/W | Default | Support
Handle | INTEGER | R | W
Parent | QFORM | W | WXG

QMainMenu Methods
Method | Type | Description | Params | Support
AddItems | SUBI | Add items to mainmenu | QMENUITEMs, Infinite | WXG
DelIndex | SUB (index AS LONG) | Delete items, by index, from menu | 1 | W
DelItems | SUBI | Delete items from menu | QMENUITEMs, Infinite | W
Insert | SUB (I%, Item AS QMENUITEM) | Insert an item | 2 | W

QMainMenu Examples
  DIM Form AS QForm
  DIM MainMenu AS QMainMenu
  DIM Item1 AS QMenuItem

  Item1.Caption = "&File"
  MainMenu.AddItems Item1
  MainMenu.Parent = Form

  Form.ShowModal


QMEMORYSTREAM

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QMEMORYSTREAM

QMEMORYSTREAM Component

QMemorystream is used to store temporary data to memory for manipulation.

QMemorystream Properties
Field | Type | R/W | Default | Support
LineCount | INTEGER | R | W
LineCount determines how many lines there are in the memorystream. Note that LineCount ignores the CR character, and will only detect LF, so it treats CRLF as one line, but LFLF as 2 lines.
Pointer | INTEGER | R | WXG
Pointer specifies the memory address of the memorystream.
Position | INTEGER | RW | WXG
Position specifies the current position of the memory pointer, any read/write operations will begin from here.
Size | INTEGER | RW | WXG
Size determines the number of bytes allocated to the memorystream.

QMemorystream Methods
Method | Type | Description | Params | Support
Close | SUB | Close the stream | 0 | WXG
CopyFrom SUB (Stream, Bytes%) Copy from another stream
Either QFileStream or QMemoryStream 		2 WXG
Use CopyFrom to copy a QFILESTREAM or a QMEMORYSTREAM to the current memorystream.
Details:
If Bytes% = 0 then the Stream is reset to position 0 and the whole stream is then copied.
Example:
$INCLUDE "RAPIDQ.INC"
DIM File1 AS QFILESTREAM
DIM Mem AS QMEMORYSTREAM

File1.Open("test.txt", fmOpenRead)
Mem.CopyFrom(File1, 123) '-- Copy 123 bytes from File1
ExtractRes | SUB (Resource AS LONG) | Extract resource to memorystream | 1 | WXG
Extracts a resource from your program to the memorystream.
Details:
The parameter Resource is not the resource handle, but the absolute position of the resource within your file. This requires that you use the keyword Resource(n) to specify the resource number.
Example (dumping all resources):
$INCLUDE "RAPIDQ.INC"
$RESOURCE res_1 as "res.1"
$RESOURCE res_2 as "res.2"

DIM Mem AS QMEMORYSTREAM

FOR I = 0 TO ResourceCount-1
    Mem.ExtractRes(Resource(I))
NEXT
LoadArray | SUB (Array(), NumElements&) | Load data into array | 2 | WXG
MemCopyFrom | SUB (Address&, Bytes&) | Copies contents of Address& to memorystream | 2 | WXG
MemCopyTo | SUB (Address&, Bytes&) | Copies contents to Address& | 2 | WXG
Read | SUB (variable) | Generic Read, determines the storage space and saves data in variable | 1 | WXG
ReadLine | FUNCTION () AS STRING | Reads an entire line | 0 | W
ReadNum FUNCTION (Num_Type) AS DOUBLE Returns number -- ie. PRINT File.ReadNum(Num_SINGLE)
Num_Type can be next
CONST Num_BYTE = 1
CONST Num_SHORT = 2
CONST Num_WORD = 3
CONST Num_LONG = 4
CONST Num_DWORD = 5
CONST Num_SINGLE = 6
CONST Num_DOUBLE = 8 		1 WXG
ReadStr | FUNCTION (n) AS STRING | Read n bytes, returns the string | 1 | WXG
ReadBinStr | FUNCTION (n) AS STRING | Read n bytes, returns the binary string | 1 | W
ReadUDT | SUB (MyType) | Read and store data in a MyType structure | 1 | WXG
SaveArray | SUB (Array(), NumElements&) | Save array | 2 | WXG
Seek | SUB (Position%, From%) | Seek to Position%, From% see RAPIDQ.INC | 2 | WXG
Write | SUB (variable) | Generic Write, determines the storage space and saves data to memory | 1 | WXG
WriteLine | SUB (S AS STRING) | Writes string with CR+LF | 1 | W
WriteNum | SUB (number, bytes%) | Writes a number to memory | 2 | WXG
WriteBinStr | SUB (string, bytes%) | Writes a binary string to file (slow) | 2 | W
WriteStr | SUB (string, bytes%) | Writes string to memory | 2 | WXG
WriteUDT | SUB (MyType) | Write data stored in a MyType structure | 1 | WXG

QMemoryStream Examples
  DIM Mem AS QMemoryStream

  S$ = "Hello world!"
  Mem.WriteStr(S$, LEN(S$))
  Mem.Position = 0
  S$ = Mem.ReadStr(LEN(S$))
  PRINT S$                            '' print it
  Mem.Close

'------------------------------------------------------

  DIM Mem AS QMemoryStream
  DIM I AS INTEGER

  I = 12
  Mem.Write(I)
  S$ = "Hello world!"
  Mem.Write(S$)
  Mem.Position = 0
  Mem.Read(I)
  S$ = SPACE$(I)
  Mem.Read(S$)
  PRINT S$                            '' print it
  Mem.Close

'------------------------------------------------------

  TYPE MyType
      Name AS STRING*30
      Phone AS STRING*8
      Age AS INTEGER
  END TYPE

  DIM Person AS MyType
      Person.Name = "Joe"
      Person.Phone = "555-5555"

  DIM Mem AS QMemoryStream
      Mem.WriteUDT(Person)
ODY> /HTML> ODY>


QMENUITEM

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QMENUITEM

QMENUITEM Component

QMenuItem is used to describe the properties of an item in a menu. It is not meant to be a stand-alone component. You usually add a QMenuItem to a QMainMenu or QPopupMenu.

QMenuItem Properties
Field | Type | R/W | Default | Support
Caption | STRING | RW | WXG
Caption specifies the text of the menu item.
Checked | INTEGER | RW | W
Checked specifies whether a check mark should appear beside the caption.
Command | INTEGER | R | W
Command is the Windows command ID associated with the menu item.
Count | INTEGER | R | W
Count is the number of subitems of the menu item.
Enabled | INTEGER | RW | True | W
Handle | INTEGER | R | W
Hint | STRING | RW | W
MenuIndex | INTEGER | RW | W
MenuIndex is index of the menu item within its parent menu.
RadioItem | INTEGER | RW | False | W
RadioItem specifies whether the menu item is mutually exclusive with other menu items in its group.
ShortCut | STRING | RW | W
ShortCut specifies the key combination users can type to quickly access the menu item.
Tag | INTEGER | RW | WXG
Visible | INTEGER | RW | True | W
Visible determines whether the menu item should be displayed.

QMenuItem Methods
Method | Type | Description | Params | Support
AddItems | SUBI | Add Subitems to MenuItem | QMENUITEMs, Infinite | WXG
DelIndex | SUB (index AS LONG) | Delete items, by index, from menu | 1 | W
DelItems | SUBI | Delete items from menu | QMENUITEMs, Infinite | W
Insert | SUB (I%, Item AS QMENUITEM) | Insert an item | 2 | W

QMenuItem Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User selects item | 0 | WXG

QMenuItem Examples
  DIM Form AS QForm
  DIM MainMenu AS QMainMenu
  DIM Item1 AS QMenuItem

  MainMenu.Parent = Form
  Item1.Caption = "&File"
  MainMenu.AddItems Item1

  Form.ShowModal
D>


QMYSQL

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QMYSQL

QMYSQL Component

QMySQL is used to access your local or remote MySQL server. More information on MySQL can be obtained at http://www.mysql.com/

QMySQL Properties
Field | Type | R/W | Default | Support
Connected | INTEGER | R | WXG
Connected specifies whether you are currently connected to a MySQL server. Use the Connect method to establish a connection.
DB | ARRAY of STRING | R | WXG
DB returns a database list that are currently available on the MySQL server.
DBCount | INTEGER | R | WXG
DBCount returns the number of databases that are currently available on the MySQL server.
ColCount | INTEGER | R | WXG
ColCount returns the number of columns in the table. ColCount is used after an SQL query to determine the number of columns in the resulting table.
FieldCount | INTEGER | R | WXG
FieldCount returns the number of columns in the table. FieldCount is used after an SQL query to determine the number of columns in the resulting table.
Field.Decimals | INTEGER | R | WXG
Field.Decimals returns the number of decimals in the field.
Field.Flags | INTEGER | R | WXG
Field.Flags returns the flag settings. Refer to MYSQL.INC for supported values.
Field.Length | INTEGER | R | WXG
Field.Length returns the width of the column.
Field.MaxLength | INTEGER | R | WXG
Field.MaxLength returns the maximum width of the selected set. A result set can have multiple fields (or columns), Field.MaxLength returns the largest of these.
Field.Name | STRING | R | WXG
Field.Name returns the name of the column.
Field.Table | STRING | R | WXG
Field.Type | INTEGER | R | WXG
Field.Type returns the type of field. Refer to MYSQL.INC for supported values.
Length | ARRAY of INTEGER | R | WXG
Length returns the length of each field. Make sure a call to FetchLengths is made.
Row | ARRAY of STRING | R | WXG
Row returns the value stored in the particular Row for the current result set. The value is also dependent on the Field (or column). For example, Row(3) returns the value stored in Row 3 and whatever Column, ie. 2. Which is different from Row(3) of Column 3 for example.
RowCount | INTEGER | R | WXG
Table | ARRAY of STRING | R | WXG
Table returns a list of tables for the current database.
TableCount | INTEGER | R | WXG

QMySQL Methods
Method | Type | Description | Params | Support
Close | SUB | Disconnect from MySQL | 0 | WXG
Connect | FUNCTION (Host$, User$, Passwd$) AS INTEGER | Connect to MySQL | 3 | WXG
CreateDB | FUNCTION (DB$) AS INTEGER | Creates a new database | 1 | WXG
DropDB | FUNCTION (DB$) AS INTEGER | Drop database | 1 | WXG
EscapeString | FUNCTION (S$, Length%) AS STRING | Parses binary string S$ and returns a string that can be used in Blob fields | 2 | WXG
FetchField | FUNCTION AS INTEGER | Fetch next field | 0 | WXG
FetchLengths | FUNCTION AS INTEGER | Fetch lengths for current row | 0 | WXG
FetchRow | FUNCTION AS INTEGER | Fetch next row | 0 | WXG
FieldSeek | FUNCTION (Position%) | Jump to Field Position% | 1 | WXG
Query | FUNCTION (Query$) AS INTEGER | Query database | 1 | WXG
RealConnect | SUB (Host$, User$, Passwd$, DB$, Port%, UnixSock$, Flags%) | Connect to MySQL | 7 | WXG
Refresh | FUNCTION (RefreshFlags%) AS INTEGER | Refresh database | 1 | WXG
RowBlob | FUNCTION (Row%, Bytes&) AS STRING | Returns the binary blob as a string | 2 | WXG
RowSeek | FUNCTION (Row%) | Jump to a certain row | 1 | WXG
SelectDB | FUNCTION (DB$) AS INTEGER | Select database to use | 1 | WXG

QMySQL Events
Event Type Occurs when... Params

QMySQL Examples
' This simply checks that you have a working MySQL server and lets you
' view some database fields.

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

DECLARE SUB Button1Click (Sender AS QBUTTON)
DECLARE SUB DBListBoxClick (Sender AS QLISTBOX)
DECLARE SUB TableListBoxClick (Sender AS QLISTBOX)
DECLARE SUB SQLFormResize (Sender AS QFORM)

DIM Font AS QFONT
    Font.Name = "Courier"
DIM MySQL AS QMYSQL

    CREATE SQLForm AS QFORM
        Caption = "Connected"
        Width = 330
        Height = 300
        Center
        CREATE DBLabel AS QLABEL
            Caption = "Select a database:"
        END CREATE
        CREATE DBListBox AS QLISTBOX
            Top = 20
            Width = 150
            Height = 100
            OnClick = DBListBoxClick
        END CREATE
        CREATE TableListBox AS QLISTBOX
            Top = 20
            Left = 165
            Width = 150
            Height = 100
            OnClick = TableListBoxClick
        END CREATE
        CREATE FieldEdit AS QRICHEDIT
            Top = 130
            Width = SQLForm.ClientWidth
            Height = SQLForm.ClientHeight-130
            ReadOnly = TRUE
            WordWrap = FALSE
            PlainText = TRUE
            Font = Font
            ScrollBars = ssBoth
        END CREATE
        CREATE Grid AS QSTRINGGRID
            Top = 130
            Width = SQLForm.ClientWidth
            Height = SQLForm.ClientHeight-130
            AddOptions(goEditing)
        END CREATE
        OnResize = SQLFormResize
    END CREATE

CREATE Form AS QFORM
    Caption = "SQL Demo"
    Width = 230
    Height = 174
    Center
    CREATE Label1 AS QLABEL
        Caption = "Host:"
        Left = 44
        Top = 23
    END CREATE
    CREATE Label2 AS QLABEL
        Caption = "User name:"
        Left = 16
        Top = 50
        Width = 57
    END CREATE
    CREATE Label3 AS QLABEL
        Caption = "Password:"
        Left = 21
        Top = 79
        Width = 54
    END CREATE
    CREATE Edit1 AS QEDIT
        Text = ""
        Left = 83
        Top = 18
    END CREATE
    CREATE Edit2 AS QEDIT
        Text = ""
        Left = 83
        Top = 46
    END CREATE
    CREATE Edit3 AS QEDIT
        Text = ""
        Left = 83
        Top = 74
    END CREATE
    CREATE Button1 AS QBUTTON
        Caption = "&Ok"
        Left = 32
        Top = 112
        Kind = 1
        Default = 1
        NumBMPs = 2
        OnClick = Button1Click
    END CREATE
    CREATE Button2 AS QBUTTON
        Caption = "E&xit"
        Left = 118
        Top = 112
        Kind = 6
        NumBMPs = 2
    END CREATE
    ShowModal
END CREATE

SUB Button1Click
    DIM I AS INTEGER

    IF MySQL.Connect(Edit1.Text, Edit2.Text, Edit3.Text) = 0 THEN
       ShowMessage("Failed to connect to MySQL Server")
       EXIT SUB
    END IF

    FOR I = 0 TO MySQL.DBCount-1
        DBListBox.AddItems(MySQL.DB(I))
    NEXT

    SQLForm.ShowModal

    SUB DBListBoxClick (Sender AS QLISTBOX)

        IF Sender.ItemIndex < 0 THEN EXIT SUB
        IF MySQL.SelectDB(Sender.Item(Sender.ItemIndex)) = 0 THEN
            ShowMessage("Could not open "+Sender.Item(Sender.ItemIndex))
            EXIT SUB
        END IF

        TableListBox.Clear
        FOR I = 0 TO MySQL.TableCount-1
            TableListBox.AddItems(MySQL.Table(I))
        NEXT
    END SUB

    SUB TableListBoxClick (Sender AS QLISTBOX)
        DIM Str AS STRING, J AS INTEGER

        IF Sender.ItemIndex < 0 THEN EXIT SUB
        IF MySQL.Query("show columns from "+Sender.Item(Sender.ItemIndex)) = 0 THEN
            ShowMessage("Could not query "+Sender.Item(Sender.ItemIndex))
            EXIT SUB
        END IF

        FieldEdit.Clear
        Grid.ColCount = MySQL.FieldCount
        I = 0
        WHILE MySQL.FetchField
            Grid.Cell(I,0) = MySQL.Field.Name
            I++
        WEND

        Grid.RowCount = MySQL.RowCount+1
        IF MySQL.RowCount THEN
            J = 1
            WHILE MySQL.FetchRow
                MySQL.FieldSeek(0)
                FOR I=0 to MySQL.NumFields-1
                    Grid.Cell(I,J) = MySQL.Row(I)
                NEXT
                J++
            WEND
        END IF
    END SUB
END SUB

SUB SQLFormResize (Sender AS QFORM)
    Grid.Height = Sender.ClientHeight - Grid.Top
    Grid.Width = Sender.ClientWidth-1
    TableListBox.Width = Sender.ClientWidth-1 - TableListBox.Left
END SUB

IF MySQL.Connected THEN MySQL.Close
END
D>


QNOTIFYICONDATA

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QNOTIFYICONDATA

QNOTIFYICONDATA Component

QNotifyIconData is not a visible component, it's a data type with the form
   TYPE QNotifyIconData
     cbSize AS INTEGER       ' Read only
     hWnd AS INTEGER
     uID AS INTEGER
     uFlags as INTEGER
     uCallBackMessage as INTEGER
     hIcon as INTEGER
     szTip as STRING
   END TYPE
Its use is primarily restricted to the Shell_NotifyIcon API call, but you may find other uses for it as well.

>


QOLECONTAINER

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOLECONTAINER

QOLECONTAINER Component

QOleContainer is an ActiveX container whose properties and methods can be accessed similar to QOleObject.

QOleContainer Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
AllowInPlace | INTEGER | RW | True
AutoShow | INTEGER | RW | True
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW | 0
Modified | INTEGER | RW | False
Parent | QFORM/QPANEL/QTABCONTROL | W
ShowHint | INTEGER | RW | False
SizeMode | INTEGER | RW | smClip
State | INTEGER | RW | osEmpty
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QOleContainer Methods
Method | Type | Description | Params
CreateObject | FUNCTION (ClassName AS STRING) AS INTEGER | Create new embedded object | 1
Free | SUB | Release object | 0
Invoke | FUNCTIONI (ID AS STRING, Params, ...) AS VARIANT | Invoke method/property | Infinite

QOleContainer Events
Event | Type | Occurs when... | Params
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4
OnObjectMove | SUB (Rect AS QRECT) | OLE Object has moved or resized | 1
OnResize | VOID | After OLE container is resized | 0

QOleContainer Examples
' This example requires GIF89.DLL which can be found on
' Rapid-Q's knowledge base page.
' Make sure to register the .DLL if you haven't already
' c:\blah> regsvr32 gif89.dll

' Note, example works best if you load an animated GIF file.

CREATE Form AS QFORM
    Caption = "Animated GIFs"
    Center
    Visible = 1
    CREATE GifAnimation AS QOLECONTAINER
        Align = alClient
        CreateObject("Gif89.Gif89.1")
        '-- FileName is a property in GIF89.DLL
        FileName = "anim.gif"
    END CREATE
    Visible = 0
END CREATE

Form.ShowModal

GifAnimation.Free
D>


QOPENDIALOG

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOPENDIALOG

QOPENDIALOG Component

QOpenDialog displays Window's file selection dialog

QOpenDialog Properties
Field | Type | R/W | Default | Support
Caption | STRING | RW | W
FileName | STRING | RW | WX
Filter | STRING | RW | W
FilterIndex | INTEGER | RW | 1 | W
InitialDir | STRING | RW | W

QOpenDialog Methods
Method | Type | Description | Params | Support
Execute | FUNCTION | Returns TRUE or FALSE | 0 | WX

QOpenDialog Examples
  '-- Simple demo
  DIM OpenDialog AS QOpenDialog

  IF OpenDialog.Execute THEN
    ShowMessage "You selected "+OpenDialog.FileName
  END IF

  '-- Using filters
  DIM OpenDialog AS QOpenDialog

  OpenDialog.Filter = "Picture files|*.BMP;*.ICO|All Files|*.*"
  OpenDialog.FilterIndex = 2    '' Use "All Files" as our default

  IF OpenDialog.Execute THEN
    ShowMessage "You selected "+OpenDialog.FileName
  END IF


QOUTLINE

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOUTLINE

QOUTLINE Component

QOutLine implements the old style Win3.1 tree view.

QOutLine Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
BMPClosed | STRING | W
BMPLeaf | STRING | W
BMPMinus | STRING | W
BMPOpen | STRING | W
BMPPlus | STRING | W
BMPHandleClosed | RESOURCE | W
BMPHandleLeaf | RESOURCE | W
BMPHandleMinus | RESOURCE | W
BMPHandleOpen | RESOURCE | W
BMPHandlePlus | RESOURCE | W
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Item | ARRAY of STRING | RW
ItemHeight | INTEGER | RW | 13
ItemIndex | INTEGER | RW
ItemSeparator STRING RW \
Left | INTEGER | RW | 0
LineCount | INTEGER | RW
OutLineStyle | INTEGER | RW | osTreePictureText
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
Row | INTEGER | RW
ScrollBars | INTEGER | RW | ssBoth
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Visible | INTEGER | RW | True
Width | INTEGER | RW

QOutLine Methods
Method | Type | Description | Params
AddChild | SUB (Index%, String$) | Add child at Index% | 2
AddLines | SUBI | Add lines to Outline | STRING, Infinite
AddOptions | SUBI | Add Outline options | INTEGER, Infinite
Clear | SUB | Clear all items | 0
DelLines | SUBI | Delete lines from Outline | INTEGER, Infinite
DelOptions | SUBI | Delete Outline options | INTEGER, Infinite
Insert | SUB (Index%, String$) | Insert node at Index% | 2

QOutLine Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on item | 0
OnDblClick | VOID | User double clicked on item | 0

QOutLine Examples
CREATE Form AS QForm
  CREATE OutLine AS QOutLine
    AddLines "Parent 1", _
             " Child of Parent 1", _
             "  Child of Child of Parent 1", _
             "Parent 2", _
             "Parent 3", _
  END CREATE
  Center
  ShowModal
END CREATE
D>


QOVALBTN

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOVALBTN

QOVALBTN Component

QOvalbtn is similar to QCoolBtn, except the button looks round/oval.

QOvalbtn Properties >
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
BMP | STRING | W | W
BMPHandle | RESOURCE | W | W
Caption | STRING | RW | WX
Color | INTEGER | RW | WX
ColorHighLight | INTEGER | RW | W
ColorShadow | INTEGER | RW | W
Cursor | INTEGER | RW | crDefault | W
Down | INTEGER | RW | False | W
Enabled | INTEGER | RW | TrueWX
Flat | INTEGER | RW | False | WX
Font | QFONT | W | W
GroupIndex | INTEGER | RW | 0 | W
Height | INTEGER | RW | WX
Hint | STRING | RW | WX
Layout | INTEGER | RW | blBMPLeft | W
Left | INTEGER | RW | 0 | WX
NumBMPs | INTEGER | RW | W
Parent | QFORM/QPANEL/QTABCONTROL | W | WX
ShowHint | INTEGER | RW | False | WX
Spacing | INTEGER | RW | W
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WX
Transparent | INTEGER | RW | False | W
TransParentColor | INTEGER | RW | W
Width | INTEGER | RW | WX
Visible | INTEGER | RW | True | WX

QOvalbtn Methods
Method | Type | Description | Params | Support
StartDrag | SUB | Allows Button to be dragged | 0 | W

QOvalbtn Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on the button | 0 | WX
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WX
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WX
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WX

QOvalbtn Examples
CREATE Form AS QForm
  CREATE OvalBtn AS QOvalBtn
    Caption = "Oval Button"
    Color = &H00FF00
  END CREATE
  ShowModal
END CREATE
D>


QPOPUPMENU

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QPOPUPMENU

QPOPUPMENU Component

QPopupMenu provides a popup menu selection control

QPopupMenu Properties
Field | Type | R/W | Default
Alignment | INTEGER | RW | paLeft
Alignment determines where the pop-up menu appears when the user clicks the right mouse button.
0 = paLeft - Pop-up menu appears with its top left corner under the mouse pointer
1 = paRight = Pop-up menu appears with its top right corner under the mouse pointer
2 = paCenter - Pop-up menu appears with the top center of the menu under the mouse pointer
AutoPopup | INTEGER | RW | True
AutoPopup determines whether the pop-up menu appears automatically when the user clicks the right mouse button.
Handle | INTEGER | R
Handle is the Windows menu handle for the menu.
Tag | INTEGER | RW
Tag stores an integer value, but is not used internally.
WindowHandle | INTEGER | RW
WindowHandle is the handle of the window that uses the menu.

QPopupMenu Methods
Method | Type | Description | Params
AddItems | SUBI | Add Item to Menu | QMENUITEMs, Infinite
DelIndex | SUB (index AS LONG) | Delete items, by index, from menu | 1
DelItems | SUBI | Delete items from menu | QMENUITEMs, Infinite
Insert | SUB (I%, Item AS QMENUITEM) | Insert an item | 2
Popup | SUB (X%, Y%) | Popup menu at (X,Y) | 2

QPopupMenu Events
Event | Type | Occurs when... | Params
OnPopup | VOID | Just before the pop-up menu appears | 0

QPopupMenu Examples
  DIM PopupMenu AS QPopupMenu
  DIM Item1 AS QMenuItem
  DIM Item2 AS QMenuItem

  Item1.Caption = "Item 1"
  Item2.Caption = "Item 2"
  PopupMenu.AddItems(Item1, Item2)

  PopupMenu.Popup(100,100)
D>


QRADIOBUTTON

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QRADIOBUTTON

QRADIOBUTTON Component

QRadioButton is a simple radio item. If you want to group radiobuttons, use a container like QPanel.

QRadioButton Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Caption | STRING | RW | WXG
Checked | INTEGER | RW | False | WXG
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | W
Height | INTEGER | RW | WXG
Hint | STRING | RW | WXG
Left | INTEGER | RW | 0 | WXG
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
ShowHint | INTEGER | RW | False | WXG
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WXG
Visible | INTEGER | RW | True | WXG
Width | INTEGER | RW | WXG

QRadioButton Methods
Method Type Description Params

QRadioButton Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on radio button | 0 | WXG

QRadioButton Examples
  DIM Form AS QForm
  DIM Radio1 as QRadioButton
  DIM Radio2 as QRadioButton
  DIM Radio3 as QRadioButton

  Radio1.Parent = Form
  Radio1.Top = 10
  Radio1.Caption = "Item 1"
  Radio2.Parent = Form
  Radio2.Top = 35
  Radio2.Caption = "Item 2"
  Radio3.Parent = Form
  Radio3.Top = 60
  Radio3.Caption = "Item 3"

  Form.ShowModal
D>


QRECT

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QRECT

QRECT Component

QRect is not a visible component, it's a data type with the form
   TYPE QRect
     Left AS INTEGER
     Top AS  INTEGER
     Right AS INTEGER
     Bottom as INTEGER
   END TYPE

>


QREGISTRY

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QREGISTRY

QREGISTRY Component

QRegistry encapsulates functions that operate on the Window's system registry.

QRegistry Properties
Field | Type | R/W | Default
CurrentKey | INTEGER | R
CurrentPath | STRING | R
GetDataSize | INTEGER | R
GetDataType | INTEGER | R
HasSubKeys | INTEGER | R
KeyItemCount | INTEGER | R
ValueItemCount | INTEGER | R
RootKey | INTEGER | RW | HKEY_CURRENT_USER

QRegistry Methods
Method | Type | Description | Params
CloseKey | SUB | Closes opened key | 0
CreateKey | FUNCTION (Key$) AS INTEGER | Creates a new key in CurrentPath. | 1
DeleteKey | FUNCTION (Key$) AS INTEGER | Deletes key. | 1
DeleteValue | FUNCTION (ValName$) AS INTEGER | Deletes a value data. | 1
KeyExists | FUNCTION (Key$) AS INTEGER | Returns 0 or 1 if key exists. | 1
KeyItem | FUNCTION (Index%) AS STRING | Retrieve the names of the subkeys | 1
MoveKey | FUNCTION (Old$, New$, Delete%) | Moves existing key, subkeys, and data values. | 3
OpenKey | FUNCTION (Key$, CanCreate%) | CanCreate specifies whether to create the specified key if it does not exist. | 2
ReadBinary | FUNCTION (Key$, Index%) AS BYTE | Return binary value of specified key | 2
ReadFloat | FUNCTION (Key$) AS DOUBLE | Return double value of specified key | 1
ReadInteger | FUNCTION (Key$) AS INTEGER | Return integer value of specified key | 1
ReadString | FUNCTION (Key$) AS STRING | Return string value of specified key | 1
RegistryConnect | FUNCTION (CompName$) AS INTEGER | Establishes connection to another computer's registry. | 1
RenameValue | FUNCTION (Old$, New$) AS INTEGER | Renames existing data value. | 2
ValueExists | FUNCTION (Value$) AS INTEGER | Returns 0 or 1 if data value Value$ exists. | 1
ValueItem | FUNCTION (Index%) AS STRING | Retrieve the names of the data values | 1
WriteBinary | SUB (Key$, BYTE(), Size%) | Write Array of BYTEs in the specified key | 3
WriteFloat | SUB (Key$, Value#) | Write double value in the specified key | 2
WriteInteger | SUB (Key$, Value&) | Write integer value in the specified key | 2
WriteString | SUB (Key$, Value$) | Write string in the specified key | 2

QRegistry Events
Event Type Occurs when... Params

QRegistry Examples
'  Detect if your computer is connected to the internet

Const HKEY_LOCAL_MACHINE = &H80000002

DIM Registry AS QRegistry

Registry.RootKey = HKEY_LOCAL_MACHINE
Registry.OpenKey("System\CurrentControlSet\Services\RemoteAccess", 0)

IF Registry.ReadBinary("Remote Connection", 0) = 1 THEN
  ShowMessage("You're connected!")
ELSE
  ShowMessage("You're not connected!")
END IF
D>


QRICHEDIT

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QRICHEDIT

QRICHEDIT Component

QRichedit implements a fully featured multi-line text edit control.

QRichedit Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
Alignment | INTEGER | RW | taLeftJustify | W
Alignment determines how the text is aligned within the edit control.
BorderStyle | INTEGER | RW | bsSingle | W
Color | INTEGER | RW | W
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W | WX
Handle | INTEGER | R | W
Height | INTEGER | RW | WXG
HideScrollBars | INTEGER | RW | True | WG
HideSelection | INTEGER | RW | True | W
Hint | STRING | RW | WG
Left | INTEGER | RW | 0 | WXG
Line | ARRAY of STRING | RW | WXG
LineCount | INTEGER | RW | WXG
Modified | INTEGER | R | WG
Parent | QFORM/QPANEL/QTABCONTROL | W | WXG
PopupMenu | QPOPUPMENU | W | W
Plaintext | INTEGER | RW | False | W
Readonly | INTEGER | RW | False | WXG
ScrollBars INTEGER RW ssNone
CONST ssNone = 0
CONST ssHorizontal = 1
CONST ssVertical = 2
CONST ssBoth = 3
WXG
SelAttributes | QFONT | W | W
SelLength | INTEGER | RW | WXG
SelLength is the number of characters that are selected.
SelStart | INTEGER | RW | WXG
SelStart is the position of the first selected character in the text. If there is no selected text, SelStart indicates the position of the cursor.
SelText | STRING | RW | WXG
SelText is the selected portion of the edit control's text.
ShowHint | INTEGER | RW | False | WG
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Text | STRING | RW | WXG
Top | INTEGER | RW | 0 | WXG
WantTabs | INTEGER | RW | False | W
WantTabs determines whether the user can insert tab characters into the text.
Width | INTEGER | RW | WXG
WhereX | INTEGER | R | WXG
WhereY | INTEGER | R | WXG
Wordwrap | INTEGER | RW | True | W
Visible | INTEGER | RW | True | WXG

QRichedit Methods
Method | Type | Description | Params | Support
AddStrings | SUBI | Add strings | STRING, Infinite | WXG
Clear | SUB | Clear entire text | 0 | WXG
CopyToClipboard | SUB | Copy selected text to clipboard | 0 | W
CutToClipboard | SUB | Cut selected text to clipboard | 0 | W
LoadFromFile | SUB (FileName$) | Load text from a file | 1 | WXG
LoadFromStream | SUB (Stream AS QFILESTREAM/QMEMORYSTREAM) | Load text from a stream | 1 | WX
PasteFromClipboard | SUB | Paste text from clipboard | 0 | W
SaveToFile | SUB (FileName$) | Save text to a file | 1 | WXG
SaveToStream | SUB (Stream AS QFILESTREAM/QMEMORYSTREAM) | Save text to a stream | 1 | W
SelectAll | SUB | Selects all text from Richedit | 0 | WXG

QRichedit Events
Event | Type | Occurs when... | Params | Support
OnChange | VOID | Text changes | 0 | WG
OnKeyDown | SUB (Key AS WORD, Shift AS INTEGER) | Key held down | 2 | WG
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | WG
OnKeyUp | SUB (Key AS WORD, Shift AS INTEGER) | Key released | 2 | WG
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WX
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 2 | WX
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WX

QRichedit Examples
  $INCLUDE "RAPIDQ.INC"

  DIM Form AS QForm
  DIM RichEdit AS QRichEdit

  RichEdit.Parent = Form
  RichEdit.Scrollbars = ssBoth
  RichEdit.AddString "Hello world!"

  Form.ShowModal
D>


QSAVEDIALOG

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QSAVEDIALOG

QSAVEDIALOG Component

QSaveDialog displays a Save As dialog box for saving files.

QSaveDialog Properties
Field | Type | R/W | Default
Caption | STRING | RW
FileName | STRING | RW
Filter | STRING | RW
FilterIndex | INTEGER | RW | 1
InitialDir | STRING | RW

QSaveDialog Methods
Method | Type | Description | Params
Execute | FUNCTION | Returns TRUE or FALSE | 0

QSaveDialog Examples
  '-- Simple demo
  DIM SaveDialog AS QOpenDialog

  IF SaveDialog.Execute THEN
    ShowMessage "You want to save as "+SaveDialog.FileName
  END IF


QSCROLLBAR

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSCROLLBAR

QSCROLLBAR Component

QScrollBar is a Windows scroll bar, used to scroll contents of a window, form, or control. It can also act as a simple trackbar.

QScrollBar Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Align determines how the control aligns within its parent control.
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WX
Handle | INTEGER | R | W
Height | INTEGER | RW | WX
Hint | STRING | RW | WX
Kind | INTEGER | RW | sbHorizontal | WX
Kind specifies whether the scrollbar is horizontal or vertical.
0 = sbHorizontal -- Scrollbar is horizontal.
1 = sbVertical -- Scrollbar is vertical.
LargeChange | INTEGER | RW | 1 | WX
LargeChange determines how much Position changes when the user clicks on the scrollbar on either side of the thumb or pressed PageUp or PageDown.
Left | INTEGER | RW | 0 | WX
Max | INTEGER | RW | 100 | WX
Min | INTEGER | RW | 0 | WX
PageSize | INTEGER | RW | 1 | W
PageSize specifies the distance along the trackbar.
Parent | QFORM/QPANEL/QTABCONTROL | W | WX
PopupMenu | QPOPUPMENU | W | W
Position | INTEGER | RW | 0 | WX
ShowHint | INTEGER | RW | False | WX
SmallChange | INTEGER | RW | 1 | WX
SmallChange determines how much Position changes when the user clicks the arrow buttons on the scrollbar or presses the arrow keys.
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WX
Width | INTEGER | RW | WX
Visible | INTEGER | RW | True | WX

QScrollBar Events
Event | Type | Occurs when... | Params | Support
OnChange | VOID | Scroll position changes | 0 | WX
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2 | W
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | W
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 | W
OnScroll | SUB (ScrollCode AS BYTE, ScrollPos AS LONG) | Scrolling | 2 | W

QScrollBar Examples
' Color Palette for Rapid-Q by William Yu

DECLARE SUB ColorChange
DECLARE SUB Paint

CONST False = 0
CONST True = NOT False

'' Here's something that will convert your standard RGB to Rapid-Q's BGR.
'' And quite useless because an RGB function is already implemented!
FUNCTION ConvertRGB(R AS INTEGER, G AS INTEGER, B AS INTEGER) AS INTEGER
  ConvertRGB = (B SHL 16) OR (G SHL 8) OR R
END FUNCTION

CREATE Form AS QForm
  CREATE LabelRed AS QLabel
    Left = 10
    Top = 22
    Caption = "Red:"
  END CREATE
  CREATE LabelGreen AS QLabel
    Left = 5
    Top = 52
    Caption = "Green:"
  END CREATE
  CREATE LabelBlue AS QLabel
    Left = 10
    Top = 82
    Caption = "Blue:"
  END CREATE
  CREATE LabelNum1 AS QLabel
    Left = 270
    Top = 22
    Caption = "0"
  END CREATE
  CREATE LabelNum2 AS QLabel
    Left = 270
    Top = 52
    Caption = "0"
  END CREATE
  CREATE LabelNum3 AS QLabel
    Left = 270
    Top = 82
    Caption = "0"
  END CREATE
  CREATE ScrollRed AS QScrollBar
    Left = 50
    Top = 20
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Red Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE ScrollGreen AS QScrollBar
    Left = 50
    Top = 50
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Green Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE ScrollBlue AS QScrollBar
    Left = 50
    Top = 80
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Blue Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE PaintBox AS QCanvas
    Left = 50
    Top = 110
    Height = 90
    Width = 200
    OnPaint = Paint
  END CREATE
  Caption = "Color Palette"
  Center
  ShowModal
END CREATE

SUB ColorChange
  LabelNum1.Caption = STR$(ScrollRed.Position)
  LabelNum2.Caption = STR$(ScrollGreen.Position)
  LabelNum3.Caption = STR$(ScrollBlue.Position)
  Paint
END SUB

SUB Paint
  PaintBox.Paint(0,0,ConvertRGB(ScrollRed.Position, ScrollGreen.Position, ScrollBlue.Position),&HFFFFFF)
END SUB


QSCROLLBOX

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSCROLLBOX

QSCROLLBOX Component

QScrollBox is a scrolling window control.

QScrollBox Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
AutoScroll | INTEGER | RW | True
AutoScroll specifies whether scrollbars appear automatically on the scrolling windowed control if it is not large enough to display all of its controls.
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
HorzIncrement | INTEGER | RW | 8
HorzIncrement determines how far the display moves when the user clicks one of the small end arrows on the scrollbar.
HorzMargin | INTEGER | RW | 0
HorzMargin specifies the minimum number of pixels that must separater each control from the edge of the scrollbox.
HorzPosition | INTEGER | RW | 0
HorzPosition specifies the position of the thumb tab on the scrollbar.
HorzRange | INTEGER | RW | 0
HorzRange determines how far the scrollbox can move.
HorzTracking | INTEGER | RW | False
HorzTracking determines whether the scrollbox moves before the thumb tab is released.
HorzVisible | INTEGER | RW | True
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
VertIncrement | INTEGER | RW | 8
VertMargin | INTEGER | RW | 0
VertPosition | INTEGER | RW | 0
VertRange | INTEGER | RW | 0
VertTracking | INTEGER | RW | False
VertVisible | INTEGER | RW | True
Visible | INTEGER | RW | True

QScrollBox Methods
Method | Type | Description | Params
Repaint | SUB | Repaint control | 0

QScrollBox Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on scrollbox | 0
OnDblClick | VOID | User double clicked on scrollbox | 0
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4
OnResize | VOID | Scrollbox is resized | 0

QScrollBox Examples
CREATE Form AS QForm
  Center
  CREATE ScrollBox AS QScrollBox
    Left = 50
    CREATE Button AS QButton   '-- Create button inside scrollbox
    END CREATE
  END CREATE
  ShowModal
END CREATE
D>


QSOCKET

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSOCKET

QSOCKET Component

QSocket provides an easy to use interface to communicate between server/client with sockets.

QSocket Properties
Field | Type | R/W | Default | Support
Family | INTEGER | RW | AF_INET | W
Family specifies the address family.
LParam | INTEGER | RW | FD_CONNECT | W
LParam specifies the message to capture when you set WMessage and handle the message processing by assigning a new WndProc to your form.
MySocket | INTEGER | R | WXG
MySocket stores the result of operations such as Open. So instead of using the return value of Open, you can use the property MySocket.
Parent | QFORM | W | W
Protocol | INTEGER | RW | IPPROTO_IP | W
Tag | INTEGER | RW | WXG
Transferred | INTEGER | R | WXG
Type | INTEGER | RW | SOCK_STREAM | W
WMessage | INTEGER | RW | 0 | W
WMessage specifies a user defined message to be passed to your form for non-blocking calls, ie. Connecting.

QSocket Methods
Method | Type | Description | Params | Support
Accept | FUNCTION ClientSock%(Socket%) | Accepts Client Connection | 1 | WXG
Close | SUB (Socket%) | Closes Socket% file descriptor | 1 | WXG
Connect | FUNCTION Sock%(ServerName$, PortNum%) | Connect to server on PortNum% | 2 | WXG
ConnectionReady | FUNCTION Bool%(Sock%) | True/False if connection pending | 1 | WXG
GetHostIP | FUNCTION AS STRING | Returns host IP Address | 0 | WXG
GetHostName | FUNCTION AS STRING | Returns host name | 0 | WXG
GetPeerName | FUNCTION GetPeerName$(Socket%) | Returns peer name | 1 | WXG
IsClientReady | FUNCTION Bool%(Sock%, ClientSock%) | True/False if client is sending data | 2 | WXG
IsServerReady | FUNCTION Bool%(Sock%) | True/False if server is sending data | 1 | WXG
Open | FUNCTION Sock%(PortNum%) | Open TCP server on PortNum% | 1 | WXG
Peek | FUNCTION Peek$(Socket%, NumBytes%) | Peek information coming from socket, but do not clear. Win32 | 2 | W
Read | FUNCTION Message$(Socket%, NumBytes%) | Read NumBytes% | 2 | WXG
ReadByte | FUNCTION (Socket%) AS BYTE | Read a single byte | 2 | WXG
ReadLine | FUNCTION Message$(Socket%) | Read complete line | 1 | WXG
Write | SUB (Socket%, Message$, NumBytes%) | Sends NumBytes% from Message$ | 3 | WXG
WriteByte | SUB (Socket%, B AS BYTE) | Sends a single byte | 2 | WXG
WriteLine | FUNCTION Bytes%(Socket%, Message$) | Send Message$ | 2 | WXG

QSocket Examples
See the chatserver.bas and chatclient.bas (or chatserv.bas and chatcli.bas for Windows)
included in the Rapid-Q distribution.
Also take a look at http.bas included in the Rapid-Q for Windows distribution.


QSPLITTER

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSPLITTER

QSPLITTER Component

QSplitter sits between a control aligned to one of the edges of the form and the controls that fill up the rest of the client area. It is used to resize the controls at runtime.

QSplitter Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alLeft
Align determines how the control aligns within its parent control.
Beveled | INTEGER | RW | True
Beveled determines whether the splitter looks beveled along the edge that moves.
ClientHeight | INTEGER | RW
ClientWidth | INTEGER | RW
Color | INTEGER | RW
Cursor | INTEGER | RW | crHSplit
Enabled | INTEGER | RW | True
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW
MinSize | INTEGER | RW | 30
MinSize is the minimum size, in pixels, of the client area the splitter must leave on the form.
Parent | QFORM/QPANEL/QTABCONTROL | W
ShowHint | INTEGER | RW | False
Tag | INTEGER | RW
Top | INTEGER | RW
Visible | INTEGER | RW | True
Width | INTEGER | RW

QSplitter Methods
Method Type Description Params

QSplitter Events
Event | Type | Occurs when... | Params
OnMoved | VOID | Splitter Moved | 0

QSplitter Examples
$INCLUDE "RAPIDQ.INC"

CREATE Form AS QFORM
    Height = 400
    Caption = "QSplitter example"
    Center
    Visible = 1                  '-- Required
    Visible = 0                  '-- trick
    CREATE Panel AS QPANEL
        Align = alTop            '-- Fill top portion of form
        Height = 100
        Caption = "PANEL"
    END CREATE
    CREATE Splitter AS QSPLITTER '-- Note position
        Align = alTop            '-- Fill middle
        Cursor = crVSplit
        Height = 10
    END CREATE
    CREATE RichEdit AS QRICHEDIT
        Align = alClient         '-- Fill rest of form
        AddStrings "RICHEDIT"
    END CREATE
    ShowModal
END CREATE
D>


QSTATUSBAR

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSTATUSBAR

QSTATUSBAR Component

QStatusBar implements a Windows status bar.

QStatusBar Internal Types
   TYPE PanelType           '' ie. StatusBar.Panel(0).Caption
     Alignment AS INTEGER   '' Specifies the text alignment, default is taLeftJustify
     Caption AS STRING
     Width AS INTEGER
   END TYPE
QStatusBar Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alBottom
Align determines how the control aligns within its parent control.
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW | 0
Panel | ARRAY of PanelType | RW
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ShowHint | INTEGER | RW | False
SimplePanel | INTEGER | RW | False
SimplePanel determines whether the statusbar displays a single panel or multiple panels.
SimpleText | STRING | RW
SimpleText contains the string that is displayed in the statusbar when SimplePanel is true.
SizeGrip | INTEGER | RW | True
SizeGrip determines whether the statusbar is resizable at runtime.
TabOrder | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QStatusBar Methods
Method | Type | Description | Params
AddPanels | SUBI | Add panels to status bar | STRING, Infinite
Clear | SUB | Clear panels | 0

QStatusBar Events
Event | Type | Occurs when... | Params
OnResize | VOID | Status bar is being resized | 0

QStatusBar Examples
CREATE Form AS QForm
  Center
  CREATE StatusBar AS QStatusBar
    AddPanels "Panel 1", "Panel 2", "Panel 3"
    Panel(1).Width = 100  ' change width of Panel 2
  END CREATE
  ShowModal
END CREATE
D>


QSTRINGLIST

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QSTRINGLIST

QSTRINGLIST Component

QStringList is a component to store and manipulate a list of strings.

QStringList Properties

Field | Type | R/W | Default | Support
Duplicates | INTEGER | RW | dupIgnore | W
Item | ARRAY of STRING | RW | WXG
ItemCount | INTEGER | R | WXG
Sorted | INTEGER | RW | False | W
Text | STRING | RW | WXG

QStringList Methods
Method | Type | Description | Params | Support
AddItems | SUBI | Add strings to stringlist | STRINGs, Infinite | WXG
AddList | SUB (List AS QStringList) | Append another stringlist | 1 | WXG
Build | FUNCTION Build(Start%, End%, Delim$) AS STRING | Returns a deliminated string | 3 | WXG
Clear | SUB | Clears entire stringlist | 0 | WXG
DelItems | SUBI | Delete strings by their index | Index #s, Infinite | WXG
Exchange | SUB (Index1%, Index2%) | Swap strings at Index1% with Index2% | 2 | WXG
Find | Function (string$) as integer | Search string$ in stringlist. Return index of string$ | 1
IndexOf | FUNCTION IndexOf%(String$) | Return Index number of string | 1 | WXG
InsertItem | SUB (Index%, String$) | Insert string at Index% | 2 | WXG
LoadFromFile | SUB (File$) | Load text file in stringlist | 1 | WXG
LoadFromStream | SUB (File AS QStream) | Load file/memorystream in stringlist | 1 | W
Parse | FUNCTION Parse(Source$, Delim$) AS LONG | Separates strings by the Delim$ and stores each item in the list | 2 | WXG
SaveToFile | SUB (File$) | Saves stringlist to file | 1 | WXG
SaveToStream | SUB (File AS QStream) | Load file/memorystream in stringlist | 1 | W
Sort | SUB | Sort the stringlist | 0 | WXG

QStringList Events
Event Type Occurs when... Params

QStringList Examples
  DIM StringList1 AS QStringList
  DIM StringList2 AS QStringList

  StringList1.AddItems "Oranges","Apples"
  StringList2.AddItems "Byte","Word","Integer"
  StringList1.AddList(StringList2)
  StringList1.Sort

  ?StringList1.Text
  ?StringList1.Item(3)
  ?StringList1.IndexOf("Word")
  ?StringList1.IndexOf("hi")

  '-------------------------------------------------------

  DIM StringList AS QSTRINGLIST

  StringList.Parse("James:Brown:555-3454:House",":")

  PRINT StringList.Build(0,StringList.ItemCount-1,",")
D>


QTABCONTROL

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QTABCONTROL

QTABCONTROL Component

QTabControl is a tab set that has the appearance of notebook dividers, except it is not made up of several pages.

QTabControl Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
ButtonStyle | INTEGER | RW | False
ClientHeight | INTEGER | RW
ClientWidth | INTEGER | RW
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
FlatButtons | INTEGER | RW | False
FlatSeperators | INTEGER | RW | False
FocusButtons | INTEGER | RW | False
Font | QFONT | W
Height | INTEGER | RW
Hint | STRING | RW
HotTrack | INTEGER | RW | False
Left | INTEGER | RW | 0
MultiLine | INTEGER | RW | False
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ScrollOpposite | INTEGER | RW | False
ShowHint | INTEGER | RW | False
Tab | ARRAY of STRING | RW
TabHeight | INTEGER | RW
TabInactiveColor | INTEGER | RW
TabInactiveFont | QFONT | W
TabIndex | INTEGER | RW
TabOrder | INTEGER | RW
TabPosition | INTEGER | RW
TabWidth | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW
VerticalTabs | INTEGER | RW | False
Visible | INTEGER | RW | True

QTabControl Methods
Method | Type | Description | Params
AddTabs | SUBI | Add tabs to control | STRING, Infinite
DelTabs | SUBI | Delete tabs from control | INTEGER, Infinite
InsertTab | SUB (Index%, String$) | Inserts Tab at Index% | 2

QTabControl Events
Event | Type | Occurs when... | Params
OnChange | VOID | Tabs change | 0

QTabControl Examples
'' Tab Control Example for Rapid-Q by William Yu
'' When you hide a container (like QFORM, QTABCONTROL, and QPANEL), all the
'' components within it are also hidden.

$INCLUDE "RAPIDQ.INC"

DECLARE SUB TabChange

CREATE MainForm AS QForm
  Center
  Height = 300
  Width = 350
  Caption = "Tab Control demo"
  CREATE Tab AS QTabControl
    AddTabs "Tab 1","Tab 2","Tab 3","Tab 4"
    Width = MainForm.ClientWidth
    Height = MainForm.ClientHeight
    OnChange = TabChange
    HotTrack = True
    CREATE Panel0 AS QPanel
      Top = 40
      Left = 5
      Width = Tab.ClientWidth - 10
      Height = Tab.ClientHeight - 50
      Caption = "Panel 1"
      BevelInner = bvLowered
      CREATE Button1 AS QButton
        Caption = "Hello world!"
      END CREATE
    END CREATE
    CREATE Panel1 AS QPanel
      Top = 40
      Left = 5
      Width = Tab.ClientWidth - 10
      Height = Tab.ClientHeight - 50
      Caption = "Panel 2"
      BevelInner = bvLowered
      Visible = False
    END CREATE
    CREATE Panel2 AS QPanel
      Top = 40
      Left = 5
      Width = Tab.ClientWidth - 10
      Height = Tab.ClientHeight - 50
      Caption = "Panel 3"
      BevelInner = bvLowered
      Visible = False
    END CREATE
    CREATE Panel3 AS QPanel
      Top = 40
      Left = 5
      Width = Tab.ClientWidth - 10
      Height = Tab.ClientHeight - 50
      Caption = "Panel 4"
      BevelInner = bvLowered
      Visible = False
    END CREATE
  END CREATE
END CREATE

SUB TabChange
  SELECT CASE Tab.TabIndex
    CASE 0
      Panel0.Visible = True
      Panel1.Visible = False
      Panel2.Visible = False
      Panel3.Visible = False
    CASE 1
      Panel1.Visible = True
      Panel0.Visible = False
      Panel2.Visible = False
      Panel3.Visible = False
    CASE 2
      Panel2.Visible = True
      Panel1.Visible = False
      Panel0.Visible = False
      Panel3.Visible = False
    CASE 3
      Panel3.Visible = True
      Panel1.Visible = False
      Panel2.Visible = False
      Panel0.Visible = False
  END SELECT
END SUB

MainForm.ShowModal
D>


QTIMER

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QTIMER

QTIMER Component

QTimer implements the Windows API timer functions.

QTimer Properties
Field | Type | R/W | Default | Support
Enabled | INTEGER | RW | True | WXG
Interval | INTEGER | RW | WXG
Interval determines the amount of time, in milliseconds, that passes before the timer component initiates another OnTimer event.
Tag | INTEGER | RW | WXG

QTimer Events
Event | Type | Occurs when... | Params | Support
OnTimer | VOID | Timer interval elaspes | 0 | WXG

QTimer Examples
' Timer & OnKeyPress example for Rapid-Q by William Yu
'       If no form is visible, Timer will not function.
'       Not for PURE CONSOLE apps, but you're allowed to MIX.

DIM Timer1 AS QTimer, Timer2 AS QTimer
DIM Form AS QFORM
DIM Label1 AS QLABEL, Label2 AS QLABEL
DIM Label3 AS QLABEL

SUB TimerOver
  Timer1.Interval = 100
  I = I + 1
  Label1.Caption = STR$(I)
END SUB

SUB Timer2Over
  Timer2.Interval = 1000
  J = J + 1
  Label2.Caption = STR$(J)
END SUB

SUB KeyPressed (Key AS BYTE)      '' Event returns one parameter
  IF UCASE$(CHR$(Key)) = "Q" THEN
    FORM.CLOSE
  END IF
END SUB

I = 0        ' Undeclared variables are automatically global!
J = 0

FORM.CAPTION = "Timer Example"
FORM.WIDTH = 150
FORM.HEIGHT = 120
FORM.CENTER

Label1.Parent = Form
Label1.Caption = STR$(I)
Label1.Left = FORM.WIDTH/2

Label2.Parent = Form
Label2.Caption = STR$(J)
Label2.Left = FORM.WIDTH/2
Label2.Top = 40

Label3.Parent = Form
Label3.Caption = "Press 'Q' to quit'
Label3.Top = 75

Timer1.Interval = 100
Timer1.Enabled = 1          ' True
Timer1.OnTimer = TimerOver

Timer2.Interval = 1000
Timer2.Enabled = 1          ' True
Timer2.OnTimer = Timer2Over

FORM.OnKeyPress = KeyPressed
FORM.SHOWMODAL


QTRACKBAR

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QTRACKBAR

QTRACKBAR Component

QTrackBar is a track bar control used to represent a position along a continuum using a slider and, optionally, tick marks.

QTrackBar Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Frequency | INTEGER | RW
Frequency specifies the increment between tick marks on the trackbar.
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW | 0
LineSize | INTEGER | RW | 1
LineSize is the amount the value of Position changes when the user presses the arrow keys.
Max | INTEGER | RW | 10
Max specifies the maximum Position of the trackbar.
Min | INTEGER | RW | 0
Min specifies the minimum Position of the trackbar.
Orientation | INTEGER | RW | tbHorizontal
Orientation specifies whether the trackbar is horizontal or vertical.
0 = tbHorizontal -- Min position is on the left, Max is on the right.
1 = tbVertical -- Min position is on the top, Max is on the bottom.
PageSize | INTEGER | RW | 2
PageSize specifies the amount Position is changed when the PageUp or PageDown key is pressed, or when the bar is clicked.
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
Position | INTEGER | RW
Position contains the current position of the slider.
SelEnd | INTEGER | RW
SelEnd specifies the position of the end point of the selection range.
SelStart | INTEGER | RW
SelStart specifies the position of the starting point of the selection range.
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
TickMarks | INTEGER | RW | tmBottomRight
TickMarks specifies the location of the tick marks.
0 = tmBottomRight -- Tick marks are on the bottom or right of the trackbar depending on the value of Orientation.
1 = tmTopLeft -- Tick marks are on the top or left of the trackbar depending on the value of Orientation.
2 = tmBoth -- Tick marks are on both sides of the trackbar.
TickStyle | INTEGER | RW | tsAuto
TickStyle specifies how tick marks are place on the trackbar.
0 = tsNone -- No tick marks are displayed.
1 = tsAuto -- Trackbar displays tick marks automatically for each increment in its range.
2 = tsManual -- Trackbar displays tick marks at either end. Use SetTick to set a tick in other positions
Top | INTEGER | RW | 0
Width | INTEGER | RW
Visible | INTEGER | RW | True

QTrackBar Methods
Method | Type | Description | Params
SetTick | SUB (Pos%) | Set a tick mark at Pos% | 1

QTrackBar Events
Event | Type | Occurs when... | Params
OnChange | VOID | Track bar changes | 0

QTrackBar Examples
CREATE Form AS QForm
  Center
  CREATE TrackBar AS QTrackBar
    ' Initialize track bar
  END CREATE
  ShowModal
END CREATE
D>


QTREEVIEW

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QTREEVIEW

QTREEVIEW Component

QTreeView displays a hierarchical list of items. Items are ordered by their index.

QTreeView Internal Types
   TYPE TreeNodeType           '' ie. TreeView.Item(0).Text
     Text AS STRING
     ImageIndex AS INTEGER
     StateIndex AS INTEGER
     SelectedIndex AS INTEGER
     Count AS INTEGER          '' Read only
     Level AS INTEGER          '' Read only
     IsVisible AS INTEGER      '' Read only
     Handle AS INTEGER         '' Read only
     HasChildren AS INTEGER
     Selected AS INTEGER
   END TYPE
QTreeView Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
BorderStyle | INTEGER | RW | bsSingle
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
Handle | INTEGER | RW
Height | INTEGER | RW
HideSelection | INTEGER | RW | False
Hint | STRING | RW
Images | QIMAGELIST | W
Indent | INTEGER | RW | 19
Item | ARRAY of TreeNodeType | RW
ItemCount | INTEGER | RW
ItemIndex | INTEGER | RW
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
ReadOnly | INTEGER | RW | False
ShowButtons | INTEGER | RW | True
ShowHint | INTEGER | RW | False
ShowLines | INTEGER | RW | True
ShowRoot | INTEGER | RW | True
SortType | INTEGER | RW | stText
StateImages | QIMAGELIST | W
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
TopIndex | INTEGER | RW
Width | INTEGER | RW
Visible | INTEGER | RW | True

QTreeView Methods
Method | Type | Description | Params
AddItems | SUBI | Add items to treeview | STRING, Infinite
AddChildItems | SUB (Index%, S1$, S2$, ...) | Add child item at Index% | Minimum 2
Clear | SUB | Clear all items in treeview | 0
Collapse | SUB (Index%, Recurse%) | Collapses node | 2
DelItems | SUBI | Delete items from treeview | INTEGER, Infinite
Expand | SUB (Index%, Recurse%) | Expand node, revealing its childs | 2
FullCollapse | SUB | Collapses all nodes | 0
FullExpand | SUB | Expands all nodes | 0
GetItemAt | FUNCTION (X%, Y%) AS LONG | Get the index node at X,Y | 2
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2
LoadFromFile | SUB (Filename AS STRING) | Load items from file | 1
SaveToFile | SUB (Filename AS STRING) | Save items to file | 1
Sort | SUB | Sort all items from A-Z | 0

QTreeView Events
Event | Type | Occurs when... | Params
OnClick | VOID | TreeView was clicked on | 0
OnChange | SUB (Index%) | Selection (not modification) has changed from one item to another | 1
OnChanging | SUB (Index%, AllowChange%) | Selection is about to be changed | 2
OnCollapse | SUB (Index%) | Just after a node has been collapsed | 1
OnCollapsing | SUB (Index%, AllowCollapse%) | A node is about to be collapsed | 2
OnDblClick | VOID | TreeView was double clicked on | 0
OnDeletion | SUB (Index%) | A node in the tree is deleted | 1
OnEdited | SUB (Index%, BYREF S$) | After the user edits a text of a node | 2
OnEditing | SUB (Index%, AllowEdit%) | The user starts to edit the text | 2
OnExpand | SUB (Index%) | After a node is expanded | 1
OnExpanding | SUB (Index%, AllowExpansion%) | A node is about to be expanded | 2
OnGetImageIndex | SUB (Index%) | The treeview looks up the ImageIndex of a node | 1
OnGetSelectedIndex | SUB (Index%) | The treeview looks up the SelectedIndex of a node | 1
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4

QTreeView Examples
'' Tree view example, hot tracking through items

SUB TreeViewChange (Node AS INTEGER, AllowChange AS INTEGER, Sender AS QTREEVIEW)
    IF Node = 8 THEN AllowChange = 0
END SUB

SUB TreeViewMouseMove (X AS INTEGER, Y AS INTEGER, Shift AS INTEGER, Sender AS QTREEVIEW)
    I = Sender.GetItemAt(X,Y)
    IF I >= 0 THEN Sender.ItemIndex = I
END SUB

CREATE Form AS QFORM
    Center
    CREATE TreeView AS QTREEVIEW
        Align = 5
        AddItems "1","2","3"
        AddChildItems 0, "Sub 1", "Sub 2", "Sub 3"
        AddChildItems 4, "Sub 1", "Sub 2", "Sub 3"
        FullExpand
        OnChanging = TreeViewChange
        OnMouseMove = TreeViewMouseMove
    END CREATE
END CREATE

'-- No real purpose, just change all items
FOR I = 0 TO TreeView.ItemCount-1
    TreeView.Item(I).Text = STR$(I)
NEXT

Form.ShowModal
D>


QDXSCREEN

Rapid-Q Documentation by William Yu (c)1999 QDXSCREEN

QDXSCREEN Component

QDXScreen allows you to create a DirectX screen for all your DXComponents. All operations are done on the off-screen buffer, so nothing is displayed until you flip to it. To use full screen mode, set FullScreen to true, and make sure your form border style is bsNone.

QDXScreen Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
AllowStretch | INTEGER | RW | True
AutoSize | INTEGER | RW | True
BitCount | INTEGER | RW | 8
Color | INTEGER | RW
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W
FullScreen | INTEGER | RW | False
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW
Parent | QFORM/QPANEL/QTABCONTROL | W
Pixel | 2D ARRAY of INTEGER | RW
ShowHint | INTEGER | RW | False
Top | INTEGER | RW
Use3D | INTEGER | RW | False
UseHardware | INTEGER | RW | True
Visible | INTEGER | RW | True
Width | INTEGER | RW

QDXScreen Methods
Method | Type | Description | Params
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3
Fill | SUB (DevCol%) | Fill screen (not traditional colors) | 1
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draw & Fill a rectangle | 5
Flip | SUB | Copies off-screen buffer to visible page | 0
Init | SUB (Width%, Height%) | Create Screen | 2
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel Plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
Release | SUB | Force update | 0
Rotate | SUB (xOrigin%, yOrigin%, Angle%) | Rotates entire screen at specified origin | 3
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text | 5
QDXScreen 3D Methods
Method | Type | Description | Params
AddLight | SUB (Light AS QD3DLight) | Add light to scene | 1
CameraLookAt | SUB (F AS QD3DFrame, Constraint AS INTEGER) | Fix frame and constrain rotation | 2
CreateFace | SUB (Face AS QD3DFace) | Creates a face | 1
CreateFrame | SUB (Frame AS QD3DFrame) | Creates frame | 1
CreateLightRGB | SUB (LightType%, R#, G#, B#, Light AS QD3DLight) | Create light object | 5
CreateMeshBuilder | SUB (MB AS QD3DMeshBuilder) | Creates meshbuilder | 1
CreateShadow | SUB (MB AS QD3DMeshBuilder, Light AS QD3DLight, px#, py#, pz#, nx#, ny#, nz#, V AS QD3DVisual) | Creates a visual shadow object | 9
CreateWrap | SUB (WrapType%, A#, B#, C#, D#, E#, F#, G#, H#, I#, J#, K#, L#, M#, W AS QD3DWrap) | Creates a wrap object | 15
ForceUpdate | SUB (X1%, Y1%, X2%, Y2%) | Force update on specific region | 4
LoadTexture | SUB (File AS STRING, Tex AS QD3DTexture) | Create a texture object | 2
Move | SUB (D AS DOUBLE) | Moves/animates scene | 1
SetBackgroundImage | SUB (Tex AS QD3DTexture) | Set background image for scene | 1
SetCameraPosition | SUB (X#, Y#, Z#) | Set camera position for entire scene | 3
SetCameraOrientation | SUB (DX#, DY#, DZ#, UX#, UY#, UZ#) | Set camera orientation for scene | 6
SetRenderMode | SUB (M AS INTEGER) | Set render mode for scene | 1
SetTextureQuality | SUB (Quality AS INTEGER) | Set texture quality for scene | 1

QDXScreen Events
Event | Type | Occurs when... | Params
OnClick | VOID | Mouse button clicked | 0
OnDblClick | VOID | Mouse button double clicked | 0
OnInitialize | VOID | DirectX succeeds in initializing | 0
OnInitializeSurface | VOID | Another event for you to do initializing | 0
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1
OnMouseDown | SUB (Button%, X%, Y%) | Mouse button held down | 3
OnMouseMove | SUB (X%, Y%) | Mouse moves | 2
OnMouseUp | SUB (Button%, X%, Y%) | Mouse button is released | 3

QDXScreen Examples
$APPTYPE GUI
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

DIM Form AS QForm
    Form.ClientHeight = 480
    Form.ClientWidth = 640
DIM Screen AS QDXScreen

Screen.Parent = Form
Screen.Init(640, 480)
Screen.Align = alClient

Form.ShowModal
Next Component


QDXIMAGELIST

Rapid-Q Documentation by William Yu (c)1999 QDXIMAGELIST

QDXIMAGELIST Component

QDXImageList maintains a list of images for use in your programs. Unlike QImageList, you must create the imagelist using an Image Library.

QDXImageList Properties
Field | Type | R/W | Default
Parent | QDXSCREEN | W

QDXImageList Methods
Method | Type | Description | Params
Draw | SUB (Item%, X%, Y%, Mask%) | Draw image on Screen | 4
LoadFromFile | SUB (FileName$) | Load imagelist | 1
LoadFromResource | SUB (Resource_Handle) | Load imagelist from resource handle | 1
LoadFromStream | SUB (Stream AS QFILESTREAM/QMEMORYSTREAM) | Load imagelist from stream | 1

QDXImageList Events
Event Type Occurs when... Params

QDXImageList Examples
' Target practise w/DirectX for Rapid-Q by William Yu
' Move using arrow keys, to shoot, press SPACEBAR

$APPTYPE GUI
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$RESOURCE ships_DXG AS "ships.dxg"

DECLARE SUB DXTimerExpired
DECLARE SUB InitStars
DECLARE SUB KeyDown (Key AS BYTE, Shift AS BYTE)

CONST ScreenX = 400
CONST ScreenY = 300
CONST MaxStars = 150        '' Depending on your system, adjust as needed.

TYPE StarType
  X(MaxStars) AS INTEGER
  Y(MaxStars) AS INTEGER
  Z(MaxStars) AS INTEGER
END TYPE

DIM DXTimer AS QDXTimer
    DXTimer.Enabled = True
    DXTimer.Interval = 10
    DXTimer.OnTimer = DXTimerExpired
DIM Stars AS StarType
DIM MyShipX AS INTEGER
    MyShipX = 50
DIM EnemyShipX AS INTEGER
    EnemyShipX = ScreenX + 45
DIM EnemyShipY AS INTEGER
    EnemyShipY = 20
DIM Shoot AS INTEGER, ShootX AS INTEGER, ShootY AS INTEGER
    Shoot = False
DIM Hit AS INTEGER, HitCount AS INTEGER
    Hit = False

InitStars

CREATE Form AS QForm
  Center
  Caption = "DirectX Target Practise"
  ClientWidth = ScreenX
  ClientHeight = ScreenY
  'BorderStyle = bsNone           '' Setup fullscreen
  CREATE DXScreen AS QDXScreen
    Init(ScreenX, ScreenY)
    Align = alClient
    'FullScreen = True            '' Fullscreen mode
    Cursor = crNone              '' Hide Mouse
    CREATE DXImageList AS QDXImageList
      LoadFromResource(SHIPS_DXG)
    END CREATE
  END CREATE
  OnKeyDown = KeyDown
  ShowModal
END CREATE

SUB KeyDown (Key AS BYTE, Shift AS BYTE)
  SELECT CASE Key
    CASE 27
      Form.Close
    CASE 39
      MyShipX = MyShipX + 4
    CASE 37
      MyShipX = MyShipX - 4
    CASE IS = 32 AND Shoot = False
      Shoot = True
      ShootX = MyShipX + 20
      ShootY = ScreenY - 58
  END SELECT
END SUB

SUB InitStars
  DIM I AS INTEGER

  RANDOMIZE TIMER

  FOR I = 1 TO MaxStars
    Stars.X(I) = RND(ScreenX)
    Stars.Y(I) = RND(ScreenY)
    Stars.Z(I) = RND(3)
  NEXT I
END SUB

SUB DXTimerExpired
  DIM I AS INTEGER

  DXScreen.Fill(0)
  FOR I = 1 TO MaxStars
    SELECT CASE Stars.Z(I)
      CASE 0
        DXScreen.Pixel(Stars.X(I),Stars.Y(I)) = clWhite
        Stars.Y(I) = Stars.Y(I) + 3
      CASE 1
        DXScreen.Pixel(Stars.X(I),Stars.Y(I)) = &HAAAAAA
        Stars.Y(I) = Stars.Y(I) + 2
      CASE ELSE
        DXScreen.Pixel(Stars.X(I),Stars.Y(I)) = &H555555
        Stars.Y(I) = Stars.Y(I) + 1
    END SELECT
    IF Stars.Y(I) > ScreenY THEN
      Stars.Y(I) = -1
      Stars.X(I) = RND(ScreenX)
    END IF
  NEXT I
  DXScreen.TextOut(10,10,"FPS: "+STR$(DXTimer.FrameRate), clWhite, -1)
  IF Hit THEN
    DXScreen.Circle(ShootX-HitCount/2,ShootY-20,ShootX+4+HitCount/2,ShootY-20+4+HitCount,&H2090FF,&H2090FF)
    IF HitCount = 0 THEN
      Hit = False
    ELSE
      HitCount = HitCount - 2
    END IF
  ELSE
    IF Shoot THEN
      SELECT CASE ShootX
        CASE EnemyShipX TO EnemyShipX+45
          IF ShootY > EnemyShipY AND ShootY < EnemyShipY+45 THEN
            EnemyShipX = ScreenX + 45
            EnemyShipY = EnemyShipY + 45
            Shoot = False
            Hit = True
            HitCount = 40
          END IF
      END SELECT
      DXScreen.Circle(ShootX,ShootY,ShootX+4,ShootY+4,&H2090FF,&H2090FF)
      IF ShootY < -4 THEN
         Shoot = False
      ELSE
         ShootY = ShootY - 4
      END IF
    END IF
    EnemyShipX = EnemyShipX - 2
    DXImageList.Draw(1, EnemyShipX, EnemyShipY, 0)
    IF EnemyShipX < -45 THEN
      EnemyShipX = ScreenX + 45
      EnemyShipY = EnemyShipY + 45
    END IF
  END IF
  DXImageList.Draw(0, MyShipX, ScreenY - 55, 0)
  DXScreen.Flip
END SUB
D>


QDXSOUND

Rapid-Q Documentation by William Yu (c)1999-2000 QDXSOUND

QDXSOUND Component

QDXSound implements DirectSound.

QDXSound Properties
Field | Type | R/W | Default
AutoUpdate | INTEGER | RW | True
AutoUpdate determines whether to let the internal thread update the sound buffer every 50ms, or let the programmer control the updates.
BufferLength | INTEGER | RW | 1000
BufferLength specifies how many bytes to read into the buffer for playing. For heavy computations or deeply nested loops, it's a good idea to extend the BufferLength so that the music can play uninterrupted.
FileName | STRING | RW
FileName specifies the .WAV file.
Frequency | INTEGER | RW
Frequency specifies the reproduction frequency. Do not set the frequency before loading a file, since a default frequency for the .WAV file will be given to you when you load a new sound file.
Looped | INTEGER | RW | False
Looped specifies whether to replay the sound file after it has finished playing.
Pan | INTEGER | RW | 0
Pan specifies the relative volume of the right and left channels within the range from -100 to 100. A value of -100 mutes the right channel, and a value of 100 mutes the left channel.
Parent | QFORM | W
Playing | INTEGER | R
Playing determines whether the sound file is currently playing.
Position | INTEGER | RW
Use Position to set/get the current playing position of the sound file.
Size | INTEGER | R
Size returns the file size of the .WAV file in bytes.
StickyFocus | INTEGER | RW | False
StickyFocus determines whether to keep playing even if the application loses focus.
Tag | INTEGER | RW
Tag is not used internally, it is reserved storage space for the programmer.
Volume | INTEGER | RW
Volume specifies the output volume for the current sound as a percentage. Setting volume to 0 mutes the sound, while setting volume to 100 plays the sound with "normal volume" (ie. your current sound settings for your computer).

QDXSound Methods
Method | Type | Description | Params
Play | SUB | Start playing sound | 0
Stop | SUB | Stop playing sound | 0
Update | SUB | Update sound buffer | 0

QDXSound Events
Event Type Occurs when... Params

QDXSound Examples
'-- DirectSound example for Rapid-Q by William Yu

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

DECLARE SUB exitItemClick (sender AS QMENUITEM)
DECLARE SUB openItemClick (sender AS QMENUITEM)
DECLARE SUB formShow (sender AS QFORM)
DECLARE SUB playButtonClick (sender AS QBUTTON)
DECLARE SUB stopButtonClick (sender AS QBUTTON)
DECLARE SUB positionTrackBarChange (sender AS QTRACKBAR)
DECLARE SUB freqTrackBarChange (sender AS QTRACKBAR)
DECLARE SUB volumeTrackBarChange (sender AS QTRACKBAR)
DECLARE SUB panTrackBarChange (sender AS QTRACKBAR)

CREATE form AS QFORM
    width = 360
    height = 300
    center
    CREATE dxSound AS QDXSOUND
    END CREATE
    CREATE mainMenu AS QMAINMENU
        CREATE fileMenu AS QMENUITEM
            caption = "&File"
            CREATE openItem AS QMENUITEM
                caption = "&Open..."
                onClick = openItemClick
            END CREATE
            CREATE breakItem1 AS QMENUITEM
                caption = "-"
            END CREATE
            CREATE exitItem AS QMENUITEM
                caption = "E&xit"
                onClick = exitItemClick
            END CREATE
        END CREATE
    END CREATE
    CREATE panTrackBar AS QTRACKBAR
        left = 10
        top = 10
        width = 200
        height = 30
        tickStyle = tsManual
        min = -100
        max = 100
        onChange = panTrackBarChange
        enabled = FALSE
    END CREATE
    CREATE panLabel AS QLABEL
        left = 215
        top = 20
        caption = "Pan 0dB"
    END CREATE
    CREATE volumeTrackBar AS QTRACKBAR
        left = 10
        top = 60
        width = 200
        height = 30
        tickStyle = tsManual
        min = 0
        max = 100
        position = 100
        onChange = volumeTrackBarChange
        enabled = FALSE
    END CREATE
    CREATE volumeLabel AS QLABEL
        left = 215
        top = 70
        caption = "Volume 100%"
    END CREATE
    CREATE freqTrackBar AS QTRACKBAR
        left = 10
        top = 110
        width = 200
        height = 30
        tickStyle = tsManual
        max = 44100
        position = 22050
        min = 0
        onChange = freqTrackBarChange
        enabled = FALSE
    END CREATE
    CREATE freqLabel AS QLABEL
        left = 215
        top = 120
        caption = "Frequency 22050Hz"
    END CREATE
    CREATE positionTrackBar AS QTRACKBAR
        left = 10
        top = 160
        width = 200
        height = 30
        tickStyle = tsManual
        onChange = positionTrackBarChange
        enabled = FALSE
    END CREATE
    CREATE positionLabel AS QLABEL
        left = 215
        top = 170
        caption = "Position 0 / 0"
    END CREATE
    CREATE playButton AS QBUTTON
        left = 30
        top = 210
        caption = "&Play"
        enabled = FALSE
        onClick = playButtonClick
    END CREATE
    CREATE stopButton AS QBUTTON
        left = 110
        top = 210
        caption = "&Stop"
        enabled = FALSE
        onClick = stopButtonClick
    END CREATE
    onShow = formShow
    showModal
END CREATE

SUB formShow (sender AS QFORM)
    panTrackBar.setTick(0)
    volumeTrackBar.setTick(50)
    freqTrackBar.setTick(22050)
    dxSound.looped = FALSE
END SUB

SUB exitItemClick (sender AS QMENUITEM)
    form.close
END SUB

SUB openItemClick (sender AS QMENUITEM)
    DIM openDialog AS QOPENDIALOG

    openDialog.filter = "*.wav|*.wav"
    IF openDialog.execute THEN
        dxSound.fileName = openDialog.fileName
        panTrackBar.enabled = TRUE
        volumeTrackBar.enabled = TRUE
        freqTrackBar.enabled = TRUE
        positionTrackBar.enabled = TRUE
        playButton.enabled = TRUE
        stopButton.enabled = TRUE
        positionTrackBar.position = 0
        positionTrackBar.max = dxSound.size
        freqTrackBar.position = dxSound.frequency
        freqTrackBarChange(freqTrackBar)
        positionTrackBarChange(positionTrackBar)
    END IF
END SUB

SUB playButtonClick (sender AS QBUTTON)
    dxSound.play
    WHILE dxSound.playing
        doEvents
        positionTrackBar.position = dxSound.position
        positionLabel.caption = "Position "+STR$(positionTrackBar.position)+" / "+STR$(dxSound.size)
    WEND
END SUB

SUB stopButtonClick (sender AS QBUTTON)
    dxSound.stop
    dxSound.position = 0
    positionTrackBar.position = 0
END SUB

SUB positionTrackBarChange (sender AS QTRACKBAR)
    dxSound.position = sender.position
    positionLabel.caption = "Position "+STR$(sender.position)+" / "+STR$(dxSound.size)
END SUB

SUB freqTrackBarChange (sender AS QTRACKBAR)
    dxSound.frequency = sender.position
    freqLabel.caption = "Frequency "+STR$(sender.position)+"Hz"
END SUB

SUB volumeTrackBarChange (sender AS QTRACKBAR)
    dxSound.volume = sender.position
    volumeLabel.caption = "Volume "+STR$(sender.position)+"%"
END SUB

SUB panTrackBarChange (sender AS QTRACKBAR)
    dxSound.pan = sender.position
    panLabel.caption = "Pan "+STR$(sender.position)+"dB"
END SUB
D>


QDXTIMER

Rapid-Q Documentation by William Yu (c)1999 QDXTIMER

QDXTIMER Component

QDXTimer is a high precision timer for DirectX. It has automatic frame adjustments.

QDXTimer Properties
Field | Type | R/W | Default
ActiveOnly | INTEGER | RW | True
Enabled | INTEGER | RW | False
FrameRate | INTEGER | R
Interval | INTEGER | RW

QDXTimer Methods
Method Type Description Params

QDXTimer Events
Event | Type | Occurs when... | Params
OnTimer | VOID | Timer expired | 0

QDXTimer Examples
See DIRECTX.BAS example
D>


QD3DFACE

Rapid-Q Documentation by William Yu (c)1999 QD3DFACE

QD3DFACE Component

QD3DFace implements IDirect3DRMFace.

QD3DFace Properties
Field | Type | R/W | Default
VertexCount | INTEGER | R

QD3DFace Methods
Method | Type | Description | Params
AddVertex | SUB (X#, Y#, Z#) | Add a vertex | 3
GetVertex | SUB (Index AS LONG, Position AS QD3DVector, Normal AS QD3DVector) | Retrieve the position and normal of a vertex | 3
SetColorRGB | SUB (R#, G#, B#) | Set face color | 3

QD3DFace Events
Event Type Occurs when... Params

QD3DFace Examples
' Direct 3D construction using Faces

$TYPECHECK ON

CONST alClient = 5

'-- Light Types
CONST D3DRMLIGHT_AMBIENT = 0
CONST D3DRMLIGHT_POINT = 1
CONST D3DRMLIGHT_SPOT = 2
CONST D3DRMLIGHT_DIRECTIONAL = 3
CONST D3DRMLIGHT_PARALLELPOINT = 4

'-- Renderer modes
CONST D3DRMRENDERMODE_BLENDEDTRANSPARENCY = 1
CONST D3DRMRENDERMODE_SORTEDTRANSPARENCY = 2
CONST D3DRMRENDERMODE_LIGHTINMODELSPACE = 8
CONST D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR = 16
CONST D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE = 32

DECLARE SUB DXInitialize(Sender AS QDXScreen)
DECLARE SUB DXInitializeSurface(Sender AS QDXScreen)
DECLARE SUB DXTimerExpired

DIM DXTimer AS QDXTimer
    DXTimer.Enabled = 1
    DXTimer.Interval = 0
    DXTimer.Activeonly = 0
    DXTimer.OnTimer = DXTimerExpired
DIM MeshBuilder AS QD3DMeshBuilder
DIM MeshFrame AS QD3DFrame

CREATE Form AS QForm
    Caption = "Direct 3D Example"
    Width = 640
    Height = 480
    Center
    CREATE DXScreen AS QDXScreen
        Init(640,480)
        Align = alClient
        BitCount = 16
        Use3D = 1
        UseHardware = 0        '' This is for non-3D accelerated video cards.
                               '' 3D will be emulated using software, which
                               '' is much slower.
        OnInitialize = DXInitialize
        OnInitializeSurface = DXInitializeSurface
    END CREATE
    ShowModal
END CREATE

SUB DXInitialize(Sender AS QDXScreen)
   DIM Light AS QD3DLight, Ambient AS QD3DLight
   DIM LightFrame AS QD3DFrame
   DIM Face AS QD3DFace

   DXScreen.CreateFrame(LightFrame)
   DXScreen.CreateFrame(MeshFrame)

   DXScreen.CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, 0.9, 0.9, 0.9, Light)
   LightFrame.AddLight(Light)

   DXScreen.CreateLightRGB(D3DRMLIGHT_AMBIENT, 0.6, 0.6, 0.6, Ambient)
   DXScreen.AddLight(Ambient)

   LightFrame.SetPosition(2, 0, 22)
   DXScreen.SetCameraPosition(-5, 10, 0)

   MeshFrame.AddLight(Ambient)
   MeshFrame.SetPosition(0, 0, 0)
   MeshFrame.SetRotation(0, 0, 0, 0.05)       ' Angle of rotation = 0.05

   DXScreen.CreateMeshBuilder(MeshBuilder)
   DXScreen.CreateFace(Face)

   Face.AddVertex(0.996094,1.000000,-0.995850)
   Face.AddVertex(-0.995850,1.000000,-0.995850)
   Face.AddVertex(-0.995850,1.000000,0.996094)
   Face.AddVertex(0.996094,1.000000,0.996094)
   Face.AddVertex(0.996094,-0.999756,-0.995850)
   Face.AddVertex(-0.995850,-0.999756,-0.995850)
   Face.AddVertex(-0.995850,-0.999756,0.996094)
   Face.AddVertex(0.996094,-0.999756,0.996094)

   MeshBuilder.AddFace(Face)

   MeshBuilder.Scale(2,2,2)
   MeshBuilder.SetRGB(1, 1, .7)
   MeshFrame.AddVisual(MeshBuilder)
   DXScreen.CameraLookAt(MeshFrame, 1)
END SUB

SUB DXInitializeSurface(Sender AS QDXScreen)
   DXScreen.SetRenderMode(D3DRMRENDERMODE_BLENDEDTRANSPARENCY OR D3DRMRENDERMODE_SORTEDTRANSPARENCY)
END SUB

SUB DXTimerExpired
   DXScreen.ForceUpdate(0,0,50,40)     ' Update FPS text only
   DXScreen.Move(1)                    ' This does the rotation by 2 times
   DXScreen.Render
   DXScreen.TextOut(10,10,"FPS: "+STR$(DXTimer.FrameRate), &HFFFFFF, -1)
   DXScreen.Flip
END SUB
D>


QD3DFRAME

Rapid-Q Documentation by William Yu (c)1999 QD3DFRAME

QD3DFRAME Component

QD3DFrame implements IDirect3DRMFrame.

QD3DFrame Properties
Field | Type | R/W | Default
FogColor | INTEGER | RW
FogEnabled | INTEGER | RW
FogMode | INTEGER | RW

QD3DFrame Methods
Method | Type | Description | Params
AddFrame | SUB (Frame AS QD3DFrame) | Add a frame to this frame | 1
AddLight | SUB (Light AS QD3DLight) | Add light object to frame | 1
AddScale | SUB (CombineType%, X#, Y#, Z#) | Add scale | 4
AddVisual | SUB (Visual AS QD3DMeshBuilder/QD3DMesh/QD3DVisual) | Add visual object to frame | 1
CreateFrame | SUB (Frame AS QD3DFrame) | Create frame relative to this | 1
DeleteFrame | SUB (Frame AS QD3DFrame) | Removes a frame from hierarchy | 1
DeleteLight | SUB (Light AS QD3DLight) | Removes light object from frame | 1
DeleteVisual | SUB (Visual AS QD3DMeshBuilder/QD3DMesh/QD3DVisual) | Removes visual object from frame | 1
Load | SUB (FileName AS STRING) | Load a frame from .X file | 1
LookAt | SUB (F AS QD3DFrame, Constraint AS INTEGER) | Fix frame and constrain rotation | 2
Move | SUB (D AS DOUBLE) | Moves frame (rotate) | 1
SetBackgroundImage | SUB (Texture AS QD3DTexture) | Add texture to frame | 1
SetBackgroundRGB | SUB (R#, G#, B#) | Set background color | 3
SetFogParams | SUB (Start#, End#, Density#) | Set fog parameters | 3
SetOrientation | SUB (DX#, DY#, DZ#, UX#, UY#, UZ#) | Set orientation of frame | 6
SetPosition | SUB (X#, Y#, Z#) | Set viewing position of frame | 3
SetRotation | SUB (X#, Y#, Z#, Theta#) | Set rotation relative to X,Y,Z | 4
SetTexture | SUB (Tex AS QD3DTexture) | Add texture backdrop to frame | 1

QD3DFrame Events
Event Type Occurs when... Params

QD3DFrame Examples
D>


QD3DLIGHT

Rapid-Q Documentation by William Yu (c)1999 QD3DLIGHT

QD3DLIGHT Component

QD3DLight implements IDirect3DRMLight.

QD3DLight Properties
Field Type R/W Default

QD3DLight Methods
Method | Type | Description | Params
SetLightRGB | SUB (LightType%, R#, G#, B#) | Set lighting type and color | 4
SetPenUmbra | SUB (Angle#) | Set light of outer cone | 1
SetRange | SUB (Range#) | Set range of light | 1
SetUmbra | SUB (Angle#) | Set light of inner cone | 1

QD3DLight Events
Event Type Occurs when... Params

QD3DLight Examples
D>


QD3DMESH

Rapid-Q Documentation by William Yu (c)1999 QD3DMESH

QD3DMESH Component

QD3DMesh implements IDirect3DRMMesh.

QD3DMesh Properties
Field | Type | R/W | Default
MaxY | SINGLE | R
MinY | SINGLE | R

QD3DMesh Methods
Method Type Description Params

QD3DMesh Events
Event Type Occurs when... Params

QD3DMesh Examples
D>


QD3DMESHBUILDER

Rapid-Q Documentation by William Yu (c)1999 QD3DMESHBUILDER

QD3DMESHBUILDER Component

QD3DMeshBuilder implements IDirect3DRMMeshBuilder.

QD3DMeshBuilder Properties
Field | Type | R/W | Default
FaceCount | INTEGER | R

QD3DMeshBuilder Methods
Method | Type | Description | Params
AddFace | SUB (Face AS QD3DFace) | Add a face to mesh object | 1
AddVertex | SUB (X#, Y#, Z#) | Add a vertex | 3
CreateFace | SUB (Face AS QD3DFace) | Creates a new face with no vertices | 1
CreateMesh | SUB (Mesh AS QD3DMesh) | Create mesh from meshbuilder | 1
DeleteFace | SUB (Face AS QD3DFace) | Delete face from meshbuilder | 1
GetFace | SUB (Index AS LONG, Face AS QD3DFace) | Get a single mesh face | 2
Load | SUB (S AS STRING) | Load an object file (.x file) | 1
Move | SUB (D AS DOUBLE) | Moves frame (rotate) | 1
Scale | SUB (X#,Y#,Z#) | Scale object | 3
SetQuality | SUB (Quality AS INTEGER) | Set rendering quality | 1
SetRGB | SUB (R#, G#, B#) | Set object's color | 3
SetRGBA | SUB (R#, G#, B#, A#) | Add color w/alphablending | 4
SetTexture | SUB (Tex AS QD3DTexture) | Add texture backdrop to object | 1
Translate | SUB (TX#, TY#, TZ#) | Translate is a move operation but in 3D | 3

QD3DMeshBuilder Events
Event Type Occurs when... Params

QD3DMeshBuilder Examples
D>


QD3DTEXTURE

Rapid-Q Documentation by William Yu (c)1999 QD3DTEXTURE

QD3DTEXTURE Component

QD3DTexture implements IDirect3DRMTexture.

QD3DTexture Properties
Field Type R/W Default

QD3DTexture Methods
Method Type Description Params

QD3DTexture Events
Event Type Occurs when... Params

QD3DTexture Examples
D>


QD3DVECTOR

Rapid-Q Documentation by William Yu (c)1999 QD3DVECTOR

QD3DVECTOR Component

QD3DVector implements D3DVector.

QD3DVector Properties
Field | Type | R/W | Default
DVX | SINGLE | RW
DVY | SINGLE | RW
DVZ | SINGLE | RW
X | SINGLE | RW
Y | SINGLE | RW
Z | SINGLE | RW

QD3DVector Methods
Method Type Description Params

QD3DVector Events
Event Type Occurs when... Params

QD3DVector Examples
D>


QD3DVISUAL

Rapid-Q Documentation by William Yu (c)1999 QD3DVISUAL

QD3DVISUAL Component

QD3DVisual implements IDirect3DRMVisual.

QD3DVisual Properties
Field Type R/W Default

QD3DVisual Methods
Method Type Description Params

QD3DVisual Events
Event Type Occurs when... Params

QD3DVisual Examples
D>


QD3DWRAP

Rapid-Q Documentation by William Yu (c)1999 QD3DWRAP

QD3DWRAP Component

QD3DWrap implements IDirect3DRMWrap.

QD3DWrap Properties
Field Type R/W Default

QD3DWrap Methods
Method | Type | Description | Params
Apply | SUB (M AS QD3DMesh/QD3DMeshBuilder) | Apply wrap to mesh | 1
ApplyRelative | SUB (F AS QD3DFrame, M AS QD3DMesh/QD3DMeshBuilder) | Apply wrap relative to frame | 2

QD3DWrap Events
Event Type Occurs when... Params

QD3DWrap Examples
D>


Appendix A: QPANEL

based on Rapid-Q Documentation by William Yu (c)1999 Custom components: QBEVEL

QBevel Component

Qbevel implements a generic container for your components.

This component duplicates the Delphi TBevel.
' Not an entirely revolutionary thing, but as with most of my components, something to save
' time and coding. Play around with the combo boxes to see the effects. Rather simple
' actually, only two new properties: Shape and Style. I think you'll find them pretty self- explanatory...
' psyclops420 <psyclops420@yahoo.com>

QBevel Properties (QBEVEL EXTENDS QPANEL)

Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Alignment | INTEGER | RW | taCenter | W
'Style
CONST bsLowered = 0
CONST bsRaised = 1
'Shape'
CONST bsSpacer = 0
CONST bsBox = 1
CONST bsTopLine = 2
CONST bsBottomLine = 3
CONST bsLeftLine = 4
CONST bsRightLine = 5
CONST bsFrame = 6
BevelInner | INTEGER | RW | bvNone | W
BevelOuter | INTEGER | RW | bvRaised | W
BevelWidth | INTEGER | RW | 1 | W
BorderStyle | INTEGER | RW | bsNone | W
'-- Bevel Style
CONST bvNone = 0
CONST bvLowered = 1
CONST bvRaised = 2

'-- Bevel Border
CONST bpNone = 0 '-- No visible border
CONST bpSingle = 1 '-- Single-line border
Caption | STRING | RW | W
ClientHeight | INTEGER | RW | WX
ClientWidth | INTEGER | RW | WX
Color | INTEGER | RW | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WX
Font | QFONT | W | W
Height | INTEGER | RW | WX
Hint | STRING | RW | W
Left | INTEGER | RW | 0 | WX
Parent | QFORM/Qbevel/QTABCONTROL | W | WX
ShowHint | INTEGER | RW | False | W
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WX
Width | INTEGER | RW | WX
Visible | INTEGER | RW | True | WX

Qbevel Methods
Method | Type | Description | Params | Support
Repaint | SUB | Refreshes panel and all contents | 0 | W

Qbevel Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on open area of panel | 0 | WX
OnDblClick | VOID | User double clicked panel | 0 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | W
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves over panel | 3 | W
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | W

Qbevel Examples

'=================================================
'        Sample program
'=================================================

DECLARE SUB ChangeStyle
DECLARE SUB ChangeShape

CREATE Form AS QFORM
    CREATE Menu AS QMAINMENU
        CREATE Item AS QMENUITEM
            Caption = "Menu"
        END CREATE
    END CREATE
    CREATE ToolBar AS QBEVEL
        Align = 1
        Height = 50
        Shape = bsTopLine
        Caption = "ToolBar"
    END CREATE
    CREATE Bevel AS QBEVEL
        Top = 80
        Left = 30
        Width = 130
        Height = 30
        color=&h0000ff
        font.color=&hffffff
        caption="Bevel"
        BevelWidth=9
    END CREATE
    CREATE Style AS QCOMBOBOX
        Top = 150
        Left = 10
        AddItems "bsLowered", "bsRaised"
        ItemIndex = 0
        OnChange = ChangeStyle
    END CREATE
    CREATE Shape AS QCOMBOBOX
        Top = 150
        Left = 160
        AddItems "bsSpacer", "bsBox", "bsTopLine", "bsBottomLine", "bsLeftLine", "bsRightLine", "bsFrame"
        ItemIndex = 0
        OnChange = ChangeShape
    END CREATE
END CREATE

Form.ShowModal

SUB ChangeStyle
    Bevel.Style = Style.ItemIndex
END SUB

SUB ChangeShape
    Bevel.Shape = Shape.ItemIndex
END SUB


Appendix A: QBitmapEx

Documentation component by D.Glodt (c)2000-2004 Appendix A: QBitmapEx

QBitmapEx Component

QBitmapEx is a control as a QBitmap with extensions of méthods.
The loading of other graphic formats as well as the storage to Jpg format are possible

if the DLL Nviewlib is present in the system window or the directory of application.

QBitmapEx Properties
Field | Type | R/W | Default
PenSize | Long | RW | 1
 | Pen size for draw line,rectangle and circle | RW |
PenStyle | Long | RW | PS_SOLID_BMP
 | Pen style , the others values are: PS_SOLID_BMP=0 PS_DASH_BMP=1 PS_DOT_BMP=2 PS_DASHDOT_BMP=3 PS_DASHDOTDOT_BMP=4 PS_NULL_BMP=5 PS_INSIDEFRAME_BMP=6 |  |

QBitmapEx Methods
Method | Type | Description | Params
DrawIco | SUB(left%,top%,width%,height%,handle%) | Draw an icon | 3
 | If the width and height parameters are 0,the icon will show with his dimensions by défault. |  |
CopyToClipboard | SUB | Copy image to clipboard | 0
PasteFromClipboard | SUB(x%,y%) | Paste the image of clipboard | 2
GetWidthClipboard | FUNCTION as INTEGER | Return the image width of clipboard | 0
GetHeightClipboard | FUNCTION as INTEGER | Return the image height of clipboard | 0
CanPaste | FUNCTON as BOOLEAN | Return true if image présent in the clipboard | 0
Circle | SUB(x1%,y1%,x2%,y2%,c%) | Draw a circle | 5
CircleFilled | SUB(x1%,y1%,x2%,y2%,c%,Fill%) | Draw a circle filled | 6
Rectangle | SUB(x1%,y1%,x2%,y2%,c%) | Draw a rectangle | 5
RectangleFilled | SUB(x1%,y1%,x2%,y2%,c%,Fill%) | Draw a rectangle filled | 6
RoundRect | SUB(x1%,y1%,x2%,y2%,x3%,y3%,c%) | Draw a round rectangle | 7
RoundRectFilled | SUB(x1%,y1%,x2%,y2%,x3%,y3%,c%,Fill%) | Draw a round rectangle filled | 8
Line | SUB(x1%,y1%,x2%,y2%,c%) | Draw a line | 5
FillSurface | SUB(x%,y%,c%) | Fill the surface pointed by the color of pixel x,y | 3
TextOut | SUB(x%,y%,s$,fc%,bc%) | Draw text | 5
InvertColor | SUB(x%,y%,width%,height%) | Invert color | 4
Mirror | SUB(x%,y%,width%,height%) | Make a miror x | 4
Flip | SUB(x%,y%,width%,height%) | Make a miror y | 4
LoadOtherImage | SUB(FileName$,Progress&,Language$) | Load image from dll Nviewlib format | 3
 | The parameter progress is use to display a bar of progression during the loading of file.(true or false) The Language parameter corresponds to the language supported by DLL |  |
SaveAsJpg | SUB(FileName$,Quality&) | Save image to jpg format | 2
 | The Quality parameter corresponds to the storage quality. |  |

QBitmapEx Events
Event | Type | Occurs when... | Params

QBitmapEx Example


Appendix A: QCanvasEx

Documentation component by D.Glodt (c)2000-2002 Appendix A: QCanvasEx

QCanvasEx Component

QCanvasEx is a control as a Qcanvas with extensions of properties and méthods.

QCanvasEx Properties
Field | Type | R/W | Default
MixMode | Long | RW | R2_COPYPEN_CAN
 | Set the foreground mix mode The differents values are: R2_BLACK_CAN=1 R2_NOTMERGEPEN_CAN=2 R2_MASKNOTPEN_CAN=3 R2_NOTCOPYPEN_CAN=4 R2_MASKPENNOT_CAN=5 R2_NOT_CAN=6 R2_XORPEN_CAN=7 R2_NOTMASKPEN_CAN=8 R2_MASKPEN_CAN=9 R2_NOTXORPEN_CAN=10 R2_NOP_CAN=11 R2_MERGENOTPEN_CAN=12 R2_COPYPEN_CAN=13 R2_MERGEPENNOT_CAN=14 R2_MERGEPEN_CAN=15 R2_WHITE_CAN=16 |  |
PenSize | Long | RW | 1
 | Pen size for draw line,rectangle and circle | RW |
PenStyle | Long | RW | PS_SOLID_CAN
 | Pen style , the others values are: PS_SOLID_CAN=0 PS_DASH_CAN=1 PS_DOT_CAN=2 PS_DASHDOT_CAN=3 PS_DASHDOTDOT_CAN=4 PS_NULL_CAN=5 PS_INSIDEFRAME_CAN=6 |  |

QCanvasEx Methods
Method | Type | Description | Params
DrawIco | SUB(left%,top%,width%,height%,handle%) | Draw an icon | 3
 | If parameters width and height are 0,the icon will show with his dimensions by défault. |  |
CopyToClipboard | SUB(rect as QRECT) | Copy the image in the clipboard | 1
PasteFromClipboard | SUB(x%,y%) | Paste the image from clipboard | 2
GetWidthClipboard | FUNCTION as INTEGER | Return the image wiith from clipboard | 0
GetHeightClipboard | FUNCTION as INTEGER | Return the image height from clipboard | 0
CanPaste | FUNCTON as BOOLEAN | Return true if image présent in the clipboard | 0
Circle | SUB(x1%,y1%,x2%,y2%,c%) | Draw a circle | 5
CircleFilled | SUB(x1%,y1%,x2%,y2%,c%,Fill%) | Draw a circle filled | 6
Rectangle | SUB(x1%,y1%,x2%,y2%,c%) | Draw a rectangle | 5
RectangleFilled | SUB(x1%,y1%,x2%,y2%,c%,Fill%) | Draw a rectangle filled | 6
RoundRect | SUB(x1%,y1%,x2%,y2%,x3%,y3%,c%) | Draw a round rectangle | 7
RoundRectFilled | SUB(x1%,y1%,x2%,y2%,x3%,y3%,c%,Fill%) | Draw a round rectangle filled | 8
Line | SUB(x1%,y1%,x2%,y2%,c%) | Draw a line | 5
FillSurface | SUB(x%,y%,c%) | Fill the surface pointed by the color of pixel x,y | 3
TextOut | SUB(x%,y%,s$,fc%,bc%) | Draw text | 5
InvertColor | SUB(x%,y%,width%,height%) | Invert color | 4
Mirror | SUB(x%,y%,width%,height%) | Make a miror x | 4
Flip | SUB(x%,y%,width%,height%) | Make a miror y | 4

QCanvasEx Events
Event | Type | Occurs when... | Params

QCanvasEx Example 1

 $typecheck on
 $INCLUDE "Rapidq.inc"
 $INCLUDE "Object\QCanvasEx.inc"
 declare sub OuvrirClick
 declare sub FermerClick
 declare sub QuitterClick
 declare sub Copier
 declare sub Coller
 declare sub Present
 const title="Viewer picture"
 dim bitmap as QBITMAP
 dim source as QRECT
 CREATE Form AS QFORM
   Caption =title
   Width = 600
   Height = 600
   Center
   CREATE Menu AS QMAINMENU
     CREATE item1 AS QMENUITEM
       Caption="&Fichier"
       CREATE item2 AS QMENUITEM
         Caption="&Ouvrir"
         OnClick=OuvrirClick
       END CREATE
       CREATE item4 AS QMENUITEM
         Caption="&Fermer"
         OnClick=FermerClick
       END CREATE
       CREATE item5 AS QMENUITEM
         Caption="-"
       END CREATE
       CREATE item6 AS QMENUITEM
         Caption="&Quitter"
         OnClick=QuitterClick
       END CREATE
     END CREATE
     CREATE item11 as QMENUITEM
       Caption="&Edition"
       OnClick=Present
       CREATE item12 as QMENUITEM
         Caption="&Copier"
         OnClick=Copier
       END CREATE
       CREATE item13 as QMENUITEM
         Caption="&Coller"
         OnClick=Coller
         Enabled=false
        END CREATE
      END CREATE
    END CREATE
    CREATE ScrollBox1 AS QSCROLLBOX
      AutoScroll = 1
      Align=5
      Color = &HFFFFFF
      CREATE image AS QCanvasEx
        width=1000
        height=1000
      END CREATE
    END CREATE
  END CREATE
  bitmap.PixelFormat=6
  Form.ShowModal

  sub OuvrirClick
    dim file as QOPENDIALOG

    file.Filter="Fichiers bitmap(*.bmp)|*.bmp"
    file.InitialDir=CurDir$
    if file.Execute then
      bitmap.Bmp=file.FileName
      image.draw(0,0,bitmap.bmp)
      Form.Caption=title+"-"+file.FileName
    end if
  end sub

  sub FermerClick
     image.repaint
     Form.Caption=title
  end sub

  sub QuitterClick
    Form.Close
  end sub

  sub Copier
    source.left=0
    source.top=0
    source.right=bitmap.width
    source.bottom=bitmap.height
    image.copyToClipboard(source)
  end sub

  sub coller
    image.pasteFromClipboard(20,20)
    form.caption=str$(image.GetWidthClipboard)+"*"+str$(image.GetHeightClipboard)
  end sub

  Sub Present
    if image.canpaste then
      item13.enabled=true
    else
      item13.enabled=false
    end if
  End Sub
QCanvasEx Example 2
$typecheck on
$INCLUDE "Rapidq.inc"
$Include "Object\QCanvasEx.inc"
$INCLUDE "OBJECT\QCOLORDIALOG.INC"

declare sub selectdrawing(sender as qmenuitem)
declare sub selectSize(sender as qmenuitem)
declare sub move(x as integer,y as integer)
declare sub start(bt as integer,x as integer,y as integer)
declare sub stop
declare sub ResetMenuDrawing
declare sub ResetMenuSize
declare sub SelectPenColor
declare sub SelectBackColor
declare sub New
declare sub Quit

dim TypeDraw as integer
TypeDraw=1
dim flag as integer
dim orx as integer
dim ory as integer
dim ox as integer
dim oy as integer
dim pencolor as long
dim backcolor as long
dim Dial as QColorDialog

CREATE Form AS QFORM
  Caption="Paint"
  Width=690
  Height=503
  Center
  CREATE MainMenu AS QMAINMENU
    CREATE MenuFile AS QMENUITEM
      Caption="&File"
      CREATE MenuNew AS QMENUITEM
        Caption="&New"
        OnClick=New
      END CREATE
      CREATE separator AS QMENUITEM
        Caption="-"
      END CREATE
      CREATE MenuExit AS QMENUITEM
        Caption="&Exit"
        OnClick=Quit
      END CREATE
    END CREATE
    CREATE MenuTool AS QMENUITEM
      Caption="&Tools"
      CREATE MenuPenColor AS QMENUITEM
        Caption="&Pen color"
        OnClick=SelectPenColor
      END CREATE
      CREATE MenuPenSize AS QMENUITEM
        Caption="&Pen size"
        CREATE MenuSize1 AS QMENUITEM
          Caption="&Size 1"
          Tag=1
          Checked=true
          OnClick=SelectSize
        END CREATE
        CREATE MenuSize2 AS QMENUITEM
          Caption="&Size 2"
          Tag=2
          OnClick=SelectSize
        END CREATE
        CREATE MenuSize4 AS QMENUITEM
          Caption="&Size 4"
          Tag=3
          OnClick=SelectSize
        END CREATE
        CREATE MenuSize8 AS QMENUITEM
          Caption="&Size 8"
          Tag=4
          OnClick=SelectSize
        END CREATE
      END CREATE
      CREATE MenuBackcolor AS QMENUITEM
        Caption="&Back color"
        OnClick=SelectBackColor
      END CREATE
    END CREATE
    CREATE MenuDrawing AS QMENUITEM
      caption="&Drawing"
      CREATE MenuDraw AS QMENUITEM
        Caption="&Draw"
        tag=1
        Checked=true
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuLine AS QMENUITEM
        Caption="&Line"
        tag=2
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuRect AS QMENUITEM
        Caption="&Rectangle"
        tag=3
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuRectFilled AS QMENUITEM
        Caption="&Rectangle filled"
        tag=4
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuCircle AS QMENUITEM
        Caption="&Circle"
        tag=5
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuCircleFilled AS QMENUITEM
        Caption="&Circle filled"
        tag=6
        OnClick=SelectDrawing
      END CREATE
      CREATE MenuFill AS QMENUITEM
        Caption="&Fill"
        tag=7
        OnClick=SelectDrawing
      END CREATE
    END CREATE
  END CREATE
  CREATE ScrollBox1 AS QSCROLLBOX
    Align=alClient
    color=&hffffff
    CREATE image AS QCanvasEx
      Align=alClient
      OnMouseMove=move
      OnMouseDown=start
      OnMouseUp=stop
    END CREATE
  END CREATE
END CREATE

Form.ShowModal

sub New
  image.repaint
end sub

sub Quit
  Form.close
  Application.terminate
end sub

sub SelectDrawing(sender as qmenuitem)
  TypeDraw=sender.tag
  ResetMenuDrawing
  sender.checked=true
end sub

sub SelectSize(sender as qmenuitem)
  Select case sender.tag
  case 1
    image.pensize=1
  case 2
    image.pensize=2
  case 3
    image.pensize=4
  case 4
    image.pensize=8
  end select
  ResetMenuSize
  sender.checked=true
end sub

sub Start(bt as integer,x as integer,y as integer)
  flag=true
  orx=x
  ory=y
  ox=x
  oy=y
  select case typeDraw
  case 1
    image.line(x,y,x,y,PenColor)
  case 2
    image.mixmode=R2_NOTXORPEN_CAN
    image.line(x,y,x,y,PenColor)
  case 3
    image.mixmode=R2_NOTXORPEN_CAN
    image.rectangle(x,y,x,y,PenColor)
  case 4
    image.mixmode=R2_NOTXORPEN_CAN
    image.rectangleFilled(x,y,x,y,PenColor,backcolor)
  case 5
    image.mixmode=R2_NOTXORPEN_CAN
    image.circle(x,y,x,y,PenColor)
  case 6
    image.mixmode=R2_NOTXORPEN_CAN
    image.circleFilled(x,y,x,y,PenColor,backcolor)
  case 7
    image.fillSurface(x,y,pencolor)
  end select
end sub

sub Move(x as integer,y as integer)
  if flag then
    select case typeDraw
    case 1
      image.line(ox,oy,x,y,PenColor)
    case 2
      image.line(orx,ory,ox,oy,PenColor)
      image.line(orx,ory,x,y,PenColor)
    case 3
      image.rectangle(orx,ory,ox,oy,PenColor)
      image.rectangle(orx,ory,x,y,PenColor)
    case 4
      image.rectangleFilled(orx,ory,ox,oy,PenColor,backcolor)
      image.rectangleFilled(orx,ory,x,y,PenColor,backcolor)
    case 5
      image.circle(orx,ory,ox,oy,PenColor)
      image.circle(orx,ory,x,y,PenColor)
    case 6
      image.circleFilled(orx,ory,ox,oy,PenColor,backcolor)
      image.circleFilled(orx,ory,x,y,PenColor,backcolor)
    end select
    ox=x
    oy=y
  end if
end sub

sub Stop
 if  flag then
   image.mixmode=R2_COPYPEN_CAN
   flag=0
 end if
 select case typeDraw
 case 2
   image.line(orx,ory,ox,oy,PenColor)
 case 3
   image.rectangle(orx,ory,ox,oy,PenColor)
 case 4
   image.rectangleFilled(orx,ory,ox,oy,PenColor,backcolor)
 case 5
   image.circle(orx,ory,ox,oy,PenColor)
 case 6
   image.circleFilled(orx,ory,ox,oy,PenColor,backcolor)
 end select
end sub

sub ResetMenuDrawing
  MenuDraw.checked=false
  MenuLine.checked=false
  MenuRect.checked=false
  MenuRectFilled.checked=false
  MenuCircle.checked=false
  MenuCircleFilled.checked=false
  MenuFill.checked=false
end sub

sub ResetMenuSize
  MenuSize1.checked=false
  MenuSize2.checked=false
  MenuSize4.checked=false
  MenuSize8.checked=false
end sub

sub SelectPenColor
  Dial.caption="Select pen color"
  if Dial.Execute then
    PenColor=Dial.Color
  end if
end sub

sub SelectBackColor
  Dial.caption="Select backcolor"
  if Dial.Execute then
    BackColor=Dial.Color
  end if
end sub


Appendix A: QColorDialog

Documentation component by D.Glodt (c)2000-2001 Appendix A: QColorDialog

QColorDialog Component

QColorDialog is a dialogue box used to select a color.

WARNING:don't use Caption property with an other component using a WindowProc.

QColorDialog Properties
Field | Type | R/W | Default
Caption | STRING | RW |
Colors | Array of LONG | RW |
 | Define the value of 16 colors perso.
Color | LONG | R |
 | Value color selected.
Style | INTEGER | RW | cdNormal
 | Style dialog box, can be cdFullOpen or cdNoFullOpen

QColorDialog Methods
Method | Type | Description | Params
Execute | FUNCTION | Open the dialog box , return True if color selection |

QColorDialog Events
Event | Type | Occurs when... | Params

QColorDialog Examples

' Color chooser dialog example
$INCLUDE "RAPIDQ.INC"
$INCLUDE "QCOLORDIALOG.INC"
$TYPECHECK ON

DECLARE SUB ButtonClick (Sender AS QBUTTON)

dim Dial as QColorDialog
    Dial.Style=cdNoFullOpen
    Dial.Caption="Select Color"

CREATE Form AS QFORM
    CREATE Button AS QBUTTON
        Width = 100
        Caption = "Choose color"
        OnClick = ButtonClick
    END CREATE
    Center
END CREATE
form.ShowModal

SUB ButtonClick (Sender AS BUTTON)
    if Dial.Execute then
      Form.Color=Dial.Color
    end if
END SUB


Appendix A: QAbout

Documentation component QDIR By Jacques Philippe October 2002
Appendix A: QDIR

QDIR Component

QDIR is a analog of "DOS" DIR and DIR /S command

  • QDIR Internal Types

    Type QDIR_FILETIME
    lowDateTime As Long
    highDateTime As Long
    End Type

    Type QDIR_WIN32_FIND_DATA ' WIN32 NAMES
    attributes As Long ' dwFileAttributes As Long
    ' RAPIDQ BUGS WITH NESTED TYPES so REPLACED BY ! No Differences
    ' ftCreationTime As FILETIME
    creationLowDateTime As Long ' ftCreationTime.dwLowDateTime As Long
    creationHighDateTime As Long ' ftCreationTime.dwHighDateTime As Long

    ' ftLastAccessTime As FILETIME
    lastAccessLowDateTime As Long ' ftLastAccessTime.dwLowDateTime As Long
    lastAccessHighDateTime As Long ' ftLastAccessTime.dwHighDateTime As Long

    ' ftLastWriteTime As FILETIME
    lastWriteLowDateTime As Long ' ftLastWriteTime.dwLowDateTime As Long
    lastWriteHighDateTime As Long ' ftLastWriteTime.dwHighDateTime As Long

    fileSizeHigh As Long ' nFileSizeHigh As Long
    fileSizeLow As Long ' nFileSizeLow As Long
    dwReserved0 As Long
    dwReserved1 As Long
    cFileName As String * 260
    cAlternate As String * 14
    End Type

    Type QDIR_SYSTEMTIME ' VB integer = RQ Short
    year As Short ' the year as a number
    month As Short 'the month as a number
    dayOfWeek As Short ' number of the day of the week SUNDAY = 0, MONDAY = 1, ...
    day As Short 'day in the month 1, 2, 3,... 12, 13, 14, ... 28/30/31
    hour As Short 'the hour as a number
    minute As Short 'the minute as a number
    second As Short 'the second as a number
    milliseconds As Short 'the milliseconds as a number
    ' Extended
    DateTime As Double ' The DateTime As A Number
    date As String * 10 ' Date as a String mm/dd/yyyy
    dateEU As String * 10 ' EU date Foramt dd/mm/yyyy
    dateAlpha As String * 16 ' "ddd" "mmm" DD, yyyy
    dateAlphaEU As String * 15 ' "ddd" DD "mmm" yyyy
    time As String * 8 ' without ms HH:MM:SS
    timems As String * 12 ' Time As a String HH:MM:SS.iii
    strDayOfWeek As String * 3 ' day of the week as in Day(0 To 6) : "Mon", "Tue", "Wed", ... "Sun"
    nWeekDay As String * 1 ' "0", "1", "2", ... "6"
    strMonthOfYear As String * 3 ' day of the week as in Months(1 To 12) : "Jan", "Feb", ... "Dec"
    End Type

    QDIR Properties

    • Field | Type | R/W | Défault
    Find Files Parameters
    fileName | string | R/W
    the name of the founded file
    dosFileName | string | R/W
    dos the name of the founded file
    path | String | R/W | applicationPath = Command$(0) - Application.exeName
    Absolute path to the file ie : C:\myDir\otherDir\
    pathFileName | string | R/W
    Absolute path + the fileName ie : c:\Windows\system.dat
    size | Double | R/W
    the size as a double (use StrF$(size, ffFixed, 18, 0) to exp (ffNumber to have thousands separators)
    Date and Time Variable
    creation | as QDIR_SYSTEMTIME
    the Type contaning informations about the creationTime
    lastAccess | as QDIR_SYSTEMTIME
    the Type contaning informations about the lastAccessTime
    lastWrite | as QDIR_SYSTEMTIME
    the Type contaning informations about the lastWriteTime
    File Times

    The File Time Properties decribed below for lastwriteTime may be found here for all three File Times : ie
    - QDir.Creation.dateAlphaEU
    - QDir.lastAccess.dateEU and even
    - QDir.lastWrite.timems (which is equal to QDir.timems)

    These three time TYPES give access to 3 x 18 porpeties (=54), not used every day :)

    To compare dates and times, use dateTime. The dateTimes are DOUBLE precision numbers
    (64 bit Integer, converted here in DOUBLE) holding a date and time associated with
    a file. That DOUBLE specifies the number of 100-nanosecond intervals which have
    passed since January 1, 1601 (10,000,000 for each elapsed second since then).
    dateTime | Double
    the lastWriteTime of the file as a double
    time | String
    the lastwriteTime of the file, format HH:MM:SS
    timems | String
    the lastWriteTime of the file + milliseconds, format HH:MM:SS,mmm
    date | String
    the lastWriteTime date, format MM/DD/YYYY
    dateEU | String
    the lastWriteTime date, EU foramt DD/MM/YYYY
    dateAlpha | String
    the lastWriteTime in alphanumeric format "mon dec 24 2001"
    dateAlphaEU | string
    the lastWriteTime in alphanumeric EU format "mon 24 dec 2001"
    strDayOfWeek | string
    the lastWriteTime Day Of The Week : "Mon", "Tue", "Wed", Thu" ...
    strMonthOfYear | String
    the lastWriteTime Month Of The Year : "Jan", "Feb", "Mar", "Apr", ...
    Attibutes
    attributes | Long
    the attributes af the file (sum of attributes)
    attributesAsString | String
    the attributes transformed in a string "ADHNRSTC0" If Instr(myDir.AttributesAsString, "A") Then ....
    Text Month, WeekDay
    days(0 To 6)
            As String days(0) = "Sunday" '"Dim" ' May Be Changed days(0 To 6)
    days(1) = "Monday" '"Lun"
    days(2) = "Tuesday" '"Mar"
    days(3) = "Wednesday" '"Mer"
    days(4) = "Thursday" '"Jeu"
    days(5) = "Friday" '"Ven"
    days(6) = "Saturday" '"Sam"
    the 7 names of the strDayOfWeek. Source for AlphaNumeric dates
    months(1 To 12)
            As String months(1) = "January" ' May be Changed months(1 To 12)
    months(2) = "February"
    months(3) = "March"
    months(4) = "April"
    months(5) = "May"
    months(6) = "June"
    months(7) = "July"
    months(8) = "August"
    months(9) = "September"
    months(10) = "October"
    months(11) = "November"
    months(12) = "December"
    the 12 names of strMonthOfYear. Source for AlphaNumeric dates

    QDIR Methods
    Method | Description
    Function Close As Long
    Function GetFirstFile (sPathFilter As String) As String
    Function GetNextFile As String
    Sub Dir (sPathFilter As String, sRejectedAttributes As String, sMustAttributes As string) | File Search without Scanning The Sub Directories
    Sub Dirs (sPathFilter As String, sRejectedAttributes As String, sMustAttributes As String) File Search with Scanning the Sub Directories
    Dirs chosen to remember the Command Dir /s
    Note!
    Dir and Dirs will only return when ALL the directory job has been done.
    There is no DoEvents in QDir.
    - Once a QDir.Dir or QDir.Dirs is Started, a busy flag forbids to start another occurence of QDir.Dir or QDir.Dirs, until the first job is
    finished. To start more than one QDir.Dir or QDir.Dirs simultneously, you must DECLARE (DIM) two or more Variables As QDIR.
    Functioni ChangeFileDateAndTime ( ... ) As Long ChangeFileDateAndTime (pathFileName$, Year%, month%, day%, hour%, minute%, second%, optionWhichTimes$)
    Return 0 (False) on Failure or 1 (True) on success
    EXAMPLES :
    - ChangeFileDateAndTime ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33) ' the LastWriteTime Of MyFile is set to June 21 st 1983 at 17:22:23

    - ChangeFileAndDate ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33 "Access") ' the LastAccessTime Of myFile is set to June 21 st 1983 at 17:22:23

    - ChangeFileAndDate ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33 "ACCESS Write CREATION")
    ' the LastAccessTime, CreationTime and LastWriteTime Of myFile are set to June 21 st 1983 at 17:22:23

    Used in the Event OnFileFound with Qdir.pathFilename can change the Date and Time of all matching files.
    A File is Stored on Disk with Three Different Dates and Times Named :
    - the creationTime
    - the lastAccesstime
    - the lastWriteTime (the one mostly mostly used shown)

    Six NUMERIC Parameters **MUST** be Passed to the Functioni :
    - the First is the YEAR of the new Date Time For the File
    - the Second is the MONTH of the new Date Time For the File
    - the Third is the DAY of the new Date Time For the File
    - the Fourth is the HOUR of the new Date Time For the File
    - the Fifth is the MINUTE of the new Date Time For the File
    - the Sixth is the SECOND of the new Date Time For the File

    The FILENAME With or Without a Path must be Passed as a STRING !

    The optionWhichTimes Parameter is a STRING that Indicates to the Functioni
    which file Times must be Changed. If that String contains :
    - "CREATION" the creationTime will be Changed ("CRE" is enough)
    - "ACCESS" the lastAccessTime will be changed ("ACC" is enough)
    - "WRITE" the lastWriteTime will be changed ("WRI" is enough)
    Not case sensitive
    If that string is not Passed or is Empty, the lastWriteTime only will
    be changed

    ERROR : on error a ShowMessage is POPED UP and the Functioni Returns 0 (False
    Function ChangeFileAttributes (sPathFileName As string, attributesAsString As String) As Long
    - attributes are passed as a String, elements of that string are :
    "A" for Archive
    "D" for Directory
    "H" for Hidden
    "N" for Normal
    "R" for Read Only
    "S" for System
    "T" for Temporary
    "C" for Compressed
    "0" for No Attribute Set (?=N?)

    EXAMPLE :
    -------
    ChangeFileAttributes ("c:\myDir\myFile","AR")
    the attributes of myFile are set to Archive and ReadOnly

    The function returns 1 (True) if attributes have been changed and 0 if
    an error has occured.

    Used in the Event OnFileFound with Qdir.pathFilename can change the
    attributes of all matching files.
    Parameters description

    sPathFilter     - Path + FileMask, i.e "C:/Rapid-Q/*" or "c:\\Windows\\*.txt".
    • Path may be relative or absolute ie : dir2\myfile.Ext or c:\dir1\dir2\myfile.Ext.
    • relative path is relative to APPLICATION directory (where the .EXE is)
    • filter may be any kind of filter using wild card "*.Txt", "*name.Txt"

    sRejectedAttributes - in rejectedAttributes$, if more than one attribute is rejected, all file having one of these rejected attributes set is rejected from the search.

    sMustAttributes -     in mustAttributes$, if more than one attibute is present, to be accepted a file must have all these attributes set. ie : no file can match "0A"
    rejectedAttribites and mustAttributes maybe any of these letters in ANY order "ADHNRSTC0"
    - attributes are passed as a String, elements of that string are :
    "A" for Archive
    "D" for Directory
    "H" for Hidden
    "N" for Normal
    "R" for Read Only
    "S" for System
    "T" for Temporary
    "C" for Compressed
    "0" for No Attribute Set (?=N?)
    - You can use multiple attributes in any order ie : "HTCA"
    - an unknown attribute letter will be ignored.
    - attributes are not case sensitive

    sPathFileName
    attributesAsString

    QDIR Events
    Event | Type | Occurs when... | Params
    OnFileFound | OnFileFound = 0

    QDIR Examples


QDIRLISTVIEW Component

QDirListView extends QListView Component. It Beheves like QFileListBox, but is a bit more "pretty"...

QDirListView Internal Types
   TYPE ItemType            '' ie. DirListView.Item(0).Caption
     Caption AS STRING
     Checked AS INTEGER     '' If CheckBoxes is enabled and item is checked
     Handle AS INTEGER      '' Read-only
     ImageIndex AS INTEGER
     Index AS INTEGER       '' Read-only
     Selected AS INTEGER
     StateIndex AS INTEGER
   END TYPE

   TYPE ColumnType          '' ie. DirListView.Column(0).Width
     Caption AS STRING
     Width AS INTEGER
   END TYPE
QDirListView Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
BorderStyle | INTEGER | RW | bsSingle
CheckBoxes | INTEGER | RW | False
Color | INTEGER | RW
Column | ARRAY of ColumnType | RW
ColumnClick | INTEGER | RW | True
ColumnsCount | INTEGER | RW
Cursor INTEGER RW

crDefault

Directory | STRING | RW | Application path
Directory is the directory that contains all the files listed in the listview.
dlw_PopupMenu | QPOPUPMENU | RW
NB! If you need to add an PopUpMenu to the QDirListView, then add your MenuItems to dlw_PopupMenu.
Enabled | INTEGER | RW | True
ExtensionsList | QSTRINGLIST | RW
ExtensionsList contains list of fileextensions. If file with extension listed in ExtensionsList is listed in ListBox, then an icon, which is specified in SmallImageList and LargeImageList is assigned to it.
First two items in ExtensionsList are reserved:
Item(0) for folders,
Item(1) for all other filetypes.
Filename | STRING | R
FileName is the name of the selected file in the listview, including the pathname.
Font | QFONT | W
GridLines | INTEGER | RW | False
Handle | INTEGER | R
Height | INTEGER | RW | 138
HideSelection | INTEGER | RW | False
Hint | STRING | RW
HotTrack | INTEGER | RW | False
Item | ARRAY of ItemType | RW
ItemCount | INTEGER | RW
ItemIndex | INTEGER | RW
LargeImageList | QIMAGELIST | RW
Same as SmallImageList but icons are in 32x32 size.
LargeImages | QIMAGELIST | W | LargeImageList
By Default an internal ImageList is already assigned.
Left | INTEGER | RW | 0
Mask STRING RW *.*
Mask is string that contains filter, which specifies which files are displayed in listview. By default all files are shown.
NB! At the moment only one filter is valid. i.e. "*.exe; *.com" is invalid.
MultiSelect | INTEGER | RW | False
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W | dlw_PopUpMenu
ReadOnly | INTEGER | RW | True
Even if You change ReadOnly to False, you can't change actual filenames through the ListView :(
RowSelect | INTEGER | RW | False
SelCount | INTEGER | RW
Selected | ARRAY of INTEGER | RW
ShowColumnHeaders | INTEGER | RW | True
ShowHint | INTEGER | RW | False
ShowRoot | INTEGER | RW | False
If True, the ".." directory will be shown.
SmallImageList | QIMAGELIST | RW
SmallImageList contains list of FileIcons. If file with extension listed in ExtensionsList is listed in ListBox, then an icon, which is specified in SmallImageList and LargeImageList is assigned to it.
First two items in SmallImageList are reserved:
Item(0) for folders,
Item(1) for all other filetypes.

... Icons are in 16x16 size.
SmallImages | QIMAGELIST | W | SmallImageList
By Default an internal ImageList is already assigned.
SortType | INTEGER | RW | stNone
StateImages | QIMAGELIST | W
SubItem | 2D ARRAY of STRING | RW
TabOrder | INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
Width | INTEGER | RW | 400
ViewStyle | INTEGER | RW | vsIcon
Visible | INTEGER | RW | True

QDirListView Methods
Method | Type | Description | Params
AddColumns | SUBI | Add column headers to listview | STRING, Infinite
AddItems | SUBI | Add items to listview | STRING, Infinite
AddSubItem | SUB (Index%, String$) | Add sub item to Index% | 2
ChangeDirUp | SUB | Steps one directory higher in directory-tree | 0
Clear | SUB | Clear all items in listview | 0
ClearColumns | SUB | Clear all columns in listview | 0
DelItems | SUBI | Delete items from listview | INTEGER, Infinite
DelSubItem | SUB (Index%, SubIndex%) | Delete subitem from listview | 2
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2
InsertSubItem | SUB (Index%, SubIndex%, String$) | Insert subitem | 3
Refresh | SUB | Refreshes ListView Items | 3
SwapItem | SUB (Index1%, Index2%) | Swap items | 2

QDirListView Events
Event | Type | Occurs when... | Params
OnClick | VOID | Item was clicked on | 0
OnChange SUB (Index%, Change AS BYTE) Item changed (text, image, or state)
NB! Inside SUB use .InheritOnChange 		2
OnColumnClick | SUB (Column%) | Column header was clicked | 1
OnDblClick VOID Selection was double clicked on
NB! Inside SUB use .InheritOnDblClick 		0
OnFileSelect | VOID | File was double clicked on or ENTER was pressed | 0
OnKeyPress | SUB (Key AS BYTE) | Key was pressed | 1

QDirListView Examples
' An form, that displais contents of folders and
' has special icons for image-files.

$include "rapidq.inc"  'Important!

$include "QDirListView.inc"

' Custom iconResources for ImageFiles
$Resource ICO_JPEG_SMALL as "jpeg_small.ico"
$Resource ICO_JPEG_LARGE as "jpeg_large.ico"
$Resource ICO_GIF_SMALL as "gif_small.ico"
$Resource ICO_GIF_LARGE as "gif_large.ico"
$Resource ICO_BMP_SMALL as "bmp_small.ico"
$Resource ICO_BMP_LARGE as "bmp_large.ico"

declare sub DirListChange
declare sub DirListFileSelect(Tag as integer)

CREATE Form AS QFORM
    Width = 500
    Height = 300
    Center
    create DirList as QDirListView
      Align = alClient
      ShowRoot = True
      ViewStyle = vsList
      OnChange = DirListChange
      OnFileSelect = DirListFileSelect

      'in lowercase please!
      ExtensionsList.AddItems ("jpg", "jpe", "jpeg", "gif", "bmp")

      SmallImageList.AddIcoHandle(ICO_JPEG_SMALL)
      LargeImageList.AddIcoHandle(ICO_JPEG_LARGE)
      SmallImageList.AddIcoHandle(ICO_JPEG_SMALL)
      LargeImageList.AddIcoHandle(ICO_JPEG_LARGE)
      SmallImageList.AddIcoHandle(ICO_JPEG_SMALL)
      LargeImageList.AddIcoHandle(ICO_JPEG_LARGE)
      SmallImageList.AddIcoHandle(ICO_GIF_SMALL)
      LargeImageList.AddIcoHandle(ICO_GIF_LARGE)
      SmallImageList.AddIcoHandle(ICO_BMP_SMALL)
      LargeImageList.AddIcoHandle(ICO_BMP_LARGE)
    end create
end create

Form.ShowModal

'------------------------------------------------------
sub DirListChange
  DirList.InheritOnChange 'Important!
  Form.Caption = DirList.Directory
end sub

sub DirListFileSelect(Tag as integer) 'It Just needs one empty parameter to work
  ShowMessage("File '" + DirList.FileName + "' was selected.")
end sub
QDirListView SourceCode
'-----------------------------------------------------------------
'
'  QDirListView
'
'  An Customized QListView For Displaing Files and Folders
'
'  by Rene Saarsoo
'
'-----------------------------------------------------------------
' not well-commented and needs some work, but is fully-functional :)
' All Suggestions and Bug-Reports are welcome to  nene@hot.ee
'
' Long live the Rapid-Q!
'

' Icons for folders and unidentified files
$resource ICO_DIR_SMALL as "dir_XP_small.ico"
$resource ICO_DIR_LARGE as "dir_XP_large.ico"
$resource ICO_DEFAULTFILE_SMALL as "default_small.ico"
$resource ICO_DEFAULTFILE_LARGE as "default_large.ico"

' exclude it, if you have already declared this API-function
declare function SetFocus LIB "USER32" ALIAS "SetFocus" (Handle as long) as long

declare sub FileSelect_EventTemplate(Tag as integer)

type QDirListView extends QListView
  Directory as string property set Set_Directory
  Filename as string
  Mask as string property set Set_Mask
  ShowRoot as integer property set Set_ShowRoot
  LargeImageList as QImageList
  SmallImageList as QImageList
  ExtensionsList as QStringList
  dlw_PopupMenu as QPopupMenu
  dlw_Enter as QMenuItem
  dlw_BackSpace as QMenuItem
  OnFileSelect as event (FileSelect_EventTemplate)
  ColumnsInitialized as integer

  sub SetItemImage (Extension as string)
    QDirListView.Item(QDirListView.ItemCount - 1).ImageIndex = 1
    for i = 2 to QDirListView.ExtensionsList.ItemCount - 1
      if lcase$(Extension) = QDirListView.ExtensionsList.Item(i) then
        QDirListView.Item(QDirListView.ItemCount - 1).ImageIndex = i
        exit for
      end if
    next i
  end sub

  sub AddFileProperties (Extension as string)
    dim SizeString as string
    if FileRec.Size/1024 >= 1 then
      SizeString = str$(int(FileRec.Size / 1024)) + " KB"
    else
      SizeString = "1 KB"
    end if
    QDirListView.AddSubItem (QDirListView.ItemCount - 1, SizeString )
    QDirListView.AddSubItem (QDirListView.ItemCount - 1, ucase$(Extension) + " File")
    dim FirstSplitter as integer
    dim Month as string
    FirstSplitter = instr(FileRec.Date, "-", 0)
    Month = left$(FileRec.Date, FirstSplitter - 1)
    if len(Month) = 1 then Month = "0" + Month
    dim Day as string
    Day = left$(right$(FileRec.Date, len(FileRec.Date) - FirstSplitter), _
            instr(right$(FileRec.Date, len(FileRec.Date) - FirstSplitter), "-", 0) - 1)
    dim Year as string
    Year = right$(FileRec.Date, 4)
    QDirListView.AddSubItem (QDirListView.ItemCount - 1, Day+"."+Month+"."+Year + " " +FileRec.Time)
  end sub

  sub LoadDirectories
    dim File as string
    File = ""
    File = Dir$(QDirListView.Directory + "*.*", faDirectory)
    do
    File = Dir$
    if File = "" then
      exit do
    else
      if File = ".." and QDirListView.ShowRoot = FALSE then
      else
        if DirExists(QDirListView.Directory + File) then
          QDirListView.AddItems File
        end if
      end if
    end if
    loop
  end sub

  sub LoadFiles
    dim File as string
    dim i as integer
    File = ""
    i = 0

    do
    i = i + 1
    if i = 1 then
      File = Dir$(QDirListView.Directory + QDirListView.Mask, 0)
    else
      File = Dir$
    end if

    if File = "" then
      exit do
    else
      dim Extension as string
      Extension = ""
      dim PontPlace as integer

      QDirListView.AddItems File

      PointPlace = instr(File, ".", 0)
      if PointPlace > 0 then
        Extension = right$( File, instr(reverse$(File), ".", 0) - 1 )
        QDirListView.SetItemImage (Extension)
      else
        QDirListView.Item(QDirListView.ItemCount - 1).ImageIndex = 1
      end if
      QDirListView.AddFileProperties (Extension)
    end if
    loop
  end sub

  sub Refresh
    QDirListView.Clear
    QDirListView.LoadDirectories
    QDirListView.LoadFiles
    QDirListView.ViewStyle = QDirListView.ViewStyle + 1   ' SomeHow we manage with
    QDirListView.ViewStyle = QDirListView.ViewStyle - 1   ' changing the style
                                                          ' to make items fully wisible
                                                          ' ( without "..." at the end )
    if ColumnsInitialized = FALSE then
      QDirListView.ClearColumns
      QDirListView.AddColumns "Name", "Size", "Type", "Date Modified"
      QDirListView.Column(0).Width = 150
      QDirListView.Column(1).Width = 60
      QDirListView.Column(2).Width = 60
      QDirListView.Column(3).Width = 100
      ColumnsInitialized = TRUE
    end if
    QDirListView.Visible = false     ' Whith this we manage to repaint the control.
    QDirListView.Visible = true      ' Otherwise it would stay messed-up ( You can Try :) )
    SetFocus(QDirListView.Handle)    ' Focus was lost on hiding, so we set it back.
  end sub

  sub ChangeDirUp
    QDirListView.Directory = left$(QDirListView.Directory, _
            len(QDirListView.Directory) - _
            instr(mid$(reverse$(QDirListView.Directory), 2), "\", 0)  )
    QDirListView.refresh
  end sub

  sub ChangeDir
    if QDirListView.Item(QDirListView.ItemIndex).Caption = ".." then
      QDirListView.ChangeDirUp
    else
      QDirListView.Directory = QDirListView.FileName + "\"
      QDirListView.refresh
    end if
  end sub

  sub TryToChangeDirOrMakeEvent
    if QDirListView.FileName > "" then
      if DirExists(QDirListView.FileName) then
        QDirListView.ChangeDir
      else
        CallFunc(QDirListView.OnFileSelect, 0)
      end if
    end if
  end sub

  event OnChange
    if QDirListView.ItemIndex >= 0 then
    QDirListView.FileName = QDirListView.Directory + QDirListView.Item(QDirListView.ItemIndex).Caption
    else
    QDirListView.FileName = ""
    end if
  end event

  event OnDblClick
    QDirListView.TryToChangeDirOrMakeEvent
  end event

  event dlw_Enter.OnClick
    QDirListView.TryToChangeDirOrMakeEvent
  end event

  event dlw_BackSpace.OnClick
    QDirListView.ChangeDirUp
  end event

  property set Set_Directory (Dir as string)
    if right$(Dir, 1) = "\" then
      QDirListView.Directory = Dir
    else
      QDirListView.Directory = Dir + "\"
    end if
    QDirListView.Refresh
  end property

  property set Set_ShowRoot (RootSet as integer)
    QDirListView.ShowRoot = RootSet
    QDirListView.Refresh
  end property

  property set Set_Mask (MaskSet as string)
    QDirListView.Mask = MaskSet
    QDirListView.Refresh
  end property

  constructor
    Width = 400
    Height = 138
    Directory = left$(Command$(0), len(Command$(0)) - len(APPLICATION.ExeName) )
    Filename = ""
    Mask = "*.*"
    ShowRoot = FALSE
    ReadOnly = TRUE
    ColumnsInitialized = FALSE
    LargeImageList.Width = 32
    LargeImageList.Height = 32
    ExtensionsList.AddItems "<dir>"
    SmallImageList.AddICOHandle ICO_DIR_SMALL
    LargeImageList.AddICOHandle ICO_DIR_LARGE
    ExtensionsList.AddItems "<dir>"
    SmallImageList.AddICOHandle ICO_DEFAULTFILE_SMALL
    LargeImageList.AddICOHandle ICO_DEFAULTFILE_LARGE
    LargeImages = QDirListView.LargeImageList
    SmallImages = QDirListView.SmallImageList
    dlw_Enter.ShortCut = "Enter"
    dlw_Enter.Visible = FALSE
    dlw_BackSpace.ShortCut = "BkSp"
    dlw_BackSpace.Visible = FALSE
    dlw_PopupMenu.AddItems(QDirListView.dlw_Enter, QDirListView.dlw_BackSpace)
    PopUpMenu = QDirListView.dlw_PopUpMenu
  end constructor
end type


QxEdit.inc

'Uploaded by : psyclops420 <psyclops420@yahoo.com>
'Description : New QEDIT component, two new events, OnGetFocus and OnLoseFocus, plus implemented WndProc

' v1.0:
' Fixed WndProc (actually, wrote it from scratch ·)
' Two new events, OnGetFocus and OnLoseFocus
' When using the new events, you MUST use the Sender parameter
' Custom events MUST have at least one paramater, haven't found
' a way aroud this yet

' v1.1:
' Fixed a little bug in WndProc(check for assignment)
' Added Property EnterKey

DECLARE FUNCTION CallWindowProc LIB "User32" ALIAS "CallWindowProcA"(lpPrevWndFunc AS LONG, hWnd AS LONG, uMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG
DECLARE FUNCTION SetWindowLong LIB "User32" ALIAS "SetWindowLongA"(hWnd AS LONG, nIndex AS LONG, dwNewLong AS LONG) AS LONG
DECLARE FUNCTION GetParent LIB "User32" ALIAS "GetParent" (hWnd AS LONG) AS LONG

CONST ekNormal = 0
CONST ekTab = 1

DECLARE SUB OnGetFocus_EventTemplate(Sender AS QEDIT)
DECLARE SUB OnLoseFocus_EventTemplate(Sender AS QEDIT)
DECLARE SUB WndProc_EventTemplate(hWnd AS LONG, uMsg AS LONG, wParam AS LONG, lParam AS LONG)

TYPE QxEDIT EXTENDS QEDIT
    Tmr AS QTIMER
    OldWndProc AS LONG
    EnterKey AS LONG PROPERTY SET Set_EnterKey
    OnGetFocus AS EVENT(OnGetFocus_EventTemplate)
    OnLoseFocus AS EVENT(OnLoseFocus_EventTemplate)
    WndProc AS EVENT(WndProc_EventTemplate)

    WITH This

        PROPERTY SET Set_EnterKey(NewEnterKey AS LONG)
            .EnterKey = NewEnterKey
        END PROPERTY SET

        FUNCTION Proc(hWnd AS LONG, uMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG
            IF hWnd = .Handle THEN
                Result = CallWindowProc(.OldWndProc, hWnd, uMsg, wParam, lParam)
                IF uMsg = &H7 THEN
                    CALLFUNC(.OnGetFocus, This)
                ELSEIF uMsg = &H8 THEN
                    CALLFUNC(.OnLoseFocus, This)
                ELSEIF uMsg = &H100  AND wParam = &HD AND .EnterKey THEN
                    KillMessage(GetParent(.Handle), &H102)
                    SendMessage(GetParent(.Handle), &H28, 0, 0)
                END IF
                IF .WndProc>0 THEN CALLFUNC(.WndProc, hWnd, uMsg, wParam, lParam)
            END IF
        END FUNCTION

        EVENT Tmr.OnTimer
                .OldWndProc = SetWindowLong(This.Handle, -4, CODEPTR(This.Proc))
                .Tmr.Enabled = 0
        END EVENT

        CONSTRUCTOR
            Tmr.Interval = 1
        END CONSTRUCTOR

    END WITH

END TYPE

$UNDEF QEDIT
$DEFINE QEDIT QxEDIT


Appendix A: QFLATBUTTON

Rapid-Q Documentation by Bryn Mosher - (c) 2000 William Yu Appendix A: QFLATBUTTON

QFLATBUTTON Component

An Internet Explorer style flat button for Windows users.

QImage Properties
Field | Type | R/W | Default
AutoSize | INTEGER | R | True
B | INTEGER (Current Windows Desktop Blue RGB value) | R |
BMPHandle | RESOURCE | RW |
Center | INTEGER | R | True
CopyMode | INTEGER | RW | cmBlackness
CurrState | INTEGER | R | fbFlat
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Font | QFONT | W |
G | INTEGER (Current Windows Desktop Green RGB value) | R |
Handle | INTEGER | RW |
Height | INTEGER | RW |
Hint | STRING | RW |
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W |
Pixel | 2D ARRAY of INTEGER | RW |
PopupMenu | QPOPUPMENU | W |
R | INTEGER (Current Windows Desktop Red RGB value) | R |
ShowHint | INTEGER | RW | False
Stretch | INTEGER | R | False
Top | INTEGER | RW | 0
Transparent | INTEGER | R | True
Width | INTEGER | RW |
Visible | INTEGER | RW | True

QImage Methods
Method | Type | Description | Params
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
Repaint | SUB | Force repainting of image | 0
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5

QImage Events
Event | Type | Occurs when... | Params
Depress | VOID | Show button in fbDepressed (clicked not sad) state | 0
Flatten | VOID | Show button in fbFlattened or Normal state | 0
GetColors | VOID | Refreshes palate to Windows Desktop colors | 0
OnClick | VOID | User clicked on image | 0
OnDblClick | VOID | User double clicked on image | 0
Raise | VOID | Show button in fbRaised state | 0

QFlatButton Examples

  '-- QFlatButton Example #1
  ' Note that the image displayed is ALWAYS set to Transparent = True

  $ESCAPECHARS ON ' For getting colors - You can use the default with this turned off
  $INCLUDE "RapidQ.inc"
  $INCLUDE "QFlatButton.inc"

  $RESOURCE Button1Image AS "00139sm.bmp" ' The image to be displayed on Button1

  DECLARE SUB clicked
  DECLARE SUB FlattenButtons

  DIM Form AS QForm
  DIM Button1 AS QFlatButton
  Button1.BMPHandle = Button1Image
  Button1.Parent = Form
  Button1.onclick = Clicked

  Form.OnMouseMove = FlattenButtons 'This prevents hung images and some flickering
  Form.showmodal

  SUB Clicked
    SLEEP 1
  END SUB

  SUB FlattenButtons
    Button1.Flatten
  END SUB


Appendix A: QFormEx

Documentation component by D.Glodt (c)2000-2001 Appendix A: QFormEx

QFormEx Component

QFormEx is a a component as QForm with Drag&Drop of files and tray icon function.

QFormEx Properties
Field | Type | R/W | Default
DragEnable | BOOLEAN | RW | False
 | Accept drop file in the application window
DragZone | QRECT | RW |
 | Zone of drop file
DeskBar | BOOLEAN | RW | False
 | If true , application will inside the desk tool bar when the window will minimized. Set to false if the évent WndProc is use. |  |
FormStyle | INTEGER | RW | fsNormal
 | Style fsStayOnTop is now supported |  |

QFormEx Methods
Method | Type | Description | Params
AddTrayIcon | SUB | Add an icon application inside the desk tool bar. | 0
DelTrayIcon | SUB | Delete the icon application of desk tool bar. | 0

QFormEx Events
Event | Type | Occurs when... | Params
OnDrag | (File$) | Drop file | 1
OnTrayClick |  | Click right button on icon application of tool bar | 0
OnTrayDblClick |  | Double click on left button on icon application of tool bar | 0
OnMinimise |  | Window minimized | 0

QFormEx Example1

$TYPECHECK ON
$INCLUDE "rapidq.inc"
$INCLUDE "Object\QFormEx.inc"

declare Sub depose(file as string)

CREATE Form AS QFormEx
width=300
Height=200
Caption="Drag and drop files"
center
DragEnable=true
OnDrag=Depose
CREATE Listbox as QLISTBOX
Width=150
height=100
END CREATE
END CREATE

form.DragZone.Left=listbox.left
form.DragZone.Top=listbox.Top
form.DragZone.Right=listbox.Width
form.DragZone.Bottom=listbox.Height
Form.ShowModal

Sub Depose(file as string)
ListBox.AddItems(file)
End Sub

QFormEx Example2

$TYPECHECK ON
$INCLUDE "rapidq.inc"
$INCLUDE "Object\QFormEx.inc"
declare sub close
declare sub show
declare sub menu
declare sub hide

CREATE Form AS QFormEx
OnClose=Close
OnTrayDblClick=Show
OnTrayClick=Menu
OnMinimise=Hide
END CREATE

CREATE PopUpMenu AS QPOPUPMENU
Alignment = 1
CREATE Open AS QMENUITEM
Caption = "&Open"
OnClick =show
END CREATE
CREATE Seperator AS QMENUITEM
Caption = "-"
END CREATE
CREATE MeExit AS QMENUITEM
Caption = "&Exit"
OnClick =Close
END CREATE
END CREATE
form.addtrayicon
form.showmodal

sub close
form.deltrayicon
Application.terminate
end sub

sub show
form.visible=true
end sub

sub Hide
form.visible=false
end sub

sub menu
popupmenu.popup(screen.MouseX,screen.MouseY)
end sub


Appendix A: QFormMDI

Documentation component by D.Glodt (c)2000-2003 Appendix A: QFormMDI

QFormMDI Component

QFormEx is identical as a QForm component with functionality MDI.
The standard components of rapidq having a handle control (Qpanel, QRichEdit, QScrollBox...) can be associated the windows child MDI,
they must be no visible and their parent property must be the object itself at the time of their declaration.
The components can be declared as variables array or to be of different type for each window child MDI.

QFormMDI Property
Field | Type | R/W | Default
ChildCaption | STRING | R/W |
 | Text of title bar of active child window
ChildHandle | LONG | R |
 | Handle of active child window
ChildLeft | SHORT | R/W |
 | Left position of active child window |  |
ChildTop | SHORT | R/W |
 | Top position of active child window |  |
ChildWidth | SHORT | R/W |
 | Width of active child window |  |
ChildHeight | SHORT | R/W |
 | Height of active child window |  |
ChildMax | INTEGER | R/W | 1024
 | Maximum child window |  |
ChildCount | INTEGER | R |
 | Child window number |  |
ChildIcon | LONG | R/W |
 | Icon handle for child window |  |
ChildState | INTEGER | R/W |
 | State of active child window,could be wsNormal,wsMinimized,wsMaximized |  | wsNormal
MDIMenu | LONG | R/W |
 | Sub menu handle to insert the child window name |  |
ComponentIndex | INTEGER | R |
 | Index of associated component to the active child window |  |
ChildResult | INTEGER | R/W | False
 | Result of the action of closing of a child window, the value is has true during closing and can be put at false at the time of a OnChildClose event to cancel closing if the application requires a safeguard |  |

QFormMDI Methods
Method | Type | Description | Params
AddChild | SUB(handle&,Title$,index&,left%, top%,width%,height%,DefaultSize&) | Add a child window , handle& is the handle component associated the child window , Title$ is the text of the title bar of the child window , index& is the number of the associated component, DefaultSize& indicates if one uses dimensions by default. | 8
CloseChild | SUB | Close the active child window | 0
CloseAllChild | SUB | Close all the child window | 0
CascadeChild | SUB | Resize all the child window on cascade | 0
SetHorzChild | SUB | Resize all the child window on horizontal | 0
SetVertChild | SUB | Resize all the child window on vertical | 0
IconArrangeChild | SUB | Arrange all the child window on icon | 0
MinimizeAllChild | SUB | Minimize all the child window | 0
MaximizeAllChild | SUB | Maximize all the child window | 0
RestoreChild | SUB | Restore the child window |
ActiveNextChild | SUB | Activate the next child window | 0
ActivePreviousChild | SUB | Activate the previous child window | 0
GetChild | FUNCTION(Title$)& | Return the index of child window corresponding to the title Title$ | 1
ChildExist | FUNCTION(Title$)& | Return the existence of a child window by his title | 1
ActiveChild | SUB(Index&) | Activate the child window identified by index& | 1
FreeChild | FUNCTION(handle&)& | Return the state associated from a component to a child window, return True if the component identified by handle& is not associated to a child window | 1
SetDeskBar | SUB | The application will be in the task bar during its reduction | 0

QFormMDI Events
Event | Type | Occurs when... | Params
OnChildClose | (handleChild&,index&,titleChild$) | Closing child window, the parameter index& is the index of the associated component | 3
OnChildActive | (handleChild&,index&,titleChild$) | Activation child window | 3
OnChildResize | (handleChild&,index&,titleChild$) | Resize child window | 3

QFormMDI Example1

$TYPECHECK ON

$include "rapidq.inc"
$include "object\QformMDI.inc"

DECLARE SUB mnuNew_Click
DECLARE SUB mnuOpen_Click
DECLARE SUB mnuClose_Click
DECLARE SUB mnuCloseAll_Click
DECLARE SUB mnuNext_Click
DECLARE SUB mnuPrevious_Click
DECLARE SUB mnuCascade_Click
DECLARE SUB mnuTileHorz_Click
DECLARE SUB mnuTileVert_Click
DECLARE SUB mnuArrange_Click
DECLARE SUB mnuMinAll_Click
DECLARE SUB mnuMaxAll_Click
DECLARE SUB mnuRestAll_Click
DECLARE SUB mnuCut_Click
DECLARE SUB mnuCopy_Click
DECLARE SUB mnuPaste_Click
DECLARE SUB mnuSelectAll_Click
DECLARE SUB show
DECLARE SUB close
DECLARE SUB KeyDown(Key as word,Shift as integer)
DECLARE SUB infos(handleChild as long,index as integer,titleChild as string)
DECLARE SUB CloseMDI(handleChild as long,index as integer,titleChild as string)

dim j as integer
dim flag as integer
dim UntitledCount as integer
const VK_F6=117

CREATE Form AS QFormMDI
Caption = "MDI Parent"
Center
Width=Screen.Width/2*1.5
Height=Screen.Height/2*1.5
CREATE mnuMain AS QMAINMENU
CREATE mnuFile AS QMENUITEM
Caption="&File"
CREATE mnuNew AS QMENUITEM
Caption="&New"
OnClick=mnuNew_Click
END CREATE
CREATE mnuOpen AS QMENUITEM
Caption="&Open"
OnClick=mnuOpen_Click
END CREATE
CREATE mnuClose AS QMENUITEM
Caption="&Close"
OnClick=mnuClose_Click
END CREATE
CREATE mnuCloseAll AS QMENUITEM
Caption="Close &All"
OnClick=mnuCloseAll_Click
END CREATE
CREATE mnuNext AS QMENUITEM
Caption="Next"
OnClick=mnuNext_Click
END CREATE
CREATE mnuPrevious AS QMENUITEM
Caption="Previous"
OnClick=mnuPrevious_Click
END CREATE
END CREATE
CREATE mnuEdit as QMENUITEM
Caption="&Edit"
CREATE mnuCut as QMENUITEM
Caption="&Cut"
ShortCut="CTRL+X"
OnClick=mnuCut_Click
END CREATE
CREATE mnuCopy as QMENUITEM
Caption="&Copy"
ShortCut="CTRL+C"
OnClick=mnuCopy_Click
END CREATE
CREATE mnuPaste as QMENUITEM
Caption="&Paste"
ShortCut="CTRL+V"
OnClick=mnuPaste_Click
END CREATE
CREATE Sep2 as QMENUITEM
Caption="-"
END CREATE
CREATE mnuSelectAll as QMENUITEM
Caption="&Select all"
ShortCut="CTRL+A"
OnClick=mnuSelectAll_Click
END CREATE
END CREATE
CREATE mnuWindows AS QMENUITEM
Caption="&Windows"
CREATE mnuCascade AS QMENUITEM
Caption="&Cascade"
OnClick=mnuCascade_Click
END CREATE
CREATE mnuTileHorz AS QMENUITEM
Caption="Tile &Horizontally"
OnClick=mnuTileHorz_Click
END CREATE
CREATE mnuTileVert AS QMENUITEM
Caption="Tile &Vertically"
OnClick=mnuTileVert_Click
END CREATE
CREATE mnuArrange AS QMENUITEM
Caption="&Arrange Icons"
OnClick=mnuArrange_Click
END CREATE
CREATE mnuMinAll AS QMENUITEM
Caption="&Minimize All"
OnClick=mnuMinAll_Click
END CREATE
CREATE mnuMaxAll AS QMENUITEM
Caption="Ma&ximixe All"
OnClick=mnuMaxAll_Click
END CREATE
CREATE mnuRestAll AS QMENUITEM
Caption="&Restore All"
OnClick=mnuRestAll_Click
END CREATE
END CREATE
END CREATE
CREATE Stat AS QSTATUSBAR
END CREATE
KeyPreview=true
MdiMenu=mnuWindows.handle
ChildMax=20
OnChildClose=CloseMDI
OnChildActive=infos
OnClose=Close
OnPaint=Show
OnKeyDown=KeyDown
END CREATE

' Components for MDI
dim edit(20) as qrichedit
dim handleControl as long
for j=0 to 20
edit(j).parent=form
edit(j).visible=false 'must be no visible
edit(j).ScrollBars=3
edit(j).WordWrap=false
next j

Form.SetDeskBar
Form.ShowModal

'Find free component for MDI
Function GetCtl() as integer
dim find as integer
dim h as integer

find=0
for j=0 to 20
if form.FreeChild(edit(j).handle) and find=0 then
h=j
find=1
end if
next j
result=h
End Function

SUB mnuNew_Click
dim index as integer

if form.ChildCount<form.ChildMax then
index=GetCtl()
form.AddChild(edit(index).handle,"Untitled "+STR$(UntitledCount+1),index,0,0,0,0,true)
UntitledCount++
end if
END SUB

SUB mnuOpen_Click
dim index as integer
DIM OD AS QOPENDIALOG

OD.Filter="Text file(*.txt)|*.txt"
if form.ChildCount<form.ChildMax then
IF OD.Execute THEN
IF form.ChildExist(OD.FileName) THEN
form.ActiveChild(form.GetChild(OD.FileName))
EXIT SUB
END IF
index=GetCtl()
edit(index).loadfromfile(OD.FileName)
edit(index).modified=false
form.AddChild(edit(index).handle,OD.FileName,index,0,0,0,0,True)
UntitledCount++
END IF
end if
END SUB

SUB CloseMDI(handleChild as long,index as integer,titleChild as string)
dim msgButton as integer

if edit(index).modified then
msgButton=MessageBox("Fermer fenetre?",titleChild,36)
if msgButton=6 then
edit(index).modified=false
edit(index).clear
form.ChildResult=true
else
form.ChildResult=false
end if
else
edit(index).clear
end if
END SUB

SUB mnuClose_Click
form.CloseChild
if form.ChildCount=0 then stat.simpleText=""
END SUB

SUB mnuCloseAll_Click
form.CloseAllChild
if form.ChildCount=0 then stat.simpleText=""
END SUB

SUB mnuNext_Click
form.ActiveNextChild
END SUB

SUB mnuPrevious_Click
form.ActivePreviousChild
END SUB

SUB mnuCascade_Click
form.CascadeChild
END SUB

SUB mnuTileHorz_Click
form.SetHorzChild
END SUB

SUB mnuTileVert_Click
form.SetVertChild
END SUB

SUB mnuArrange_Click
form.IconArrangeChild
END SUB

SUB mnuMinAll_Click
form.MinimizeAllChild
END SUB

SUB mnuMaxAll_Click
form.MaximizeAllChild
END SUB

SUB mnuRestAll_Click
form.RestoreChild
END SUB

SUB mnuCut_Click
if form.ChildCount>0 then
edit(form.componentIndex).CutToClipBoard
end if
END SUB

SUB mnuCopy_Click
if form.ChildCount>0 then
edit(form.componentIndex).CopyToClipBoard
end if
END SUB

SUB mnuPaste_Click
if form.ChildCount>0 then
edit(form.componentIndex).PasteFromClipBoard
end if
END SUB

SUB mnuSelectAll_Click
if form.ChildCount>0 then
edit(form.componentIndex).SelectAll
end if
END SUB

SUB infos(handleChild as long,index as integer,titleChild as string)
stat.simpleText=titleChild
End Sub

SUB show
dim index as integer

  if flag=false then
if form.ChildCount<form.ChildMax then
index=GetCtl()
form.AddChild(edit(index).handle,"Untitled
"+STR$(UntitledCount+1),index,0,0,0,0,true)
UntitledCount++
end if
flag=true
end if
END SUB

Sub Close
form.CloseAllChild
if form.ChildCount>0 then form.modalResult=false
End Sub

Sub KeyDown(key as word,shift as integer)
'next child with Ctrl+F6
if shift=CtrlDown and key=VK_F6 then form.ActiveNextChild
end sub

QFormMDI Example2

$TYPECHECK ON
$OPTION ICON "photo.ico"
$include "rapidq.inc"
$Include "Object\QFormMDI.inc"
$Include "Object\QICON.inc"

DECLARE SUB mnuNew_Click
DECLARE SUB mnuOpen_Click
DECLARE SUB mnuClose_Click
DECLARE SUB mnuCloseAll_Click
DECLARE SUB mnuNext_Click
DECLARE SUB mnuPrevious_Click
DECLARE SUB mnuCascade_Click
DECLARE SUB mnuTileHorz_Click
DECLARE SUB mnuTileVert_Click
DECLARE SUB mnuArrange_Click
DECLARE SUB mnuMinAll_Click
DECLARE SUB mnuMaxAll_Click
DECLARE SUB mnuRestAll_Click
DECLARE SUB show
DECLARE SUB close
DECLARE SUB KeyDown(Key as word,Shift as integer)
DECLARE SUB infos(handleChild as long,index as integer,titleChild as string)
DECLARE SUB CloseMDI(handleChild as long,index as integer,titleChild as string)

dim j as integer
dim flag as integer
dim UntitledCount as integer
const VK_F6=117
dim icon as Qicon
icon.associated=true
icon.filename=command$(0)

CREATE Form AS QFormMDI
Caption="MDI Parent"
Center
Width=Screen.Width/2*1.5
Height=Screen.Height/2*1.5
ChildIcon=icon.handle
CREATE panel as QPANEL
align=1
height=35
bevelOuter=0
CREATE bt1 as QBUTTON
top=5
left=5
width=25
Hint="Prévious"
ShowHint=true
caption="<<"
OnClick=mnuPrevious_Click
END CREATE
CREATE bt2 as QBUTTON
top=5
left=35
width=25
Hint="Next"
ShowHint=true
caption=">>"
OnClick=mnuNext_Click
END CREATE
END CREATE
CREATE mnuMain AS QMAINMENU
CREATE mnuFile AS QMENUITEM
Caption="&File"
CREATE mnuNew AS QMENUITEM
Caption="&New"
OnClick=mnuNew_Click
END CREATE
CREATE mnuOpen AS QMENUITEM
Caption="&Open"
OnClick=mnuOpen_Click
END CREATE
CREATE mnuClose AS QMENUITEM
Caption="&Close"
OnClick=mnuClose_Click
END CREATE
CREATE mnuCloseAll AS QMENUITEM
Caption="Close &All"
OnClick=mnuCloseAll_Click
END CREATE
CREATE mnuNext AS QMENUITEM
Caption="Next"
OnClick=mnuNext_Click
END CREATE
CREATE mnuPrevious AS QMENUITEM
Caption="Previous"
OnClick=mnuPrevious_Click
END CREATE
END CREATE
CREATE mnuWindows AS QMENUITEM
Caption="&Windows"
CREATE mnuCascade AS QMENUITEM
Caption="&Cascade"
OnClick=mnuCascade_Click
END CREATE
CREATE mnuTileHorz AS QMENUITEM
Caption="Tile &Horizontally"
OnClick=mnuTileHorz_Click
END CREATE
CREATE mnuTileVert AS QMENUITEM
Caption="Tile &Vertically"
OnClick=mnuTileVert_Click
END CREATE
CREATE mnuArrange AS QMENUITEM
Caption="&Arrange Icons"
OnClick=mnuArrange_Click
END CREATE
CREATE mnuMinAll AS QMENUITEM
Caption="&Minimize All"
OnClick=mnuMinAll_Click
END CREATE
CREATE mnuMaxAll AS QMENUITEM
Caption="Ma&ximixe All"
OnClick=mnuMaxAll_Click
END CREATE
CREATE mnuRestAll AS QMENUITEM
Caption="&Restore All"
OnClick=mnuRestAll_Click
END CREATE
END CREATE
END CREATE
CREATE Stat AS QSTATUSBAR
END CREATE
KeyPreview=true
MdiMenu=mnuWindows.handle
ChildMax=20
OnChildClose=CloseMDI
OnChildActive=infos
OnClose=Close
OnKeyDown=KeyDown
END CREATE

'components for MDI
dim edit(20) as qpanel
dim img(20) as qimage
for j=0 to 20
edit(j).parent=form
edit(j).visible=false 'must be no visible
edit(j).bevelOuter=0
edit(j).color=&hffffff
img(j).AutoSize=1
img(j).Parent=edit(j)
next j

Form.SetDeskBar
Form.ShowModal

'Find free component for MDI
Function GetCtl() as integer
dim find as integer
dim h as integer

find=0
for j=0 to 20
if form.FreeChild(edit(j).handle) and find=0 then
h=j
find=1
end if
next j
result=h
End Function

SUB mnuNew_Click
dim index as integer

if form.ChildCount<form.ChildMax then
index=GetCtl()
form.AddChild(edit(index).handle,"Untitled "+STR$(UntitledCount+1),index,0,0,0,0,true)
UntitledCount++
end if
END SUB

SUB mnuOpen_Click
dim index as integer
DIM OD AS QOPENDIALOG

OD.caption="Load image"
OD.Filter="Bitmap file(*.bmp)|*.bmp"
if form.ChildCount<form.ChildMax then
IF OD.Execute THEN
IF form.ChildExist(OD.FileName) THEN
form.ActiveChild(form.GetChild(OD.FileName))
EXIT SUB
END IF
index=GetCtl()
img(index).bmp=OD.FileName
form.AddChild(edit(index).handle,OD.FileName,index,0,0,img(index).width+8,img(index).height+27,False)
UntitledCount++
END IF
end if
END SUB

SUB CloseMDI(handleChild as long,index as integer,titleChild as string)
img(index).handle=0
END SUB

SUB mnuClose_Click
form.CloseChild
if form.ChildCount=0 then stat.simpleText=""
END SUB

SUB mnuCloseAll_Click
form.CloseAllChild
if form.ChildCount=0 then stat.simpleText=""
END SUB

SUB mnuNext_Click
form.ActiveNextChild
END SUB

SUB mnuPrevious_Click
form.ActivePreviousChild
END SUB

SUB mnuCascade_Click
form.CascadeChild
END SUB

SUB mnuTileHorz_Click
form.SetHorzChild
END SUB

SUB mnuTileVert_Click
form.SetVertChild
END SUB

SUB mnuArrange_Click
form.IconArrangeChild
END SUB

SUB mnuMinAll_Click
form.MinimizeAllChild
END SUB

SUB mnuMaxAll_Click
form.MaximizeAllChild
END SUB

SUB mnuRestAll_Click
form.RestoreChild
END SUB

SUB infos(handleChild as long,index as integer,titleChild as string)
stat.simpleText=titleChild
End Sub

Sub Close
form.CloseAllChild
if form.ChildCount>0 then form.modalResult=false
if form.ChildCount=0 then icon.filename=""
End Sub

Sub KeyDown(key as word,shift as integer)
'next child with Ctrl+F6
if shift=CtrlDown and key=VK_F6 then form.ActiveNextChild
end sub


Appendix A: QImageEx

Documentation component by D.Glodt (c)2000-2004 Appendix A: QImageEx

QImageEx Component

QImageEx is a component as QImage with clipboard functions.
Image copy to clipboard is possible if image has loading with the méthod LoadFromFile.
The loading of other graphic formats is possible if the DLL Nviewlib is present in the system window
or the directory of application.

QImageEx Properties
Field | Type | R/W | Default

QImageEx Methods
Method | Type | Description | Params
CopyToClipboard | SUB(rect as QRECT) | Copy image to clipboard | 1
PasteFromClipboard | SUB | Paste image from clipboard | 0
LoadFromFile | SUB(FileName$,Width%,Height%,Real%) | Load a bitmap file | 4
 | If the parameter Real is at true, the image will load with his dimensions. |  |
CanPaste | FUNCTION | Return TRUE if image présent in the clipboard. | 0
LoadOtherImage | SUB(FileName$,Progress&,Language$) | Load image from dll Nviewlib format | 3
 | The parameter progress is use to display a bar of progression during the loading of file.(true or false) The Language parameter corresponds to the language supported by DLL |  |

QImageEx Events
Event | Type | Occurs when... | Params

QImageEx Examples

  $typecheck on
  $INCLUDE "Rapidq.inc"
  $INCLUDE "Object\QImageEx.inc"

  declare sub OuvrirClick
  declare sub QuitterClick
  declare sub Copier
  declare sub Coller
  declare sub Present

  const title="Viewer picture"
  dim source as QRECT

  CREATE Form AS QFORM
    Caption =title
    Width = 600
    Height = 600
    Center
    CREATE Menu AS QMAINMENU
      CREATE item1 AS QMENUITEM
        Caption="&Fichier"
        CREATE item2 AS QMENUITEM
          Caption="&Ouvrir"
          OnClick=OuvrirClick
        END CREATE
        CREATE item5 AS QMENUITEM
          Caption="-"
        END CREATE
        CREATE item6 AS QMENUITEM
          Caption="&Quitter"
          OnClick=QuitterClick
        END CREATE
      END CREATE
      CREATE item11 as QMENUITEM
        Caption="&Edition"
        OnClick=Present
        CREATE item12 as QMENUITEM
          Caption="&Copier"
          OnClick=Copier
        END CREATE
        CREATE item13 as QMENUITEM
          Caption="&Coller"
          OnClick=Coller
          Enabled=false
        END CREATE
      END CREATE
    END CREATE
    CREATE ScrollBox1 AS QSCROLLBOX
      AutoScroll = 1
      Align=5
      Color = &HFFFFFF
      CREATE image AS QImageEx
        Autosize=1
      END CREATE
    END CREATE
  END CREATE

  Form.ShowModal

  sub OuvrirClick
    dim file as QOPENDIALOG

    file.Filter="Fichiers bitmap(*.bmp)|*.bmp"
    file.InitialDir=CurDir$
    if file.Execute then
      image.loadFromFile(file.fileName,0,0,true)
      Form.Caption=title+"-"+file.FileName
    end if
  end sub

  sub QuitterClick
    Form.Close
  end sub

  sub Copier
    source.left=0
    source.top=0
    source.right=image.width
    source.bottom=image.height
    image.copyToClipboard(source)
  end sub

  sub coller
    image.pasteFromClipboard
  end sub

  Sub Present
    if image.canpaste then
      item13.enabled=true
    else
      item13.enabled=false
    end if
  End Sub


QListviewEx Component
Dreadsoftî Corporation
(manco un diritto riservato)
http://dreadsoft.too.it
dreadsoft@yahoo.it

A bit complex, but with a lot of enhancements. Sorting, filtering, fastclear. Data can be loaded from (and saved to) files, Qmemorystream, Qfilestream. Support for CSV files. Very flexible layout.

QListViewEx Structure

Above you can see a "section" of the QListviewEx component

QlistviewEx is made by 4 components

- ParentPanel (Blue) is the main container, if you want to resize QlistviewEx you have to resize it. Other components will follow almost automatically
- Header (Red) contains new-style column headers
- QlistviewEx (Green) is the Qlistview component itself
- Colheader (Yellow) array of Qcoolbtn

QListViewEx Properties

Field | Type | R/W | Notes
Parentpanel | QPanel | RW | The panel which contains the listview and its header. The first thing to do is assign a parent to ParentPanel.
Header | Qpanel | RW | Container for column headers
Colheader | Array of Qcoolbtn | RW | Column header
Csv | QSTRINGLIST | RW | Used to store data. It can get data directly from a file, Qmemorystream, Qfilestream (See Qstringlist documentation for details)
CsvFile | STRING | RW | Filename of a CSV file
Separator | STRING |  | Character(or string) used to separate columns in csv
FieldsCount | INTEGER | RW | Number of fields(i.e. possible columns) found in the first string of csv
Columns_Count | INTEGER | RW | Number of columns created with the addcol method (see below)
Flatheaders | INTEGER |  | Determine if column headers have a 3D border

QListviewEx Methods

Method | Type | Description | Params
Draw | void
Load | Void | Loads data from csv, separating each line in columns (using SEPARATOR)
SortBy | Sub (Criterium as String) | See tutorial for details... | 1
LoadFromCsvFile | Void | Loads data directly from csvfile, updating csv. Make sure the CsvFile Property is set
FastClear | Void | Quicker cleaning function (not needed for long lists)
Exclude | sub (Column as integer, Criterium as string) | Removes unwanted items searching for a specific value (Criterium) in the specified column
AddCol sub (ColToAdd as string)

Use this one instead of the addcolumns method. To add columns, pass a single string containing headers captions, separated by "/"

Example:
Qlistviewex.addcol "First Name/Last Name/Address/Phone Number"
UpdateCsv | void | writes QlistviewEx data to csv
Filter | sub(column as integer, criterium as string) | Keeps only specified items (see tutorial)
SaveToCsvFile | void | updates CSV and writes data to csvfile
SaveToFileAs | void | Save CSV to file (discarding QlistviewEx changes)
DirecSaveAs | void | Saves QlistviewEx data without updating CSV

The many ways to read / write data

Not quite clear yet ?

take a look at the tutorial


'================= QMAXSPLITTER ==================
'
' This one's a doozy. A splitter control that emulates all of Delphi 6's splitter styles.
' It's based on a QPanel rather than QCanvas ' like the original for two reasons:
' 1. To get a handle
' 2. To improve drawing and aligning
' There are still some issues with this component, and they are:
' 1. Mouse trapping - if you move the mouse too fast, you leave the splitter behind. SetCapture
' doesn't seem to solve the problem, maybe sub-classing in the next version...
' 2. Setting MinSize to 0 sometimes causes resizing problems, I'm sure this is an oversight
' in the math, but I can live with it for now.
' 3. There are stil problems with CREATE, most notably the order in which ALIGNed components
' are created, as well as the order in which properties are assigned to sibling windows
' (Uncomment the "Color" in Rich3 and run. See what I mean? Now place the code for Rich3 AFTER
' the code for Split3. Problem solved!)
' Anyway, I had fun with it, I hope you will too.
' Psyclops )
' P.S. Sorry for the lack of comments, maybe in the
' next release...

'====================================================
'            Sample program
'====================================================

$include  "QMaxSplitter.inc"

CREATE Form AS QFORM
    Caption = "Normal QSPLITTER - Blah!"
    Visible = 1
    Visible = 0
    CREATE Splitter AS QSPLITTER
        Align = 3
        Width  = 10
        Beveled = 1
    END CREATE
        CREATE RichEd1 AS QRichEdit
        Align = 3
    END CREATE
    CREATE RichEd2 AS QRICHEDIT
        Align = 5
    END CREATE
END CREATE

CREATE Form2 AS QFORM
    Center
    Caption = "QMAXSPLITTER - Cool!"
    CREATE Pnl1 AS QPANEL
        Align = 1
        BevelOuter = 0
         CREATE Rich3 AS QRICHEDIT
            'Color = &HFF0000
            Align = 3
        END CREATE
        CREATE Split3 AS QMAXSPLITTER
            Style = rsNone
            Beveled = 1
            Align = 3
            Cursor = -14
            Hint = "Style: rsNone"
            ShowHint = 1
        END CREATE
        CREATE Rich5 AS QRICHEDIT
            Align = 5
        END CREATE
     END CREATE
     CREATE Split1 AS QMAXSPLITTER
        Align = 1
        Style = rsSolid
        Hint = "Style: rsSolid"
        ShowHint = 1
        MinSize = 0
     END CREATE
     CREATE Pnl5 AS QPANEL
        Align = 5
        BevelOuter = 0
        CREATE Rich4 AS QRICHEDIT
            Align = 4
        END CREATE
        CREATE Split4 AS QMAXSPLITTER
            Align = 4
            Cursor = -21
            Width = 20
            Style = rsUpdate
            MinSize = 0
            Hint = "Style: rsUpdate"
            Beveled = 1
            ShowHint = 1
        END CREATE
        CREATE Panel55 AS QPANEL
            Align = 5
            BevelOuter = 0
            CREATE Rich55 AS QRICHEDIT
                Align = 5
            END CREATE
            CREATE Split2 AS QMAXSPLITTER
                Align = 2
                Hint = "Style: rsPattern"
                ShowHint = 1
                Height = 5
                MinSize = 0
            END CREATE
            CREATE Rich2 AS QRICHEDIT
                Align = 2
            END CREATE
        END CREATE
    END CREATE
END CREATE

Form.Show
Form2.Show

DO
    DoEvents
LOOP UNTIL Form2.Visible = 0


MDI Applications in Rapid-Q

Creating MDI Apps in RapidQ
-----------------------------------------------
Well, I finally cracked the MDI solution for RapidQ. Hah! This is an extreme overstatement.
RapidQ does not implement even half the code necessary to create a true MDI application.
However, it IS possible to force a good deal of the functionality necessary to get it going.
In this code, I have attempted to provide the code you'll need to get started. An MDI app
consists of three parts: the "frame", or parent window, the "client", the part that occupies
the client area of the frame window and owns the child windows, and the "child" windows.
The fsMDIParent style does work, although not all messages are translated. You can't press
Ctrl+F6 to tab to the next child, and menu shortcuts don't apply to the currently active
child. Stuff like that. Otherwise, a QFORM is a good MDI Parent. From the Delphi help file,
I've found that the "EInvalidOperation" message (for fsMDIChild) means: "EInvalidOperation
is raised when an application attempts an operation that requires a window handle on a
component [that] does not have a parent (Parent = nil)." Of course, I've tried setting the
parent of the child, nesting the child, and everything else I could think of, but nothing
works. So for now, you'll have to create your own child windows. This makes it a lot harder,
though not impossible, to manipulate the child. Using RQ components on the child is out of
the question. MDIApp.bas demonstrates creating forms with a multiline edit, it tiles,
cascades, etc. It also opens files. It is uncommented but it should be fairly easy to follow
using this code as a guide. Most of the extra work is done in the menu subs and the child
procedure (ChildProc).
Anyway, I hope this helps...If you have any specific questions about the code, post them to
the group and I'll try to answer them the best I can.

Psyclops ¬)


Новая страница 1

'============================================================================
' Subject: STANDARD MESSAGE DIALOG FUNCTION Date: 05-03-00 (21:33)
' Author: Jernej Simoncic Code: RAPIDQ
' Origin: jernej.simoncic@guest.arnes.si Packet: RAPIDQ.ABC
' .inc version and some modifications by Marcin Szafran, jm_sz@poczta.onet.pl
'============================================================================

'Shows standard Message Dialog, with buttons in local language (unlike RapidQ's
'MessageDlg, which always shows English buttons)
'
'Usage: [button& =] MsgDlg text$, title$, buttons&
'
' Thanks to RapidQ, you can use it as Sub or Function.
'
' button& Returns clicked button
' text$ Text to display in message box
' buttons& Select which buttons and icons to display and which button is
' default.
' title$ Message box title
'
'buttons& values (you can combine them):
' value description
' 0 Display OK button only.
' 1 Display OK and Cancel buttons.
' 2 Display Abort, Retry, and Ignore buttons.
' 3 Display Yes, No, and Cancel buttons.
' 4 Display Yes and No buttons.
' 5 Display Retry and Cancel buttons.
' 16 Display Critical Message icon.
' 32 Display Warning Query icon.
' 48 Display Warning Message icon.
' 64 Display Information Message icon.
' 0 First button is default.
' 256 Second button is default.
' 512 Third button is default.
' 768 Fourth button is default.
'
'So here are constans (if you'd like them)
'
const bOK = 0 ' of course you do not need to use it
const bOKCan = 1
const bAbRetIg = 2
const bYesNoCan = 3
const bYesNo = 4
const bRetCan = 5
const iCritMsg = 16
const iWarnQuery = 32
const iWarnMsg = 48
const iInfMsg = 64
const dFst = 0 ' of course you do not need to use it
const dSec = 256
const dTrd = 512
const dFth = 768
'
'button& values
' 1 OK
' 2 Cancel
' 3 Abort
' 4 Retry
' 5 Ignore
' 6 Yes
' 7 No


QMenu

QMenu by Jordi Ramos

Ownerdrawn MenuItems

QMenu Properties

Descrip AS WORD |
Panel AS WORD |
Font AS QFONT |
imgs AS QIMAGELIST | List of images for menu

Examples

$TYPECHECK ON

$INCLUDE "RAPIDQ.INC"
$INCLUDE "QMENU.INC"
'Also Api.inc is needed
$RESOURCE New_bmp as "New.bmp"
$RESOURCE Open_bmp as "Open.bmp"
$RESOURCE Save_bmp as "Save.bmp"
$RESOURCE Exit_bmp as "Exit.bmp"
$RESOURCE Cut_bmp as "Cut.bmp"
$RESOURCE Copy_bmp as "Copy.bmp"
$RESOURCE Paste_bmp as "Paste.bmp"

Declare Sub FormClose (Action As integer)
Declare Sub NewItemClick (Sender As QMENUITEM)
Declare Sub ExitItemClick (Sender As QMENUITEM)

CREATE Form2 As QFORM
    Caption = "New Form"
    Width = 200
    Height = 100
    Center
END CREATE

CREATE Form As QForm
   Width = 400
   Center
   Caption = "Ownerdraw Menus"
   onClose = FormClose

   CREATE MainMenu As QMainMenu
      CREATE FileMenu As QMenuItem
         Caption = "&File"
         CREATE NewItem As QMenuItem
            Caption = "&New"
            Hint = "New"
            onclick = NewItemClick
         END CREATE
         CREATE OpenItem As QMenuItem
            Caption = "&Open..."
            Hint = "Open"
            ShortCut = "Ctrl+O"
         END CREATE
         CREATE SaveItem As QMenuItem
            Caption = "&Save"
            Hint = "Save"
         END CREATE
         CREATE SaveASItem As QMenuItem
            Caption = "Sa&ve as..."
            Hint = "Save as"
         END CREATE
         CREATE BreakItem As QMenuItem
            Caption = "-"
         END CREATE
         CREATE ExitItem As QMenuItem
            Caption = "E&xit"
            onclick = ExitItemClick
         END CREATE
      END CREATE
      CREATE EditMenu As QMenuItem
         Caption = "&Edit"
         CREATE CutItem As QMenuItem
             Caption = "Cu&t"
             ShortCut = "Ctrl+X"
         END CREATE
         CREATE CopyItem As QMenuItem
             Caption = "&Copy"
         END CREATE
         CREATE PasteItem As QMenuItem
             Caption = "&Paste"
         END CREATE

      END CREATE
      CREATE SearchMenu As QMenuItem
         Caption = "&Search"
         CREATE FindItem As QMenuItem
             Caption = "&Find"
         END CREATE
         CREATE ReplaceItem As QMenuItem
             Caption = "&Replace"
         END CREATE
       END CREATE
    END CREATE

    CREATE StatusBar As QStatusBar
       AddPanels "QMenu by Jordi Ramos",""
       panel(0).Width = 120
    END CREATE

END CREATE

dim imglst as qimagelist                'List of images for menu
   imglst.masked = False
   imglst.addbmphandle New_bmp,0
   imglst.addbmphandle Open_bmp,0
   imglst.addbmphandle Save_bmp,0
   imglst.addbmphandle Exit_bmp,0
   imglst.addbmphandle Cut_bmp,0
   imglst.addbmphandle Copy_bmp,0
   imglst.addbmphandle Paste_bmp,0

DIM OwnerMenu as QMENU
   OwnerMenu.Set Form

   OwnerMenu.Descrip = TRUE
   OwnerMenu.Panel = 1

   OwnerMenu.Imgs.Handle = imglst.handle

   OwnerMenu.OwnerDraw FileMenu, NewItem, 0, "Creates a new document"
   OwnerMenu.OwnerDraw FileMenu, OpenItem, 1, "Opens a Document"
   OwnerMenu.OwnerDraw FileMenu, SaveItem, 2, "Save Document"
   OwnerMenu.OwnerDraw FileMenu, ExitItem, 3, "Exits Program"
   OwnerMenu.OwnerDraw EditMenu, CutItem, 4, "Cuts Selection to Clipboard"
   OwnerMenu.OwnerDraw EditMenu, CopyItem, 5, "Copies Selection to Clipboard"
   OwnerMenu.OwnerDraw EditMenu, PasteItem, 6, "Pastes Contents of Clipboard"

   OwnerMenu.Description SaveAsItem, "Save Document as"
   OwnerMenu.Description FindItem, "Search for a text string"
   OwnerMenu.Description ReplaceItem, "Replace a character string by another"

Form.ShowModal

SUB NewItemClick (Sender AS QMENUITEM)
   Form2.ShowModal
end Sub

SUB ExitItemClick (Sender AS QMENUITEM)
   Form.close
end Sub

sub FormClose (Action as integer)
   OwnerMenu.Close
end Sub


Appendix A: QProgress

Documentation component by D.Glodt (c)2000-2001 Appendix A: QProgress

QProgress Component

QProgressBar is a progress bar.Used visually to give users the progress of an operation.

QProgress Properties
Field | Type | R/W | Défault
Handle | INTEGER | RW |
Height | INTEGER | RW |
Left | INTEGER | RW | 0
Parent | Handle QFORM/QPANEL/QTABCONTROL | RW |
Top | INTEGER | RW | 0
Width | INTEGER | RW |
Visible | INTEGER | RW | True
Value | INTEGER | RW |
 | Progress value.

QProgress Methods
Method | Type | Description | Params

QProgress Events
Event | Type | Occurs when... | Params

QProgress Examples

$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QProgress.inc"

Declare Sub Start
Declare Sub Display

dim pourcent as integer
dim tempo as QTIMER
tempo.interval=100
tempo.enabled=False
tempo.OnTimer=Display
dim Bar as QProgress

CREATE Form AS QFORM
Caption = "Progress Bar"
Width = 350
Height = 180
Center
CREATE Button1 AS QBUTTON
Caption = "Start"
Left = 125
Top = 100
OnClick=Start
END CREATE
END CREATE
Bar.parent=form.handle
Bar.left=10
Bar.Top=40
Bar.Width=305
Bar.Height=25
Form.ShowModal

Sub Display
if pourcent<100 then
pourcent=pourcent+1
Bar.Value=pourcent
else
tempo.enabled=False
end if
End Sub

Sub Start
pourcent=0
Bar.Value=0
tempo.enabled=True
End Sub


Appendix A: QPageSetup

Documentation component by D.Glodt (c)2000-2002 Appendix A: QPageSetup

QPageSetup Component

QPageSetup is a printer dialog box.

WARNING:don't use Caption property with an other component using a WindowProc.

QPageSetup Properties
Field | Type | R/W | Défault
DisablePrinter | BOOLEAN | R/W | False
 | Printer configuration. |  |
DisablePaper | BOOLEAN | R/W | False
 | Choice of paper. |  |
DisableOrient | BOOLEAN | R/W | False
 | Selection paper orientation. |  |
DisableMargins | BOOLEAN | R/W | False
 | Margins paper |  |
Orinetation | BOOLEAN | R | FALSE
 | Orientation paper ,true value is landscape?false is portrait |  |
MarginLeft | LONG | R/W | 0
 | Margin left in mm |  |
MarginTop | LONG | R/W | 0
 | Margin top in mm |  |
MarginRight | LONG | R/W | 0
 | Margin right in mm |  |
MarginBottom | LONG | R/W | 0
 | Margin bottom in mm |  |
PageWidth | LONG | R |
 | Page width in mm |  |
PageHeight | LONG | R |
 | Page height in mm |  |
Caption | STRING | RW |
 | Title dialog box |  |

QPageSetup Methods
Method | Type | Description | Params
Execute | SUB | Show printer dialog box |

QPageSetup Events
Event | Type | Occurs when... | Params

QPageSetup Examples
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QPageSetup.inc"

Declare Sub PageDlg

Dim Setup as QPageSetup
CREATE Form AS QFORM
Caption = "Mise en page"
Width = 300
Height =200
Center
CREATE Label1 AS QLABEL
Caption = ""
Left=12
Top=14
Width=200
Height=100
END CREATE
CREATE Button1 AS QBUTTON
Caption="Setup"
Left=100
Top=120
OnClick=PageDlg
END CREATE
END CREATE
Setup.MarginLeft=25
Setup.MarginTop=25
Setup.MarginRight=25
Setup.MarginBottom=25
Setup.Caption="Mise en page"
Form.ShowModal

Sub PageDlg
If Setup.Execute then
label1.caption="MarginLeft:"+str$(setup.marginLeft)+chr$(13)+ _
"MarginTop:"+str$(setup.marginTop)+chr$(13)+ _
"MarginRight:"+str$(setup.marginRight)+chr$(13)+ _
"MarginBottom:"+str$(setup.marginBottom)+chr$(13)+ _
"PageWidth:"+str$(setup.pageWidth)+chr$(13)+ _
"PageHeight:"+str$(setup.pageHeight)+chr$(13)+ _
"Orinetation:"+str$(setup.orientation)
end if
End Sub


Appendix A: QPrinterInfo

Documentation component by D.Glodt (c)2002-2003 Appendix A: QPrinterInfo

QPrinterInfo Component

QPrinterInfo is a component with more information about défault printer.

QPrinterInfo Properties
Field | Type | R/W | Default

QPrinterInfo Methods
Method | Type | Description | Params
Scale | FUNCTION AS DOUBLE | return the printer scale for image bitmap | 0
Dpi | FUNCTION AS INTEGER | return number of points by inch | 0
Ppm | FUNCTION AS DOUBLE | return number of pixels by millimeter | 0
MetricToPixel | FUNCTION(mm as double) AS INTEGER | return convert millimeters to pixels | 1
PixelToMetric | FUNCTION(pixel&) AS DOUBLE | return convert pixels en millimeters | 1
HorzPageSize | FUNCTION AS INTEGER | return page width to millimeters | 0
VertPageSize | FUNCTION AS INTEGER | return page height to millimeters | 0
PageWidth | FUNCTION AS INTEGER | return page width to pixels | 0
PageHeight | FUNCTION AS INTEGER | return page height to pixels | 0
PhWidth | FUNCTION AS INTEGER | return physical page width to pixels | 0
PhHeight | FUNCTION AS INTEGER | return physical page height to pixels | 0
PhHorz | FUNCTION AS INTEGER | return physical page width to millimeters |
PhVert | FUNCTION AS INTEGER | return physical page height to millimeters | 0
PhMarginX | FUNCTION AS DOUBLE | return physical margin x to millimeters | 0
PhMarginY | FUNCTION AS DOUBLE | return physical margin y to millimetres | 0
PhLeftMargin | FUNCTION AS INTEGER | return physical margin x to pixels | 0
PhTopMargin | FUNCTION AS INTEGER | return physical margin y to pixels | 0

QPrinterInfo Events
Event | Type | Occurs when... | Params

QPrinterInfo Exemples


RQDialog

' RQDIALOG.INC BILL K 1-2003
' Displays Window's Open and Save Dialogs
' The main advantage of this INC is that the Dialog is the Sizeable Type
' It also by default shows the windows overwrite warning on the Savedialog
' this can be optioned out if no warning is desired.
' All the other parameters are the same as the QDialogs
' USAGE: MYFILENAME$=RQSHOWDIALOG(MyCaption$, _ ' default is "Open" or "Save"
' MyFilter$, _ ' default is All Files
' FilterIndex%, _ ' default is 0
' MyInitialDirectory$, _ ' default is current directory
' WantSaveDialog%, _ ' 1=Save 0=Open - default is Open
' NoOverwriteWarning%, _ ' default is 0
' MyFormHandle&) ' Form handle or 0 .. default is 0 - see below
'
' WantSaveDialog%=1 for a Save Dialog =0 for an Open Dialog
' NoOverwriteWarning%=1 for defeating the default warning when about to overwrite an existing file
' MyFormHandle& = MyForm.Handle ( so that the dialog knows which form
' to be modal to and where to locate) =0 for nonmodal(not advised)
'
' EXAMPLE: FileName$=RQShowDialog("Save File","RQ Files|*.bas;*.rqb","C:\RapidQ",1,0,Form.Handle)


Новая страница 1

' ======================================= '
' About QSavePlus
' ======================================= '
'-- QSavePlus is extends from QSaveDialog ,
'-- 1) If don't found any extension or found unusual extension in FileName,
'-- will show Add Extension Confirm Dialog.
'-- 2) Plus directory and FileName Checking.
'-- 3) show Confirm Dialog before save exist file.
'-- This code only test on Win98.

' Author : Suchart Chokphichitchai
' E-mail : dragon_html@yahoo.com
' My skillfull about English Language is very weak.
' If you don't understand the description,
' or you found bug of this code.
' Please contact me to modify it.


QSpinText

 ' Qspintext component for Rapid-Q by Mesut Akcan
' ver : 1.01
' 7 July 2000, update : 7 Sept. 2000
' http://kaynak.cjb.net
' http://makcan.virtualave.net
' makcan@softhome.net
$typecheck on
type Qspintext extends qpanel
max as short
min as short
value as short
ed as qedit
sb as qscrollbar
sub initial
with Qspintext
.sb.max=.min * -1
.sb.min=.max * -1
.ed.text=str$(.value)
.ed.parent=Qspintext
.sb.parent=Qspintext
end with
end sub
constructor
width=50 : height=22
sb.kind=1
sb.width=18
sb.top=2 : ed.top=3
ed.left=2
ed.height=16 : sb.height=18
sb.left=Qspintext.width - 20
ed.borderstyle=0
ed.width=Qspintext.width - 22
bevelouter=1
end constructor
event sb.onchange
dim p as short
with Qspintext
p=.sb.position * -1
.ed.text=str$(p)
.value=p
end with
end event
event ed.onchange
Qspintext.sb.position=val(Qspintext.ed.text) * -1
end event
event ed.onkeydown (key as word, shift as integer)
dim p as short
p=Qspintext.sb.position
if key=38 then p-- ' up
if key=40 then p++ ' dw
Qspintext.sb.position = p
end event
end type


Appendix A: QStatusBarEx

Documentation component by D.Glodt (c)2003 Appendix A: QStatusBarEx

QStatusBarEx Component

QStatusBarEx is identical as QStatusBar with addition of QPanel components in order to be able to post images or other components.
It is necessary to use the AddPanel method before adding a QPanel component.

QStatusBarEx Property
Field | Type | R/W | Défault

QStatusBarEx Methods
Method | Type | Description | Params
AddOptPanel | SUB(QPANEL,index&) | Add a QPanel component in an existing panel, the parameter index& determines the position in the bar when several panel were added, a value 0 corresponds to the first panel of the bar. The Height property of the QPanel component must be lower at the Height property of the bar. | 2

QStatusBarEx Events
Event | Type | Occurs when... | Params

QStatusBarEx Examples
$TYPECHECK ON
$resource BM_OPEN as "open.bmp"
$include "Object\QStatusBarEx.inc"
CREATE Form AS QFORM
Caption="Form1"
Width=400
Height=240
Center
CREATE Panel as QPANEL
CREATE img as QIMAGE
bmpHandle=BM_OPEN
END CREATE
END CREATE
CREATE StatusBar1 AS QSTATUSBAREX
height=20
AddPanels "","","",""
Panel(0).Width=100
Panel(1).Width=100
Panel(2).Width=100
AddOptPanel Panel,1
END CREATE
END CREATE

Form.ShowModal


Appendix A: QStringGridEx

Documentation component by D.Glodt (c)2003 Appendix A: QStringGridExt

QStringGridEx Component

QStringGridEx is identical as QStringGrid allowing the use of the style of the lines identical to the columns.

This component uses a template parameter to define the number of row used.(dim grid have QStringGridEx<Size >)
The use of events OnSelectCell and OnDrawCell requires the use of the key word < inherit >.

QStringGridEx Properties
Field | Type | R/W | Défault
RowStyle | ARRAY OF INTEGER | R/W |
 | RowStyle determines the style of each row. 2 = grsList -- Row with a drop-down list for each item 1 = grsEllipsis -- Row with an ellipsis button for each item 0 = grsNone -- Normal row |  | grsNone
RowList | ARRAY OF STRING | R/W |
 | RowList maintains a list of strings deliminated by LF for use in Row lists. |  |

QStringGridEx Methods
Method | Type | Description | Params

QStringGridEx Events
Event | Type | Occurs when... | Params

QStringGridEx Example
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$INCLUDE "Object\QStringGridEx.inc"
$ESCAPECHARS ON

CONST AgeList = "10\n11\n12\n13\n14\n15\n16\n17\n18\n19"

SUB EllipsisClick (Col AS LONG, Row AS LONG, Sender AS QSTRINGGRID)
Sender.Cell(Col, Row) = "Comments"+STR$(Row)
END SUB

CREATE Form AS QFORM
CREATE Grid AS QStringGridEx<1000> '1000 row
Align=alClient
AddOptions(goEditing,goColSizing)
FixedRows=1
FixedCols=1
ColCount=3
RowCount=5
DefaultRowHeight=20
DefaultColWidth=100
RowList(1)=AgeList
RowStyle(1)=grsList
RowStyle(2)=grsEllipsis
Cell(0,0)="Age"
Cell(1,0)="Comments"
OnEllipsisClick=EllipsisClick
END CREATE
Caption="Dropdown list example"
Center
END CREATE
form.ShowModal


Appendix A: QTextBtn

Documentation component by D.Glodt (c)2003 Appendix A: QTextBtn

QTextBtn Component

QTextBtn is button component of text type.

QTextBtn Properties
Field | Type | R/W | Défault
DownColor | LONG | R/W | 0
 | Down state color. |  |
UpColor | LONG | R/W |
 | Up state color. |  |
mode | SHORT | R/W | 0
 | Run mode button Mode to 0:same to a QButton Mode to 1:button stay a the down state after click. Mode to 2:button change state after each click. |  |
down | BOOLEAN | R/W | FALSE
 | down state of button |  |
Enabled | BOOLEAN | R/W | TRUE
Parent | QFORM,QPANEL,QTABCONTROL | W |
Left | INTEGER | R/W | 0
Top | INTEGER | R/W | 0

QTextBtn Methods
Method | Type | Description | Params

QTextBtn Events
Event | Type | Occurs when... | Params
OnClick |  | Click on button | 0

QTextBtn Example
$typecheck on
$optimize on
$include "Rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QSkin.inc"
$include "Object\QSkinBtn.inc"
$include "Object\QTextBtn.inc"
$include "Object\QFlashLabel.inc"
$include "Object\QVuMeter.inc"
$include "Object\QVideo.inc"

$resource img as "skin3.bmp"
$resource play1 as "play1.bmp"
$resource play2 as "play2.bmp"
$resource stop1 as "stop1.bmp"
$resource stop2 as "stop2.bmp"
$resource pause1 as "pause1.bmp"
$resource pause2 as "pause2.bmp"
$resource back1 as "back1.bmp"
$resource back2 as "back2.bmp"
$resource fwd1 as "foreward1.bmp"
$resource fwd2 as "foreward2.bmp"
$resource power1 as "power1.bmp"
$resource power2 as "power2.bmp"

declare sub quit
declare sub volume
declare sub SetVolume
declare sub open
declare sub play
declare sub stop
declare sub foreward
declare sub backward
declare sub pause
Declare Sub ShowTime(Position as long,timePos aslong)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"

Dim OpenDialog asQOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"

CREATE Form ASQSkin
Center
skin.bmpHandle=img
skin.top=-1
skin.left=-1
caption="Player"
OffsWidth=-5
create display asqpanel
top=20
left=16
width=311
height=72
bevelinner=0
bevelouter=0
color=&h994400
create bar asqpanel
top=50
left=0
width=display.width
height=2
bevelinner=0
bevelouter=0
color=color1
end create
create FlashPlay
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=2
caption="Play"
end create
create FlashStop
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=16
caption="Stop"
state=true
end create
create FlashPause
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=30
caption="Pause"
end create
create FlashTime
asQFlashlabel
DarkColor=color1
LightColor=color2
left=150
top=6
font.size=24
caption=RazClock
State=true
end create
create vu asQVuMeter
top=1
left=290
width=10
height=45
DarkColor=color1
LightColor=color2
value=50
end create
create btOpen
asQTextBtn
UpColor=color1
DownColor=color2
left=5
top=55
font.bold=true
caption="Open"
OnClick=open
end create
create btVol
asQTextBtn
UpColor=color1
DownColor=color2
left=265
top=55
font.bold=true
caption="Volume"
OnClick=Volume
end create
end create
create btPlay asQskinBtn
btUp.bmphandle=play1
btDown.bmphandle=play2
top=110
left=12
mode=1
OnClick=play
end create
create btStop asQskinBtn
btUp.bmphandle=stop1
btDown.bmphandle=stop2
top=110
left=44
OnClick=stop
end create
create btPause asQskinBtn
btUp.bmphandle=pause1
btDown.bmphandle=pause2
top=110
left=76
mode=1
OnClick=pause
end create
create btBack asQskinBtn
btUp.bmphandle=back1
btDown.bmphandle=back2
top=110
left=108
OnClick=backward
end create
create btFwd asQskinBtn
btUp.bmphandle=fwd1
btDown.bmphandle=fwd2
top=110
left=140
OnClick=foreward
end create
create btPower asQskinBtn
btUp.bmphandle=power1
btDown.bmphandle=power2
top=110
left=300
OnClick=quit
end create
END CREATE

CREATE Form2 ASQFORM
Caption="Volume"
Width=60
Height=190
Center
borderStyle=bsToolWindow
CREATE TbVol ASQTRACKBAR
cursor=crHandPoint
Orientation=tbVertical
Frequency=5
TickMarks=tmBoth
TickStyle=tsAuto
Left=5
Top=5
Max=0
Min=-100
Width=45
Height=150
position=-50
OnChange=SetVolume
END CREATE
END CREATE

CREATE video ASQVideo
Parent=0
volume=50
OnChange=ShowTime
timer.interval=200
BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff)
form.setdeskbar
Form.ShowModal

Sub quit
video.close
form2.close
application.terminate
End Sub

Sub volume
form2.show
End Sub

Sub SetVolume
vu.value=Abs(TbVol.position)
video.volume=Abs(TbVol.position)
End Sub

Sub open
If OpenDialog.Execute Then
video.close
if video.open(OpenDialog.FileName)then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
video.caption=GetFileName(OpenDialog.FileName)
else
showmessage
video.error
end if
end if
End Sub

Sub play
if video.FileOpen=false
then
btPlay.Down=false
else
FlashPause.flash=false
FlashStop.state=false
FlashPlay.state=true
btPause.Down=false
video.play
end if
End Sub

Sub stop
video.stop
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
End Sub

Function GetMinutes(seconds aslong)asstring
dim min asinteger
dim sec asinteger
dim sMin asstring
dim sSec asstring

min=seconds/60
sec=seconds mod 60
if min<10 then
sMin="0"+str$(min)
else
sMin=str$(min)
end if
if sec<10 then
sSec="0"+str$(sec)
else
sSec=str$(sec)
end if
result=sMin+":"+sSec
End Function

Sub ShowTime(Position aslong,timePos
aslong)
FlashTime.caption=GetMinutes(timePos)
If Video.State=VD_STOP then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
end if
End Sub

Sub pause
if video.state=VD_PLAY then
video.pause
btPlay.down=false
FlashPlay.state=false
FlashPause.flash=true
else
if video.FileOpen=false
then
btPause.Down=false
end if
End Sub

Sub foreward
if (video.currentFrame+1)<video.lenght
then
video.currentFrame=video.currentFrame+1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub

Sub backward
if video.currentFrame>0 then
video.currentFrame=video.currentFrame-1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub


Appendix A: QTextEdit

Documentation component by D.Glodt (c)2000-2001 Appendix A: QTextEdit

QTextEdit Component

QTextEdit is an extension of QRichEdit component with more functions.

QTextEdit Properties
Field | Type | R/W | Default
UsePopup | BOOLEAN | RW | True
 | To use a popup menu with the right mouse button. |  |
UndoCaption | STRING | RW | Undo
 | Label of item Undo of popup menu.
CutCaption | STRING | RW | Cut
 | Label of item Cut of popup menu.
CopyCaption | STRING | RW | Copy
 | Label of item Copy of popup menu.
PasteCaption | STRING | RW | Paste
 | Label of item Paste of popup menu. |  |
SelectAllCaption | STRING | RW | SelectAll
 | Label of item SelectAll of popup menu. |  |

QTextEdit Methods
Method | Type | Description | Params
Undo | SUB | Undo command. |
Cut | SUB | Cut command |
Copy | SUB | Copy to clipboard. |
Paste | SUB | Paste from clipboard. |
Limit | SUB(Value%) | Limit the size text (number of char) | 1
ReplaceSell | SUB(Text$) | Replace the selection by the Text$ parameter. | 1
Find | FUNCTION(start%,text$,case%) AS BOOLEAN | Search the string into the text,start is the start of search,case is to respect the format of char (upper,lower) | 3
LinesScroll | SUB(Number) | Place the cursor to the line number | 1
CanUndo | FUNCTION AS BOOLEAN | Return if undo is possible |

QTextEdit Events
Event | Type | Occurs when... | Params

QTextEdit Examples

$OPTION ICON "edit.ico"
$TYPECHECK ON
$INCLUDE "Rapidq.inc"
$INCLUDE "Object/QTextEdit.inc"
$INCLUDE "Object/QColorDialog.inc"
$INCLUDE "Object/QFormEx.inc"

declare sub menuEdit
declare sub menuAnnul
declare sub menuCouper
declare sub menuCopier
declare sub menuColler
declare sub menuSelection
declare sub menuNouveau
declare sub menuOuvrir
declare sub menuSauver
declare sub menuSauverSous
declare sub menuQuitter
declare sub menuRecherche
declare sub menuPoursuivre
declare sub menuRemplacer
declare sub ShowLC
declare sub ChangePolice
declare sub ChangeFond
declare sub ChangeTextRecherche
declare sub ChangeTextRemplacer
declare sub AnnulerRecherche
declare sub AnnulerRemplacer
declare sub PoursuivreRecherche
declare sub PoursuivreRemplacer
declare sub Remplacer
declare sub RemplacerTout
declare sub Show

dim FontDialog as QFONTDIALOG
dim cd as QcolorDialog
cd.caption="Couleur de fond"
dim FileName as string
FileName="Sans Titre"
dim start as long

CREATE Form AS QFORMEX
Caption=Application.title+" - "+FileName
Width=715
Height=508
Center
OnClose=MenuQuitter
OnShow=Show
CREATE Menu as QMAINMENU
CREATE Fichier as QMENUITEM
Caption="&Fichier"
CREATE Nouveau as QMENUITEM
Caption="&Nouveau"
OnClick=MenuNouveau
END CREATE
CREATE Ouvrir as QMENUITEM
Caption="&Ouvrir"
OnClick=MenuOuvrir
END CREATE
CREATE Sauver as QMENUITEM
Caption="&Sauver"
OnClick=MenuSauver
END CREATE
CREATE SauverSous as QMENUITEM
Caption="&Sauver Sous..."
OnClick=MenuSauverSous
END CREATE
CREATE Sep3 as QMENUITEM
Caption="-"
END CREATE
CREATE Quitter as QMENUITEM
Caption="&Quitter"
OnClick=MenuQuitter
END CREATE
END CREATE
CREATE Edition as QMENUITEM
Caption="&Edition"
OnClick=menuEdit
CREATE Annul as QMENUITEM
Caption="&Annuler"
Enabled=false
ShortCut="CTRL+Z"
OnClick=MenuAnnul
END CREATE
CREATE Sep1 as QMENUITEM
Caption="-"
END CREATE
CREATE Couper as QMENUITEM
Caption="&Couper"
Enabled=false
ShortCut="CTRL+X"
OnClick=MenuCouper
END CREATE
CREATE Copier as QMENUITEM
Caption="&Copier"
Enabled=false
ShortCut="CTRL+C"
OnClick=MenuCopier
END CREATE
CREATE Coller as QMENUITEM
Caption="&Coller"
Enabled=false
ShortCut="CTRL+V"
OnClick=MenuColler
END CREATE
CREATE Sep2 as QMENUITEM
Caption="-"
END CREATE
CREATE Selection as QMENUITEM
Caption="&Selectionner tout"
Enabled=false
ShortCut="CTRL+A"
OnClick=MenuSelection
END CREATE
END CREATE
CREATE Recherche as QMENUITEM
Caption="&Recherche"
CREATE Rechercher as QMENUITEM
Caption="&Rechercher"
OnClick=MenuRecherche
END CREATE
CREATE Poursuivre as QMENUITEM
Caption="&Poursuivre la recherche"
OnClick=MenuPoursuivre
END CREATE
CREATE Remplace as QMENUITEM
Caption="&Remplacer"
OnClick=MenuRemplacer
END CREATE
END CREATE
CREATE Format as QMENUITEM
Caption="&Format"
CREATE Police as QMENUITEM
Caption="&Police"
OnClick=ChangePolice
END CREATE
CREATE CouleurFond as QMENUITEM
Caption="&Couleur fond"
OnClick=ChangeFond
END CREATE
END CREATE
END CREATE
CREATE infos AS QSTATUSBAR
AddPanels "Li:","Col:","Taille:"
Panel(0).width=80
Panel(1).width=80
END CREATE
CREATE Edit AS QTEXTEDIT
Align=5
PlainText=1
ScrollBars=3
WordWrap=false
UndoCaption="&Annuler"
CutCaption="&Couper"
CopyCaption="&Copier"
PasteCaption="&Coller"
SelectAllCaption="&Selectionner tout"
OnMouseDown=ShowLC
OnKeyUp=ShowLC
END CREATE
END CREATE

CREATE Form2 AS QFORM
Caption="Rechercher"
Width=326
Height=119
borderStyle=bsDialog
Center
CREATE LabRech AS QLABEL
Caption="Rechercher:"
Left=8
Top=12
Width=64
Height=21
END CREATE
CREATE EditRech AS QEDIT
Left=74
Top=9
Width=145
ShowHint=1
Hint="Mot recherché"
OnChange=ChangeTextRecherche
TabOrder=1
END CREATE
CREATE BtRech1 AS QBUTTON
Caption="Poursuivre"
Left=229
Top=9
Width=80
TabOrder=2
Enabled=false
OnClick=PoursuivreRecherche
END CREATE
CREATE BtRech2 AS QBUTTON
Caption="Annuler"
Left=229
Top=41
Width=80
TabOrder=3
OnClick=AnnulerRecherche
END CREATE
CREATE CheckRech AS QCHECKBOX
Caption="Respecter la casse"
Left=8
Top=57
Width=113
ShowHint=1
Hint="Respect majuscule
et minuscule si coché"
TabOrder=4
END CREATE
END CREATE

CREATE Form3 AS QFORM
Caption="Remplacer"
Width=362
Height=177
borderStyle=bsDialog
Center
CREATE Lab1Repl AS QLABEL
Caption="Rechercher:"
Left=8
Top=11
Width=64
END CREATE
CREATE Lab2Repl AS QLABEL
Caption="Remplacer par:"
Left=8
Top=43
Width=75
END CREATE
CREATE Edit1Repl AS QEDIT
Left=82
Top=8
Width=145
TabOrder=1
OnChange=ChangeTextRemplacer
END CREATE
CREATE Edit2Repl AS QEDIT
Left=82
Top=40
Width=145
TabOrder=2
END CREATE
CREATE Bt1Repl AS QBUTTON
Caption="Poursuivre"
Left=237
Top=8
Width=107
TabOrder=3
Enabled=false
OnClick=PoursuivreRemplacer
END CREATE
CREATE Bt2Repl AS QBUTTON
Caption="Remplacer"
Left=237
Top=40
Width=107
TabOrder=4
Enabled=false
OnClick=Remplacer
END CREATE
CREATE Bt3Repl AS QBUTTON
Caption="Remplacer tout"
Left=237
Top=72
Width=107
TabOrder=5
Enabled=false
OnClick=RemplacerTout
END CREATE
CREATE Bt4Repl AS QBUTTON
Caption="Annuler"
Left=237
Top=104
Width=107
TabOrder=6
OnClick=AnnulerRemplacer
END CREATE
CREATE CheckRepl AS QCHECKBOX
Caption="Respecter la casse"
Left=8
Top=114
Width=121
TabOrder=7
END CREATE
END CREATE

form.DeskBar=true

Form.ShowModal

sub Show
dim font as Qfont

edit.limit(100000)
font.Name="Courier New"
font.size=10
edit.font=font
FontDialog.GetFont(font)
end sub

sub menuEdit
Annul.Enabled=Edit.CanUndo
if LEN(ClipBoard.Text)>0 then
Coller.Enabled=true
else
Coller.Enabled=false
end if
if len(edit.text)>0 then
selection.enabled=true
else
selection.enabled=false
end if
if len(edit.seltext)>0 then
couper.enabled=true
copier.enabled=true
else
couper.enabled=false
copier.enabled=false
end if
end sub

sub menuAnnul
edit.undo
ShowLC
end sub

sub menuCouper
edit.cut
ShowLC
end sub

sub menuCopier
edit.copy
end sub

sub menuColler
edit.paste
ShowLC
end sub

sub menuSelection
edit.selectAll
end sub

sub ShowLC
infos.panel(0).caption="Li:"+str$(edit.wherey+1)
infos.panel(1).caption="Col:"+str$(edit.wherex+1)
infos.panel(2).caption="Taille:"+str$(len(edit.text))
end sub

sub ChangePolice
dim font as qfont

if FontDialog.execute then
FontDialog.SetFont(font)
edit.font=font
end if
end sub

sub changeFond
if cd.execute then
edit.color=cd.color
end if
end sub

sub menuNouveau
Dim msgButton as integer

if edit.modified then
msgButton=MessageBox("Sauver fichier?",application.title,35)
if msgButton<>mrCancel then
if msgButton=mrYes then
menuSauver
end if
edit.Modified=false
edit.clear
filename="Sans Titre"
form.caption=application.title+" - "+filename
end if
else
edit.clear
filename="Sans Titre"
form.caption=application.title+" - "+filename
end if
ShowLC
end sub

sub menuOuvrir
Dim OpenDialog as QOpenDialog
Dim msgButton as integer

  OpenDialog.Filter="Fichier texte|*.txt|"
OpenDialog.Caption= "Ouvrir fichier"
if edit.modified then
msgButton=MessageBox("Sauver fichier?",application.title,35)
if msgButton<>mrCancel then
if msgButton=mrYes then
menuSauver
end if
OpenDialog.InitialDir=CurDir$
if openDialog.execute then
FileName=OpenDialog.fileName
screen.cursor=crHourGlass
edit.loadfromfile(filename)
screen.cursor=crDefault
edit.modified=false
form.caption=application.title+"
- "+right$(FileName,Len(FileName)-RINSTR(FileName,"\"))
end if
end if
else
OpenDialog.InitialDir=CurDir$
if openDialog.execute then
FileName=OpenDialog.fileName
screen.cursor=crHourGlass
edit.loadfromfile(filename)
screen.cursor=crDefault
edit.modified=false
form.caption=application.title+" - "+right$(FileName,Len(FileName)-RINSTR(FileName,"\"))
end if
end if
ShowLC
end sub

sub menuSauver
if FileName="Sans Titre" then
menuSauverSous
else
screen.cursor=crHourGlass
edit.SaveToFile(filename)
screen.cursor=crDefault
end if
end sub

sub menuSauverSous
Dim SaveDialog as QSaveDialog

SaveDialog.Filter="Fichier texte|*.txt|"
SaveDialog.Caption= "Sauver fichier"
SaveDialog.InitialDir=CurDir$
if saveDialog.execute then
FileName=SaveDialog.FileName
if instr(LCASE$(FileName),".txt")=0 then
FileName=FileName+".txt"
end if
form.caption=application.title+" - "+right$(FileName,Len(FileName)-RINSTR(FileName,"\"))
screen.cursor=crHourGlass
edit.SaveToFile(filename)
screen.cursor=crDefault
end if
end sub

sub menuQuitter
Dim msgButton as integer

if edit.modified then
msgButton=MessageBox("Sauver fichier?",application.title,35)
if msgButton<>mrCancel then
if msgButton=mrYes then
menuSauver
end if
edit.clear
application.terminate
end if
else
edit.clear
application.terminate
end if
end sub

sub ChangeTextRecherche
if len(editRech.text)>0 then
BtRech1.enabled=true
else
BtRech1.enabled=false
end if
end sub

sub menuRecherche
form2.show
end sub

sub menuRemplacer
form3.show
end sub

sub AnnulerRecherche
form2.close
end sub

sub PoursuivreRecherche
dim flag as integer

flag=checkRech.checked
if edit.seltext="" then start=edit.selstart
if edit.find(start,editRech.text,flag)>0 then
form.show
start=edit.find(start,editRech.text,flag)
start=start+len(editRech.text)
else
messageDlg("Impossible de trouver "+chr$(34)+editRech.text+chr$(34),mtInformation,mbOk,0)
end if
end sub

sub MenuPoursuivre
dim flag as integer

flag=checkRech.checked
if edit.seltext="" then start=edit.selstart
if edit.find(start,editRech.text,flag)>0 then
start=edit.find(start,editRech.text,flag)
start=start+len(editRech.text)
else
messageDlg("Impossible de trouver "+chr$(34)+editRech.text+chr$(34),mtInformation,mbOk,0)
end if
end sub

sub ChangeTextRemplacer
if len(edit1Repl.text)>0 then
Bt1Repl.enabled=true
Bt2Repl.enabled=true
Bt3Repl.enabled=true
else
Bt1Repl.enabled=false
Bt2Repl.enabled=false
Bt3Repl.enabled=false
end if
end sub

sub AnnulerRemplacer
form3.close
end sub

sub PoursuivreRemplacer
dim flag as integer

flag=checkRepl.checked
if edit.seltext="" then start=edit.selstart
if edit.find(start,edit1Repl.text,flag)>0 then
form.show
start=edit.find(start,edit1Repl.text,flag)
start=start+len(edit1Repl.text)
else
messageDlg("Impossible de trouver "+chr$(34)+edit1Repl.text+chr$(34),mtInformation,mbOk,0)
end if
end sub

sub Remplacer
if edit.sellength>0 then
edit.seltext=edit2repl.text
end if
PoursuivreRemplacer
end sub

sub RemplacerTout
dim flag as integer

form3.close
flag=checkRepl.checked
if edit.seltext="" then start=edit.selstart
while edit.find(start,edit1Repl.text,flag)>0
start=edit.find(start,edit1Repl.text,flag)
start=start+len(edit1Repl.text)
edit.seltext=edit2repl.text
wend
end sub


QTreeviewEx.inc

$typecheck on
$include "fileops.inc"

type QtreeviewEx extends Qtreeview

function getparent (i as integer) as integer
Dim startlevel as integer
startlevel = QtreeviewEx.item(i).level
if startlevel = 0 then result = -1
if i = -1 then result = i
do
if QtreeviewEx.item(i).level < startlevel then Exit do
dec(i)
loop until i = -1
result = i
end function
'_______________________________________________________________________________
function getindex(from as integer, itemtext as string) as integer
dim i as integer
i = From
do
if QtreeviewEx.item(i).text = itemtext then exit do
inc(i)
loop until i = QtreeviewEx.itemcount
if i = QtreeviewEx.itemcount then i = -1
result = i
end function
'_______________________________________________________________________________
function strgetparent(itemtext as string) as integer
dim i as integer
with QtreeviewEx
     i = .getindex(0, itemtext)
     i = .getparent(i)
     result = i
end with
end function
'_______________________________________________________________________________
Function getchildrenlist (i as integer) as string
if QtreeviewEx.item(i).haschildren = 0 then result = ""
dim startlevel as integer
dim templist as string
templist = ""
startlevel = QtreeviewEx.item(i).level + 1
inc(i)
do
if QtreeviewEx.item(i).level = startlevel then
templist = templist + QtreeviewEx.item(i).text + ","
elseif QtreeviewEx.item(i).level < startlevel then
exit do
end if
inc(i)
loop until i = QtreeviewEx.itemcount
result = left$(templist, len(templist) - 1)
end function
'_______________________________________________________________________________
sub addchildto (startfrom as integer, itemtext as string, childtext as string)
with QtreeviewEx
.addchilditems (.getindex(startfrom, itemtext), childtext)
end with
end sub
'_______________________________________________________________________________
function Branchlength (i as integer) as integer
defint startlevel, x, y
with qtreeviewex
if .item(i).haschildren = 0 then
    result = 1
else
    startlevel = .item(i).level
    x = i + 1
    y = .itemcount
    if x = y then result = 0

        do
        if .item(x).level <= startlevel then
            exit do
        else
            inc(x)
        end if
        loop until x = y
result = x - i
end if
end with
end function
'_______________________________________________________________________________
sub MoveDown (i as integer)
defint x,y, startlevel, destindex, howmany
dim sl as qstringlist

with QtreeviewEx
x = i + 1
y = .itemcount
if i = y then exit sub

startlevel = .item(i).level

do
if .item(x).level = startlevel then
    destindex = x + .branchlength(x) - 1
    exit do
elseif .item(x).level < startlevel then
    exit sub
end if
inc(x)
loop until x = y

.savetofile (homedir + "tmp_tree.tv")
end with

with sl
.loadfromfile (homedir + "tmp_tree.tv")

howmany = Qtreeviewex.branchlength(i)

x = 0
do
if destindex = y then
    .additems .item(i)
    .delitems(i)
else
    .insertitem (destindex + 1, .item(i).text)
    .delitems(i)
end if
inc(x)
loop until x = howmany

.savetofile (homedir + "tmp_tree.tv")
end with

Qtreeviewex.loadfromfile (homedir + "tmp_tree.tv")
Qtreeviewex.itemindex = i + Qtreeviewex.branchlength(i)
kill(homedir + "tmp_tree.tv")
end sub
'_______________________________________________________________________________
sub MoveUp (i as integer)
defint x,y, startlevel, destindex

with QtreeviewEx
if i = 0 then exit sub
startlevel = .item(i).level
x = i - 1

do
if .item(x).level = startlevel then
    destindex = x
    exit do
elseif .item(x).level < startlevel then
    exit sub
end if
dec(x)
loop until x = -1
.movedown(destindex)
.itemindex = destindex
end with
end sub
'_______________________________________________________________________________
sub IncLevel (i as integer)
defint x,y, startlevel
dim sl as qstringlist

startlevel = QtreeviewEx.item(i).level
x = i
if i = 0 then exit sub

with QtreeviewEx
do
if .item(x).level = startlevel then
    exit do
elseif .item(x).level > startlevel then
    exit sub
end if
dec(x)
loop until x = -1

.savetofile (homedir + "tmp_tree.tv")
end with

    with sl
    .loadfromfile (homedir + "tmp_tree.tv")

    x = 0
    y = QtreeviewEx.branchlength(i)
    do
    .item(x + i) = chr$(9) + .item(x + i)
    inc(x)
    loop until x = y

    .savetofile (homedir + "tmp_tree.tv")
    end with

QtreeviewEx.loadfromfile (homedir + "tmp_tree.tv")
QtreeviewEx.itemindex = i
kill (homedir + "tmp_tree.tv")
end sub
'_______________________________________________________________________________
sub DecLevel (i as integer)
defint x,y, parentindex

dim sl as qstringlist
with QtreeviewEx
if .item(i).level = 0 then exit sub
parentindex = .getparent(i)
y = .branchlength(i)

.savetofile (homedir + "tmp_tree.tv")
end with

with sl
.loadfromfile (homedir + "tmp_tree.tv")

x = 0
do
.insertitem(parentindex + x, right$(.item(i + x), len(.item(i + x)) - 1))
.delitems(i + x + 1)
inc(x)
loop until x = y

.savetofile (homedir + "tmp_tree.tv")
end with

QtreeviewEx.loadfromfile (homedir + "tmp_tree.tv")
QtreeviewEx.itemindex = parentindex - 1
kill (homedir + "tmp_tree.tv")

end sub
end type
'===============================================================================


QTOOLBAR.INC

Type QToolBar extends QPanel

'Public
   ButtonX as integer          'Button Clicked
   ShowHint as short
   Hint() as string            'Hint of buttons
   Enabled() as short          'Button enable or nott
   Flat as short               'Flat buttons or not
   imglHandle as integer       'Handle
   imglDHandle as integer      'Handel 2

'Private
   imgl1 as Qimagelist         'Active buttton
   imgl2 as Qimagelist         'Disabel button
   img as qcanvas              'on paint Buttons
   Butbmp as QBitmap           'our False button
   CButton as qCoolBtn         ' one real button
   Buttons as integer          'Number of buttons
   X as Integer                'Height of bmp
   Y as Integer                'Width of bmp

   Sub load
      With QtoolBar
         .imgl1.handle = .imglHandle     'QIamgeList 1  Enabled button
         .imgl2.handle = .imglDHandle    'QImageList 2  Disabled Button
         .Buttons = .imgl1.Count         'How many buttons?
         .X = .imgl1.Width+6.: .Y = .imgl1.Width+6     'Dimensions
         if .Align =1 or .Align =2 or .Align =0 then   '& position
             if .Height < .X + 12 then .Height = .X + 12
             if .Width < .Y*.Buttons then .Width = .Y*.Buttons + 12
         else
             if .Height < .X*.Buttons then .Height = .X*.Buttons + 12
             if .Width  < .Y + 12 then .Width = .Y +12
         end if

         'Drawing one false button
         .ButBmp.Height = .X: .ButBmp.Width = .Y
         if .Flat Then                          'is a flat toolbar
            .ButBmp.FillRect (0, 0, .X, .Y, &HC0C0C0)
         Else                                   'isn`t flat tool bar
            .ButBmp.FillRect (0, 0, .X, .Y, &HC0C0C0)
            .ButBmp.Line (0, 0, .X-2, 0, &HFFFFFF)
            .ButBmp.Line (0, 0, 0, .Y-2, &HFFFFFF)
            .ButBmp.Line (1, 1, .X-3, 1, &HDFDFDF)
            .ButBmp.Line (1, 1, 1, .Y-3, &HDFDFDF)
            .ButBmp.Line (0, .Y-1, .X-1, .Y-1, &H000000)
            .ButBmp.Line (.X-1, .Y-1, .X-1, 0, &H000000)
            .ButBmp.Line (1, .Y-2, .X-2, .Y-2, &H808080)
            .ButBmp.Line (.X-2, .Y-2, .X-2, 1, &H808080)
         end if

         'a lot of propieties
         .img.parent = Qtoolbar
         .img.Top = 6: .img.Left = 6
         if .Align =1 or .Align =2 or .Align =0 then
            .img.Height = .X: .img.Width = .Buttons*.X
         else
            .img.Width = .Y: .img.Height = .Buttons*.Y
         end if
         .Cbutton.Parent = QtoolBar
         .Cbutton.Height = .X:.Cbutton.Width = .Y
         if .Align =1 or .Align =2 or .Align =0 then
            .Cbutton.top = 6 : .CButton.Left = -100
         else
            .Cbutton.Left = 6 : .CButton.Top = -100
         end if
         .Cbutton.Flat = .Flat
         .Cbutton.ShowHint = .ShowHint
      End With
   End Sub

   Sub Paint 'Draw Buttons
      Dim a as integer
      With QtoolBar
         .CButton.Down = 0
         For a = 0 to .Buttons -1
            if a <> .ButtonX then
               If .Enabled(a) then
                  .ButBmp.Draw (3,3,Qtoolbar.imgl1.GetBMP(a))
               else
                  .ButBmp.Draw (3,3,Qtoolbar.imgl2.GetBMP(a))
               end if
               if .Align =1 or .Align =2 or .Align =0 then
                  .img.Draw (a*.X, 0, .ButBmp.Bmp)
               else
                  .img.Draw (0,a*.Y, .ButBmp.Bmp)
               End if
            end if
         Next
      End With
   end sub

   Sub showButton 'Show the correct button
      With QToolBar
         if .Align =1 or .Align =2 or .Align =0 then
            .ButtonX = mouseX \ .X
         else
            .ButtonX = mouseY \ .Y
         end if
         IF .Enabled(.ButtonX) then
            .CButton.BMP = Qtoolbar.imgl1.GetBMP(.ButtonX)
         else
            Exit sub
         end if
         if .Align =1 or .Align =2 or .Align =0 then
            .CButton.Left = .ButtonX*.X + 6
         else
            .CButton.Top = .ButtonX*.Y + 6
         end if
         .CButton.hint = .hint(.ButtonX)
         .CButton.Visible = 1
       end With
   end Sub

   Sub Reset 'Reset toolbar
      QToolbar.ButtonX = -1
      QToolbar.CButton.Visible = 0
      QToolbar.Paint
   end Sub

   Event img.onpaint
      QtoolBar.Paint
   end Event

   Event img.OnMouseMove
      QtoolBar.ShowButton
   end Event

   Event OnMouseMove
      QToolbar.Reset
   end Event

   Constructor
      Width = 0
      Height = 0
      Buttons = 0
      ButtonX = -1
      Flat = 1
      Enabled() = 1
      Hint() = ""
      ShowHint = 1
   end constructor
end type


Qredex.Htm

'
' --------------------------------------------------------------------
' QREDEX OBJECT           January 2001             By Jacques Philippe
'
' EXTENDS  QRICHEDIT   with   COPY , CUT , PASTE , DELETE , SELECT ALL
'
' DOCUMENTATION HTML FORMAT
' --------------------------------------------------------------------
'
'  DOCUMENTATION
'       See Component QRichEdit of RapidQ.
'       Only Property PopUpMenu Is Involved/Changed
'
'  $INCLUDE "QREDEX.INC"
'
'  Example :
'       Create QRED As QREDEX
'           Align = alClient
'           Font.Name = "courier"
'           Font.Size = 8
'           Font.Color = &H80FFFF
'           Color = &H800000
'           ReadOnly =  False
'           WordWrap = False
'           ScrollBars = ssBoth
'           HideSelection = False
'           PlainText = True
'       End Create
'
' --------------------------------------------------------------------
'


Appendix A: QCDAUDIO

Documentation component by D.Glodt (c)2000-2001 Appendix A: QCDAUDIO

QCDAUDIO Component

QCDAUDIO is a media component used for read cd audio.

QCDAUDIO Properties
Field | Type | R\W | Default
Timer | QTIMER | RW |
 | Control the fréquency of the évent OnChange.
Time | STRING | R |
 | Time of cd.
TrackTime | STRING | R |
 | Time of songs.
TrackNumber | INTEGER | R |
 | Number of song from cd.
TimePosition | STRING | R |
 | Position tmsf(track,minutes,seconds,frame) of cd.
State | INTEGER | R | CD_CLOSE
 | State of cd,can be CD_PLAY,CD_PAUSE,CD_STOP.
AudioOpen | Boolean | R | FALSE
 | cd open.
Present | Boolean | R | FALSE
 | State cd present.
CurrentTrack | INTEGER | RW |
 | current song.
Error | STRING | R |
 | Text error if OPEN méthod return FALSE |  |

QCDAUDIO Methods
Method | Type | Description | Params
Open | FUNCTION | Open cd audio, return TRUE if no error | 0
Close | SUB | Close cd audio | 0
Play | SUB | Play cd audio | 0
Stop | SUB | Stop cd audio | 0
Pause | SUB | Set cd audio to mode pause | 0
Eject | SUB | Eject cd audio | 0

QCDAUDIO Events
Event | Type | Occurs when... | Params
OnChange | (track as integer,time as string) | position cd during play mode | 2

QCDAUDIO Examples

'**************************************************************************
'* application:player cd                                                  *
'* auteur:D.Glodt                                                         *
'* date:7-4-2001                                                          *
'**************************************************************************
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\Qcdaudio.inc"

$RESOURCE PLAYBMP as "play.bmp"
$RESOURCE STOPBMP as "Stop.bmp"
$RESOURCE PAUSEBMP as "Pause.bmp"
$RESOURCE BACKBMP as "back.bmp"
$RESOURCE FORWARDBMP as "forward.bmp"
$RESOURCE EJECTBMP as "eject.bmp"
$RESOURCE CDICO as "cdaudio.ico"

Declare Sub Play
Declare Sub Stop
Declare Sub Pause
Declare Sub Back
Declare Sub Forward
Declare Sub Eject
Declare Sub Open
Declare Sub Close
Declare Sub Quitter
Declare Sub PostimerOnTimer(track as integer,time as string)

Dim cd as Qcdaudio
cd.OnChange=PostimerOnTimer
cd.timer.interval=200

CREATE Form AS QFORM
    Caption="CD Audio"
    Width=288
    Height=110
    Center
    BorderStyle=bsSingle
    icoHandle=CDICO
    OnClose=Quitter
    OnShow=Open
    CREATE Panel1 AS QPANEL
        Left=0
        Top=0
        Width=281
        Height=80
        BevelOuter=bvNone
        CREATE BtPlay AS QCOOLBTN
            BMPHandle=PLAYBMP
            Left=8
            Top=6
            Width=28
            Height=28
            Flat=true
            Hint="Play"
            ShowHint=true
            GroupIndex=1

            OnClick=Play
        END CREATE
        CREATE BtStop AS QCOOLBTN
            BMPHandle=STOPBMP
            Left=46
            Top=6
            Width=28
            Height=28
            Down=true
            Flat=true
            Hint="Stop"
            ShowHint=true
            GroupIndex=1
            OnClick=Stop
        END CREATE
        CREATE BtPause AS QCOOLBTN
            BMPHandle=PAUSEBMP
            Left=84
            Top=6
            Width=28
            Height=28
            Flat=true
            GroupIndex=1
            Hint="Pause"
            ShowHint=true
            OnClick=Pause
        END CREATE
        CREATE BtBack AS QCOOLBTN
            BMPHandle=BACKBMP
            Left=114
            Top=6
            Width=28
            Height=28
            Flat=true
            GroupIndex=0
            Hint="Back"
            ShowHint=true
            OnClick=Back
        END CREATE
        CREATE BtForward AS QCOOLBTN
            BMPHandle=FORWARDBMP
            Left=144
            Top=6
            Width=28
            Height=28
            Flat=true
            GroupIndex=0
            Hint="Forward"
            ShowHint=true
            OnClick=Forward
        END CREATE
        CREATE BtEject AS QCOOLBTN
            BMPHandle=EJECTBMP
            Left=174
            Top=6
            Width=28
            Height=28
            Flat=true
            GroupIndex=0
            Hint="Eject"
            ShowHint=true
            OnClick=Eject
        END CREATE
        CREATE Infos AS QSTATUSBAR
          AddPanels "Track:",""
          Panel(0).width=100
        END CREATE
    END CREATE
END CREATE

Form.ShowModal

Sub Open
  if cd.open then
    infos.panel(0).caption="Track:"+str$(cd.tracknumber)
    infos.panel(1).caption=cd.time
  end if
End Sub

Sub Close
  cd.close
End Sub

Sub Play
  if cd.audioOpen=false then
    if cd.open then
      infos.panel(0).caption="Track:"+str$(cd.tracknumber)
      infos.panel(1).caption=cd.time
    else
      btStop.down=true
    end if
  end if
  cd.play
End Sub

Sub Stop
  cd.stop
End Sub

Sub Pause
  cd.pause
End Sub

Sub Back
  cd.currentTrack=cd.currentTrack-1
  infos.panel(0).caption="Track:"+str$(cd.currentTrack)
  infos.panel(1).caption=cd.tracktime
  if cd.state=CD_PLAY then cd.play
End Sub

Sub Forward
  cd.currentTrack=cd.currentTrack+1
  infos.panel(0).caption="Track:"+str$(cd.currentTrack)
  infos.panel(1).caption=cd.tracktime
  if cd.state=CD_PLAY then cd.play
End Sub

Sub Eject
  cd.eject
  btStop.down=true
End Sub

Sub PostimerOnTimer(track as integer,time as string)
  infos.panel(0).caption="Track:"+str$(track)
  infos.panel(1).caption=time
  if cd.state=CD_STOP then
    btStop.down=true
  end if
End Sub

Sub Quitter
  cd.close
  form.close
End Sub


Appendix A: QMIDI

Documentation component by D.Glodt (c)2000-2002 Appendix A: QMIDI

QMIDI Component

QMIDI is a media component used to play midi sequences.

QMIDI Properties
Field | Type | R/W | Default
Timer | QTIMER | RW |
 | Control the fréquency of event OnChange.
Lenght | LONG | R |
 | Lenght of midi sequence.
State | INTEGER | R | VD_CLOSE
 | State of sequencer,can be MD_PLAY,MD_STOP,MD_PAUSE.
FileOpen | BOOLEAN | R | False
 | True if a midi file is open.
CurrentFrame | LONG | RW |
 | Position of midi sequence.
Error | STRING | R |
 | Text error if the OPEN méthod return FALSE |  |
Volume | INTEGER | RW | 0

QMIDI Methods
Method | Type | Description | Params
Close | SUB | Close the midi file | 0
Open | FUNCTION(FileName as string) | Open the midi file and return True if no error | 1
Play | SUB | Play the midi sequence | 0
Stop | SUB | Stop the midi sequence | 0
Pause | SUB | Set the player in mode pause | 0

QMIDI Events
Event | Type | Occurs when... | Params
OnChange | (position as long) | Sequence position in mode play | 1

QMIDI Examples

'**************************************************************************
'* application:player midi                                               *
'* auteur:D.Glodt                                                         *
'* date:7-4-2001                                                          *
'**************************************************************************
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QMidi.inc"

$RESOURCE PLAYBMP as "play.bmp"
$RESOURCE STOPBMP as "Stop.bmp"
$RESOURCE PAUSEBMP as "Pause.bmp"
$RESOURCE MIDIICO as "midi.ico"

Declare Sub Play
Declare Sub Stop
Declare Sub Pause
Declare Sub Open
Declare Sub Close
Declare Sub Quitter
Declare Sub TrackBarChange
Declare Sub PostimerOnTimer(Position as long)

Dim OpenDialog as QOpenDialog
OpenDialog.Filter="Fichier midi|*.mid"
OpenDialog.Caption= "Selectionner une séquence"
Dim midi as QMidi
midi.OnChange=PostimerOnTimer
midi.timer.interval=200

CREATE Form AS QFORM
    Caption="Midi"
    Width=288
    Height=110
    Center
    BorderStyle=bsSingle
    icoHandle=MIDIICO
    OnClose=Quitter
    CREATE MENU AS QMAINMENU
      CREATE FileMenu AS QMENUITEM
        Caption="&Fichier"
        CREATE Item1 AS QMENUITEM
          Caption="&Ouvrir"
          OnClick=Open
        END CREATE
        CREATE Item2 AS QMENUITEM
          Caption="&Fermer"
          OnClick=Close
        END CREATE
        CREATE Item3 AS QMENUITEM
          Caption="-"
        END CREATE
        CREATE Item4 AS QMENUITEM
          Caption="&Quitter"
          OnClick=Quitter
        END CREATE
      END CREATE
    END CREATE
    CREATE Panel1 AS QPANEL
        Left=0
        Top=0
        Width=281
        Height=60
        BevelOuter=bvNone
        CREATE BtPlay AS QCOOLBTN
            BMPHandle=PLAYBMP
            Left=8
            Top=6
            Width=28
            Height=28
            Flat=true
            Hint="Play"
            ShowHint=true
            GroupIndex=1
            OnClick=Play
        END CREATE
        CREATE BtStop AS QCOOLBTN
            BMPHandle=STOPBMP
            Left=46
            Top=6
            Width=28
            Height=28
            Down=true
            Flat=true
            Hint="Stop"
            ShowHint=true
            GroupIndex=1
            OnClick=Stop
        END CREATE
        CREATE BtPause AS QCOOLBTN
            BMPHandle=PAUSEBMP
            Left=84
            Top=6
            Width=28
            Height=28
            Flat=true
            GroupIndex=1
            Hint="Pause"
            ShowHint=true
            OnClick=Pause
        END CREATE
        CREATE TrackBar1 AS QTRACKBAR
            TickMarks=tmBoth
            TickStyle=tsNone
            Left=2
            Top=36
            LineSize=0
            Width=272
            Height=21
            OnChange=TrackBarChange
        END CREATE
    END CREATE
END CREATE

Form.ShowModal

Sub Open
  If OpenDialog.Execute Then
   midi.close
   if midi.open(OpenDialog.FileName) then
     TrackBar1.Max=midi.lenght
     TrackBar1.Position=0
   end if
  end if
End Sub

Sub Close
  midi.close
End Sub

Sub Play
  midi.play
End Sub

Sub Stop
  midi.stop
  TrackBar1.Position=0
End Sub

Sub Pause
  midi.pause
End Sub

Sub TrackBarChange
  midi.currentFrame=TrackBar1.Position
End Sub

Sub PostimerOnTimer(Position as long)
  TrackBar1.Position=Position
  If midi.state=MD_STOP then
    midi.stop
    TrackBar1.Position=0
    BtStop.Down=True
  end if
End Sub

Sub Quitter
  midi.close
  form.close
End Sub


Appendix A: QVIDEO

Documentation component by D.Glodt (c)2000-2004 Appendix A: QVIDEO

QVIDEO Component

QVIDEO is a media component used to play vidéo file.

QVIDEO Properties
Field | Type | R/W | Default
Timer | QTIMER | RW |
 | Controle the fréquency of évent OnChange.
Lenght | LONG | R |
 | Lenght of video file (images number)
LenghtTime | LONG | R |
 | Lenght of video file (seconds) |  |
State | INTEGER | R | VD_CLOSE
 | State of media video player,can be VD_PLAY,VD_STOP,VD_PAUSE.
Handle | LONG | R |
 | Handle of control.
Parent | LONG | RW |
 | Handle QFORM or 0 for window of média player |  |
FileOpen | BOOLEAN | R | False
 | It's at true if a video file is open.
Left | SHORT | RW |
Top | SHORT | RW |
Width | SHORT | RW |
Height | SHORT | RW |
ImgWidth | SHORT | R |
 | Image width of vidéo file |  |
ImgHeight | SHORT | R |
 | Image height of vidéo file |  |
CurrentFrame | LONG | RW |
 | Current position of player.
AudioOff | BOOLEAN | RW | False
 | Without sound if true. |  |
Error | STRING | R |
 | Text error if the OPEN method return FALSE. |  |
Caption | STRING | RW |
 | Title window média player |  |
BorderStyle | INTEGER | RW | bsSizeable
 | Window style of media player when his parent is the desk,can be bsNone ou bsSizeable |  |
WindowState | INTEGER | RW | wsNormal
 | Window state of media player when his parent is the desk,can be wsNormal ou wsMinimized ou wsMaximized |  |
Volume | INTEGER | RW | 0
DeviceType | STRING | RW |
 | Codec type , example:MpegVideo |  |

QVIDEO Methods
Method | Type | Description | Params
Close | SUB | Close the media player. | 0
Open | FUNCTION(FileName as string) | Open video file. | 2
Show | SUB | Show video. | 0
Play | SUB | Play the video file. | 0
Stop | SUB | Stop the player. | 0
Pause | SUB | Set the player in pause mode. | 0

QVIDEO Events
Event | Type | Occurs when... | Params
OnChange | (position as long,timePos as long) | Position of player in mode play. The parameter position give the position by image, the parameter timePos give the position by seconds. | 2

QVIDEO Examples

'**************************************************************************
'* application:player video                                               *
'* auteur:D.Glodt                                                         *
'* date:17-1-2004                                                         *
'**************************************************************************
$OPTION ICON "video.ico"
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QVideo.inc"

$RESOURCE PLAYBMP as "play.bmp"
$RESOURCE STOPBMP as "Stop.bmp"
$RESOURCE PAUSEBMP as "Pause.bmp"
$RESOURCE SPEAKERBMP as "Speaker.bmp"
$RESOURCE SPEAKEROFFBMP as "SpeakerOff.bmp"

Declare Sub PaintForm
Declare Sub ResizeForm
Declare Sub Play
Declare Sub Stop
Declare Sub Pause
Declare Sub Open
Declare Sub Close
Declare Sub Quitter
Declare Sub TrackBarChange
Declare Sub PostimerOnTimer(Position as long,timePos as long)
Declare Sub Zoom1
Declare Sub Zoom2
Declare Sub Zoom3
Declare Sub Zoom4
Declare Sub FullScreen
Declare Sub Speaker
Declare Sub EditSeq
Declare Sub PlaySeq
Declare Sub AddSeq
Declare Sub DelSeq
Declare Sub DelAllSeq
Declare Sub CloseSeq
Declare Sub VolumeChange

const FormWidth=288
const FormHeight=290
Dim OpenDialog as QOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"
Dim video as QVideo
video.DeviceType="MpegVideo"
video.OnChange=PostimerOnTimer
video.timer.interval=200
Dim Counter as integer
Dim flagSeq as integer
Dim flagSpeaker as integer
flagSpeaker=false
Dim FileName as string

CREATE Form2 AS QFORM
    Caption="Selection séquence"
    Width=430
    Height=230
    Center
    BorderStyle=bsDialog
    CREATE ListSeq AS QLISTBOX
        Left=10
        Top=10
        Width=400
        Height=150
    END CREATE
    CREATE BtAdd AS QBUTTON
        Caption="Ajouter"
        Left=10
        Top=170
        TabOrder=2
        OnClick=AddSeq
    END CREATE
    CREATE BtDel AS QBUTTON
        Caption="Supprimer"
        Left=93
        Top=170
        TabOrder=3
        OnClick=DelSeq
    END CREATE
    CREATE BtDelAll AS QBUTTON
        Caption="Nouveau"
        Left=175
        Top=170
        TabOrder=4
        OnClick=DelAllSeq
    END CREATE
    CREATE BtQuit AS QBUTTON
        Caption="Fermer"
        Left=335
        Top=170
        TabOrder=1
        OnClick=CloseSeq
    END CREATE
END CREATE

CREATE Form3 AS QFORM
  BorderStyle=bsNone
  left=0
  top=0
  width=Screen.width
  height=Screen.height
  color=&H0
  cursor=crnone
  OnKeyPress=Stop
END CREATE

CREATE Form AS QFORM
    Caption="Vidéo"
    Width=FormWidth
    Height=FormHeight
    Center
    BorderStyle=bsSingle
    DelBorderIcons 2
    OnPaint=PaintForm
    OnResize=ResizeForm
    OnClose=Quitter
    CREATE MENU AS QMAINMENU
      CREATE FileMenu AS QMENUITEM
        Caption="&Fichier"
        CREATE Item1 AS QMENUITEM
          Caption="&Ouvrir"
          OnClick=Open
        END CREATE
        CREATE Item2 AS QMENUITEM
          Caption="&Fermer"
          OnClick=Close
        END CREATE
        CREATE Item3 AS QMENUITEM
          Caption="-"
        END CREATE
        CREATE Item4 AS QMENUITEM
          Caption="&Quitter"
          OnClick=Quitter
        END CREATE
      END CREATE
      CREATE Display AS QMENUITEM
        Caption="&Affichage"
        CREATE Item11 AS QMENUITEM
          Caption="&Zoom"
          Enabled=false
          CREATE Item21 AS QMENUITEM
            Caption="&Zoom 50%"
            OnClick=Zoom1
          END CREATE
          CREATE Item22 AS QMENUITEM
            Caption="&Zoom 100%"
            Checked=true
            OnClick=Zoom2
          END CREATE
          CREATE Item23 AS QMENUITEM
            Caption="&Zoom 150%"
            OnClick=Zoom3
          END CREATE
          CREATE Item24 AS QMENUITEM
            Caption="&Zoom 200%"
            OnClick=Zoom4
          END CREATE
        END CREATE
        CREATE Item25 AS QMENUITEM
          Caption="&Plein écran"
          OnClick=FullScreen
        END CREATE
      END CREATE
      CREATE Sequence AS QMENUITEM
        Caption="&Séquence"
        CREATE Item13 AS QMENUITEM
          Caption="&Edition"
          OnClick=EditSeq
        END CREATE
        CREATE Item14 AS QMENUITEM
          Caption="&Lancer séquence"
          OnClick=PlaySeq
          Enabled=false
        END CREATE
      END CREATE
    END CREATE
    CREATE Panel1 AS QPANEL
        Left=0
        Top=171
        Width=281
        Height=80
        BevelOuter=bvNone
        CREATE BtPlay AS QCOOLBTN
            BMPHandle=PLAYBMP
            Left=8
            Top=6
            Width=26
            Height=26
            Flat=true
            Hint="Play"
            ShowHint=true
            GroupIndex=1
            OnClick=Play
            Enabled=false
        END CREATE
        CREATE BtStop AS QCOOLBTN
            BMPHandle=STOPBMP
            Left=46
            Top=6
            Width=26
            Height=26
            Flat=true
            Hint="Stop"
            ShowHint=true
            GroupIndex=1
            OnClick=Stop
            Enabled=false
        END CREATE
        CREATE BtPause AS QCOOLBTN
            BMPHandle=PAUSEBMP
            Left=84
            Top=6
            Width=26
            Height=26
            Flat=true
            GroupIndex=1
            Hint="Pause"
            ShowHint=true
            OnClick=Pause
            Enabled=false
        END CREATE
        CREATE BtSpeaker AS QCOOLBTN
            BMPHandle=SPEAKERBMP
            Left=122
            Top=6
            Width=26
            Height=26
            Flat=true
            Hint="Son"
            ShowHint=true
            OnClick=Speaker
            Enabled=false
        END CREATE
        CREATE TrackBar1 AS QTRACKBAR
            TickMarks=tmBoth
            TickStyle=tsNone
            Left=2
            Top=36
            LineSize=0
            Width=272
            Height=21
            Hint="Position"
            ShowHint=true
            OnChange=TrackBarChange
            Enabled=false
        END CREATE
        CREATE TrackBar2 AS QTRACKBAR
            TickMarks=tmTopLeft
            TickStyle=tsnone
            Left=173
            Top=10
            LineSize=0
            Width=100
            Height=21
            Hint="Volume"
            ShowHint=true
            OnChange=VolumeChange
            Enabled=false
            Min=0
            Max=100
        END CREATE
        CREATE infos AS QSTATUSBAR
          SizeGrip=false
          AddPanels "Format:","Durée:",""
          Panel(0).width=100
          Panel(1).width=100
        END CREATE
    END CREATE
END CREATE
video.parent=form.handle
Form.ShowModal

Sub PaintForm
  form.FillRect(0,0,form.clientWidth,(form.clientHeight-panel1.height),&H0)
End Sub

Sub ResizeForm
  Panel1.Top=form.ClientHeight-Panel1.Height
  Panel1.Width=form.ClientWidth
  TrackBar1.width=Panel1.width-10
End Sub

Function GetMinutes(seconds as long) as string
  dim min as integer
  dim sec as integer

  min=seconds/60
  sec=seconds mod 60
  if sec<10 then
    result=str$(min)+":0"+str$(sec)
  else
    result=str$(min)+":"+str$(sec)
  end if
End Function

Sub Open
  If OpenDialog.Execute Then
   video.close
   if video.open(OpenDialog.FileName) then
     FileName=OpenDialog.FileName
     form.Width=video.width+(form.width-form.clientWidth)+2
     form.Height=video.height+panel1.height+(form.height-form.clientHeight)
     ResizeForm
     TrackBar1.Enabled=true
     TrackBar2.Enabled=true
     TrackBar1.Max=video.lenght
     TrackBar1.Position=0
     if item21.checked then zoom1
     if item23.checked then zoom3
     if item24.checked then zoom4
     BtStop.Enabled=true
     BtPlay.Enabled=true
     BtPause.Enabled=true
     BtSpeaker.Enabled=true
     BtStop.Down=True
     Item11.Enabled=true
     video.show
     form.caption="Vidéo - "+right$(OpenDialog.FileName,Len(OpenDialog.FileName)-RINSTR(OpenDialog.FileName,"\"))
     infos.Panel(0).caption="Format:"+str$(video.ImgWidth)+"*"+str$(video.ImgHeight)
     infos.Panel(1).caption="Durée:"+GetMinutes(video.LenghtTime)
     infos.Panel(2).caption=""
   else
     showmessage video.error
   end if
  end if
End Sub

Sub Close
  if flagSpeaker then
    flagSpeaker=false
    video.AudioOff=false
    btSpeaker.bmpHandle=SPEAKERBMP
  end if
  video.close
  TrackBar1.Position=0
  Item11.Enabled=false
  TrackBar1.Enabled=false
  TrackBar2.Enabled=false
  Form.width=FormWidth
  Form.Height=FormHeight
  BtStop.Enabled=false
  BtPlay.Enabled=false
  BtPause.Enabled=false
  BtSpeaker.Enabled=false
  form.caption="Vidéo"
  flagSeq=false
  infos.Panel(0).caption="Format:"
  infos.Panel(1).caption="Durée:"
  infos.Panel(2).caption=""
End Sub

Sub Play
  if video.FileOpen=false then BtStop.Down=True
  if item25.checked then
    video.close
    video.parent=form3.handle
    form3.show
    video.open(Filename)
    video.width=form3.width
    video.height=form3.height
  end if
  video.play
End Sub

Sub Stop
  video.stop
  TrackBar1.Position=0
  if item25.checked then
    video.close
    form3.close
    video.parent=form.handle
    video.open(Filename)
    if item21.checked then zoom1
    if item22.checked then zoom2
    if item23.checked then zoom3
    if item24.checked then zoom4
    BtStop.Down=True
    video.show
  end if
End Sub

Sub Pause
  if video.FileOpen=false then BtStop.Down=True
  video.pause
End Sub

Sub TrackBarChange
  video.currentFrame=TrackBar1.Position
End Sub

Sub PostimerOnTimer(Position as long,timePos as long)
  TrackBar1.Position=Position
  infos.Panel(2).caption=GetMinutes(timePos)
  If Video.State=VD_STOP and flagSeq=false then
    TrackBar1.Position=0
    BtStop.Down=True
    if item25.checked then
      video.close
      form3.close
      video.parent=form.handle
      video.open(Filename)
      if item21.checked then zoom1
      if item22.checked then zoom2
      if item23.checked then zoom3
      if item24.checked then zoom4
      video.show
    end if
  end if
  If Video.State=VD_STOP and flagSeq=true then
    TrackBar1.Position=0
    video.close
    counter=counter+1
    if (counter+1)<=listSeq.itemCount then
      if video.open(listSeq.item(counter)) then
        FileName=listSeq.item(counter)
        if item25.checked then
          video.width=form3.width
          video.height=form3.height
        else
          form.Width=video.width+(form.width-form.clientWidth)+2
          form.Height=video.height+panel1.height+(form.height-form.clientHeight)
          if item21.checked then zoom1
          if item23.checked then zoom3
          if item24.checked then zoom4
        end if
        TrackBar1.Max=video.lenght
        video.play
        form.caption="Vidéo - "+right$(listSeq.item(counter),Len(listSeq.item(counter))-RINSTR(listSeq.item(counter),"\"))
        infos.Panel(0).caption="Format:"+str$(video.ImgWidth)+"*"+str$(video.ImgHeight)
        infos.Panel(1).caption="Durée:"+GetMinutes(video.LenghtTime)
      else
        showmessage video.error
      end if
    else
      if item25.checked then
        form3.close
        video.parent=form.handle
      end if
      BtPlay.Down=False
      BtStop.Down=True
      Close
    end if
  end if
End Sub

Sub Quitter
  video.close
  form.close
End Sub

Sub Zoom1
  if video.FileOpen then
    Item21.checked=true
    Item22.checked=false
    Item23.checked=false
    Item24.checked=false
    video.width=video.ImgWidth*(50/100)
    video.height=video.ImgHeight*(50/100)
    form.Width=video.width+(form.width-form.clientWidth)+2
    form.Height=video.height+panel1.height+(form.height-form.clientHeight)
  end if
End Sub

Sub Zoom2
  if video.FileOpen then
    Item21.checked=false
    Item22.checked=true
    Item23.checked=false
    Item24.checked=false
    video.width=video.ImgWidth*(100/100)
    video.height=video.ImgHeight*(100/100)
    form.Width=video.width+(form.width-form.clientWidth)+2
    form.Height=video.height+panel1.height+(form.height-form.clientHeight)
  end if
End Sub

Sub Zoom3
  if video.FileOpen then
    Item21.checked=false
    Item22.checked=false
    Item23.checked=true
    Item24.checked=false
    video.width=video.ImgWidth*(150/100)
    video.height=video.ImgHeight*(150/100)
    form.Width=video.width+(form.width-form.clientWidth)+2
    form.Height=video.height+panel1.height+(form.height-form.clientHeight)
  end if
End Sub

Sub Zoom4
  if video.FileOpen then
    Item21.checked=false
    Item22.checked=false
    Item23.checked=false
    Item24.checked=true
    video.width=video.ImgWidth*(200/100)
    video.height=video.ImgHeight*(200/100)
    form.Width=video.width+(form.width-form.clientWidth)+2
    form.Height=video.height+panel1.height+(form.height-form.clientHeight)
  end if
End Sub

Sub Speaker
  if flagSpeaker then
    video.AudioOff=false
    btSpeaker.bmpHandle=SPEAKERBMP
    flagSpeaker=false
  else
    video.AudioOff=true
    btSpeaker.bmpHandle=SPEAKEROFFBMP
    flagSpeaker=true
  end if
End Sub

Sub EditSeq
  Form2.showmodal
End Sub

Sub AddSeq
  If OpenDialog.Execute Then
    listSeq.additems(OpenDialog.fileName)
  end if
End Sub

Sub DelSeq
  if listSeq.itemIndex>-1 then
    listSeq.delItems(listSeq.itemIndex)
  end if
End Sub

Sub DelAllSeq
  listSeq.clear
End Sub

Sub CloseSeq
  form2.close
  if listSeq.itemCount>0 then
    item14.enabled=true
  else
    item14.enabled=false
  end if
End Sub

Sub PlaySeq
  if listSeq.itemCount>0 then
    video.close
    flagSeq=true
    counter=0
    if item25.checked then
      video.parent=form3.handle
      form3.show
    end if
    if video.open(listSeq.item(counter)) then
      FileName=listSeq.item(counter)
      if item25.checked then
        video.width=form3.width
        video.height=form3.height
      else
        form.Width=video.width+(form.width-form.clientWidth)+2
        form.Height=video.height+panel1.height+(form.height-form.clientHeight)
        if item21.checked then zoom1
        if item23.checked then zoom3
        if item24.checked then zoom4
      end if
      TrackBar1.Enabled=true
      TrackBar2.Enabled=true
      TrackBar1.Max=video.lenght
      TrackBar1.Position=0
      BtStop.Enabled=true
      BtPlay.Enabled=true
      BtPause.Enabled=true
      BtSpeaker.Enabled=true
      BtPlay.Down=True
      Item11.Enabled=true
      video.play
      form.caption="Vidéo - "+right$(listSeq.item(counter),Len(listSeq.item(counter))-RINSTR(listSeq.item(counter),"\"))
      infos.Panel(0).caption="Format:"+str$(video.ImgWidth)+"*"+str$(video.ImgHeight)
      infos.Panel(1).caption="Durée:"+GetMinutes(video.LenghtTime)
    else
      showmessage video.error
    end if
  end if
End Sub

Sub FullScreen
  if item25.checked then
    item25.checked=false
  else
    If Video.State=VD_PLAY then
      video.stop
      video.close
      video.parent=form3.handle
      form3.show
      video.open(Filename)
      video.width=form3.width
      video.height=form3.height
      video.play
    end if
    item25.checked=true
  end if
End Sub

Sub VolumeChange
  video.volume=TrackBar2.position
End Sub


Appendix A: QVuMeter

Documentation component by D.Glodt (c)2003 Appendix A: QVuMeter

QVuMeter Component

QVuMeter is a vu meter component.

QVuMeter Properties
Field | Type | R/W | Défault
LightColor | LONG | R/W | 0
 | Vu meter light color. |  |
DarkColor | LONG | R/W | 0
 | Vu meter dark color. |  |
Max | INTEGER | R/W | 100
 | Maximum value for vu meter |  |
Min | INTEGER | R/W | 0
 | Minimum value for vu meter |  |
Thickness | SHORT | R/W | 2
 | line thickness from vu meter in pixels |  |
Interval | SHORT | R/W | 1
 | Interval between line from vu meter in pixels |  |
Value | LONG | R/W | 0
 | Value from vu meter |  |
Parent | QFORM,QPANEL,QTABCONTROL | W |
Left | INTEGER | R/W | 0
Top | INTEGER | R/W | 0
Width | INTEGER | R/W |
Height | INTEGER | R/W |

QVuMeter Methods
Method | Type | Description | Params

QVuMeter Events
Event | Type | Occurs when... | Params

QVuMeter Example
$typecheck on
$optimize on
$include "Rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QSkin.inc"
$include "Object\QSkinBtn.inc"
$include "Object\QTextBtn.inc"
$include "Object\QFlashLabel.inc"
$include "Object\QVuMeter.inc"
$include "Object\QVideo.inc"

$resource img as "skin3.bmp"
$resource play1 as "play1.bmp"
$resource play2 as "play2.bmp"
$resource stop1 as "stop1.bmp"
$resource stop2 as "stop2.bmp"
$resource pause1 as "pause1.bmp"
$resource pause2 as "pause2.bmp"
$resource back1 as "back1.bmp"
$resource back2 as "back2.bmp"
$resource fwd1 as "foreward1.bmp"
$resource fwd2 as "foreward2.bmp"
$resource power1 as "power1.bmp"
$resource power2 as "power2.bmp"

declare sub quit
declare sub volume
declare sub SetVolume
declare sub open
declare sub play
declare sub stop
declare sub foreward
declare sub backward
declare sub pause
Declare Sub ShowTime(Position as long,timePos aslong)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"

Dim OpenDialog asQOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"

CREATE Form ASQSkin
Center
skin.bmpHandle=img
skin.top=-1
skin.left=-1
caption="Player"
OffsWidth=-5
create display asqpanel
top=20
left=16
width=311
height=72
bevelinner=0
bevelouter=0
color=&h994400
create bar asqpanel
top=50
left=0
width=display.width
height=2
bevelinner=0
bevelouter=0
color=color1
end create
create FlashPlay
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=2
caption="Play"
end create
create FlashStop
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=16
caption="Stop"
state=true
end create
create FlashPause
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=30
caption="Pause"
end create
create FlashTime
asQFlashlabel
DarkColor=color1
LightColor=color2
left=150
top=6
font.size=24
caption=RazClock
State=true
end create
create vu asQVuMeter
top=1
left=290
width=10
height=45
DarkColor=color1
LightColor=color2
value=50
end create
create btOpen
asQTextBtn
UpColor=color1
DownColor=color2
left=5
top=55
font.bold=true
caption="Open"
OnClick=open
end create
create btVol
asQTextBtn
UpColor=color1
DownColor=color2
left=265
top=55
font.bold=true
caption="Volume"
OnClick=Volume
end create
end create
create btPlay asQskinBtn
btUp.bmphandle=play1
btDown.bmphandle=play2
top=110
left=12
mode=1
OnClick=play
end create
create btStop asQskinBtn
btUp.bmphandle=stop1
btDown.bmphandle=stop2
top=110
left=44
OnClick=stop
end create
create btPause asQskinBtn
btUp.bmphandle=pause1
btDown.bmphandle=pause2
top=110
left=76
mode=1
OnClick=pause
end create
create btBack asQskinBtn
btUp.bmphandle=back1
btDown.bmphandle=back2
top=110
left=108
OnClick=backward
end create
create btFwd asQskinBtn
btUp.bmphandle=fwd1
btDown.bmphandle=fwd2
top=110
left=140
OnClick=foreward
end create
create btPower asQskinBtn
btUp.bmphandle=power1
btDown.bmphandle=power2
top=110
left=300
OnClick=quit
end create
END CREATE

CREATE Form2 ASQFORM
Caption="Volume"
Width=60
Height=190
Center
borderStyle=bsToolWindow
CREATE TbVol ASQTRACKBAR
cursor=crHandPoint
Orientation=tbVertical
Frequency=5
TickMarks=tmBoth
TickStyle=tsAuto
Left=5
Top=5
Max=0
Min=-100
Width=45
Height=150
position=-50
OnChange=SetVolume
END CREATE
END CREATE

CREATE video ASQVideo
Parent=0
volume=50
OnChange=ShowTime
timer.interval=200
BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff)
form.setdeskbar
Form.ShowModal

Sub quit
video.close
form2.close
application.terminate
End Sub

Sub volume
form2.show
End Sub

Sub SetVolume
vu.value=Abs(TbVol.position)
video.volume=Abs(TbVol.position)
End Sub

Sub open
If OpenDialog.Execute Then
video.close
if video.open(OpenDialog.FileName)then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
video.caption=GetFileName(OpenDialog.FileName)
else
showmessage
video.error
end if
end if
End Sub

Sub play
if video.FileOpen=false
then
btPlay.Down=false
else
FlashPause.flash=false
FlashStop.state=false
FlashPlay.state=true
btPause.Down=false
video.play
end if
End Sub

Sub stop
video.stop
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
End Sub

Function GetMinutes(seconds aslong)asstring
dim min asinteger
dim sec asinteger
dim sMin asstring
dim sSec asstring

min=seconds/60
sec=seconds mod 60
if min<10 then
sMin="0"+str$(min)
else
sMin=str$(min)
end if
if sec<10 then
sSec="0"+str$(sec)
else
sSec=str$(sec)
end if
result=sMin+":"+sSec
End Function

Sub ShowTime(Position aslong,timePos
aslong)
FlashTime.caption=GetMinutes(timePos)
If Video.State=VD_STOP then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
end if
End Sub

Sub pause
if video.state=VD_PLAY then
video.pause
btPlay.down=false
FlashPlay.state=false
FlashPause.flash=true
else
if video.FileOpen=false
then
btPause.Down=false
end if
End Sub

Sub foreward
if (video.currentFrame+1)<video.lenght
then
video.currentFrame=video.currentFrame+1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub

Sub backward
if video.currentFrame>0 then
video.currentFrame=video.currentFrame-1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub


Appendix A: QWAVE

Documentation component by D.Glodt (c)2000-2004 Appendix A: QWAVE

QWAVE Component

QWAVE is a media component used to play or record wave files.

QWAVE Properties
Field | Type | R/W | Default
Timer | QTIMER | RW |
 | Controle the fréquency of évent OnChange.
Lenght | LONG | R |
 | Lenght of wave file or record time.
State | INTEGER | R | VD_CLOSE
 | State of player,can be WV_PLAY,WV_STOP,WV_PAUSE,WV_RECORD.
FileOpen | BOOLEAN | R | False
 | It's at true if a wave file is open to play or record.
CurrentPos | LONG | RW |
 | Position of wave file in milliseconds.
Bits | INTEGER | RW |
 | Bit number by sample of wave,can be WV_BIT8 ou WV_BIT16.
Frequence | INTEGER | RW |
 | Sample frequency of wave,can be WV_KHZ8,WV_KHZ11,WV_KHZ44.
Mode | SHORT | RW |
 | Output mode,can be WV_STEREO ou WV_MONO.
Error | STRING | R |
 | Text error if OPEN method return FALSE |  |
Volume | INTEGER | RW | 0
DeviceType | STRING | RW |
 | Codec type ,example for mp3:MpegVideo |  |

QWAVE Methods
Method | Type | Description | Params
Close | SUB | Close the wave file | 0
Open | FUNCTION(FileName as string) | Open a wave file and return True if no error. | 1
Play | SUB | Play the wave file. | 0
Stop | SUB | Stop the player. | 0
Pause | SUB | Set the player to mode pause | 0
New | SUB | Create a new wave | 0
Record | SUB | Set the player to record,if the wave is new,his record time is define by the Lenght property. | 0
Save | FUNCTION(FileName as string) | Save the wave file and return True | 1
Delete | Sub(Pos1 as long,Pos2 as long) | Delete some sample data from wave file from position pos1 to pos2 in milliseconds | 2

QWAVE Events
Event | Type | Occurs when... | Params
OnChange | (position as long) | Position of player in mode play or mode record. | 1

QWAVE Examples

'**************************************************************************
'* application:player Wave                                                *
'* auteur:D.Glodt                                                         *
'* date:17-1-2004                                                         *
'**************************************************************************
$OPTION ICON "wave.ico"
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QWave.inc"

$RESOURCE PLAYBMP as "play.bmp"
$RESOURCE STOPBMP as "Stop.bmp"
$RESOURCE PAUSEBMP as "Pause.bmp"
$RESOURCE RECORDBMP as "record.bmp"
$RESOURCE SCREENBMP as "gramo.bmp"

Declare Sub Play
Declare Sub Stop
Declare Sub Pause
Declare Sub Open
Declare Sub Close
Declare Sub Quitter
Declare Sub SaveAs
Declare Sub New
Declare Sub Record
Declare Sub TrackBarChange
Declare Sub PostimerOnTimer(Position as long)
Declare Sub Mono
Declare Sub Stereo
Declare Sub Bit8
Declare Sub Bit16
Declare Sub Khz8
Declare Sub Khz11
Declare Sub Khz44
Declare Sub DeleteStart
Declare Sub DeleteEnd
Declare Sub ShowParam
Declare Sub TimeRecordChange
Declare Sub Init

Dim OpenDialog as QOpenDialog
OpenDialog.Filter="Fichier Wave|*.wav|Fichier Mp3|*.mp3"
OpenDialog.Caption= "Selectionner une onde"
Dim SaveDialog as QSaveDialog
SaveDialog.Filter="Fichier Wave|*.wav"
SaveDialog.Caption= "Sauver une onde"
Dim Wave as QWave
Wave.DeviceType="MpegVideo"
Wave.OnChange=PostimerOnTimer
Wave.timer.interval=200

CREATE Form2 AS QFORM
    Caption="Parametres d'enregistrement"
    Width=288
    Height=180
    Center
    BorderStyle=bsDialog
    CREATE groupe1 AS QGROUPBOX
      Top=10
      Left=2
      Width=70
      Height=60
      Caption="Mode"
      CREATE MonoBt AS QRADIOBUTTON
        Top=15
        Left=5
        width=50
        Caption="Mono"
        OnClick=Mono
      END CREATE
      CREATE StereoBt AS QRADIOBUTTON
        Top=35
        Left=5
        width=50
        Caption="Stereo"
        OnClick=Stereo
      END CREATE
    END CREATE
    CREATE groupe2 AS QGROUPBOX
      Top=10
      Left=82
      Width=70
      Height=60
      Caption="Bits"
      CREATE Bit8Bt AS QRADIOBUTTON
        Top=15
        Left=5
        width=50
        Caption="8bits"
        OnClick=Bit8
      END CREATE
      CREATE Bit16Bt AS QRADIOBUTTON
        Top=35
        Left=5
        width=50
        Caption="16bits"
        OnClick=Bit16
      END CREATE
  END CREATE
  CREATE groupe3 AS QGROUPBOX
    Top=10
    Left=162
    Width=70
    Height=80
    Caption="Freq"
    CREATE Freq8Bt AS QRADIOBUTTON
      Top=15
      Left=5
      width=50
      Caption="8Khz"
      OnClick=Khz8
    END CREATE
    CREATE Freq11Bt AS QRADIOBUTTON
      Top=35
      Left=5
      width=50
      Caption="11Khz"
      OnClick=Khz11
    END CREATE
    CREATE Freq44Bt AS QRADIOBUTTON
      Top=55
      Left=5
      width=50
      Caption="44Khz"
      OnClick=Khz44
    END CREATE
  END CREATE
  CREATE label1 AS QLABEL
    Caption="Temps enregistrement(s):10"
    top=100
    left=2
  END CREATE
  CREATE TrackBar2 AS QTRACKBAR
    TickMarks=tmTopLeft
    TickStyle=tsNone
    Left=2
    Top=130
    Max=300
    LineSize=0
    Width=272
    Height=22
    Position=10
    OnChange=TimeRecordChange
  END CREATE
END CREATE

CREATE Form AS QFORM
    Caption="Wave"
    Width=288
    Height=180
    Center
    BorderStyle=bsSingle
    DelBorderIcons 2
    OnClose=Quitter
    OnShow=Init
    CREATE MENU AS QMAINMENU
      CREATE FileMenu AS QMENUITEM
        Caption="&Fichier"
        CREATE Item1 AS QMENUITEM
          Caption="&Nouveau"
          OnClick=New
        END CREATE
        CREATE Item2 AS QMENUITEM
          Caption="&Ouvrir"
          OnClick=Open
        END CREATE
        CREATE Item3 AS QMENUITEM
          Caption="&Fermer"
          OnClick=Close
        END CREATE
        CREATE Item4 AS QMENUITEM
          Caption="&Sauver sous"
          OnClick=SaveAs
        END CREATE
        CREATE Item5 AS QMENUITEM
          Caption="-"
        END CREATE
        CREATE Item6 AS QMENUITEM
          Caption="&Quitter"
          OnClick=Quitter
        END CREATE
      END CREATE
      CREATE EditMenu AS QMENUITEM
        Caption="&Edition"
        CREATE Item11 AS QMENUITEM
          Caption="&Supprimer depuis le debut"
          OnClick=DeleteStart
        END CREATE
        CREATE Item12 AS QMENUITEM
          Caption="&Supprimer depuis la fin"
          OnClick=DeleteEnd
        END CREATE
        CREATE Item13 AS QMENUITEM
          Caption="-"
        END CREATE
        CREATE Item14 AS QMENUITEM
          Caption="Parametres"
          OnClick=ShowParam
        END CREATE
      END CREATE
    END CREATE
    CREATE Panel1 AS QPANEL
        Left=0
        Top=0
        Width=281
        Height=130
        BevelOuter=bvNone
        CREATE image as QIMAGE
           width=100
           height=70
           BmpHandle=SCREENBMP
        END CREATE
        CREATE BtPlay AS QCOOLBTN
            BMPHandle=PLAYBMP
            Left=88
            Top=26
            Width=28
            Height=28
            Hint="Play"
            ShowHint=true
            GroupIndex=1
            Enabled=false
            OnClick=Play
        END CREATE
        CREATE BtStop AS QCOOLBTN
            BMPHandle=STOPBMP
            Left=116
            Top=26
            Width=28
            Height=28
            Down=true
            Hint="Stop"
            ShowHint=true
            GroupIndex=1
            Enabled=false
            OnClick=Stop
        END CREATE
        CREATE BtPause AS QCOOLBTN
            BMPHandle=PAUSEBMP
            Left=144
            Top=26
            Width=28
            Height=28
            GroupIndex=1
            Hint="Pause"
            ShowHint=true
            Enabled=false
            OnClick=Pause
        END CREATE
        CREATE BtRecord AS QCOOLBTN
            BMPHandle=RECORDBMP
            Left=172
            Top=26
            Width=28
            Height=28
            Down=true
            Hint="Record"
            ShowHint=true
            GroupIndex=1
            OnClick=Record
        END CREATE
        CREATE TrackBar1 AS QTRACKBAR
            TickMarks=tmBoth
            TickStyle=tsNone
            Left=2
            Top=76
            LineSize=0
            Hint="Position"
            ShowHint=true
            Width=272
            Height=21
            OnChange=TrackBarChange
        END CREATE
        CREATE Infos AS QSTATUSBAR
          AddPanels "Temps:","position:"
          Panel(0).width=100
        END CREATE
    END CREATE
END CREATE

Form.ShowModal

Sub Open
  If OpenDialog.Execute Then
   Wave.close
   if Wave.open(OpenDialog.FileName) then
     EditMenu.Enabled=true
     TrackBar1.Max=Wave.lenght
     TrackBar1.Position=0
     infos.panel(0).caption="Temps:"+str$(wave.lenght/1000)+"s"
     infos.panel(1).caption="Position:0"
     BtPlay.Enabled=true
     BtStop.Enabled=true
     BtPause.Enabled=true
     item4.Enabled=true
     item3.Enabled=true
     if wave.mode=WV_MONO then
       MonoBt.checked=true
     else
       StereoBt.checked=true
     end if
     if wave.bits=WV_BIT8 then
       Bit8Bt.checked=true
     else
       Bit16Bt.checked=true
     end if
     if wave.frequence=WV_KHZ8 then
       Freq8Bt.checked=true
     elseif wave.frequence=WV_KHZ11 then
       Freq11Bt.checked=true
     elseif wave.frequence=WV_KHZ44 then
       Freq44Bt.checked=true
     end if
   else
     showmessage wave.error
   end if
  end if
End Sub

Sub Close
  Wave.close
  BtPlay.Enabled=false
  BtStop.Enabled=false
  BtPause.Enabled=false
  EditMenu.Enabled=false
  item4.Enabled=false
  item3.Enabled=false
  infos.panel(0).caption="Temps:"
  infos.panel(1).caption="Position:"
End Sub

Sub Play
  if wave.FileOpen=false then BtStop.Down=True
  TrackBar1.Max=Wave.lenght
  Wave.play
End Sub

Sub Stop
  Wave.stop
  TrackBar1.Position=0
  infos.panel(0).caption="Temps:"+str$(wave.lenght/1000)+"s"
  infos.panel(1).caption="Position:0"
End Sub

Sub Pause
  if wave.FileOpen=false then BtStop.Down=True
  Wave.pause
End Sub

Sub TrackBarChange
  Wave.currentPos=TrackBar1.Position
  infos.panel(1).caption="Position:"+str$(TrackBar1.Position/1000)
End Sub

Sub PostimerOnTimer(Position as long)
  TrackBar1.Position=Position
  infos.panel(1).caption="Position:"+str$(Position/1000)
  If Wave.state=WV_STOP then
    Wave.stop
    TrackBar1.Position=0
    BtStop.Down=True
  end if
End Sub

Sub Quitter
  Wave.close
  form2.close
  form.close
End Sub

Sub Mono
  wave.mode=WV_MONO
End Sub

Sub Stereo
  wave.mode=WV_STEREO
End Sub

Sub Bit8
  wave.bits=WV_BIT8
End Sub

Sub Bit16
  wave.bits=WV_BIT16
End Sub

Sub Khz8
  wave.frequence=WV_KHZ8
End Sub

Sub Khz11
  wave.frequence=WV_KHZ11
End Sub

Sub Khz44
  wave.frequence=WV_KHZ44
End Sub

Sub New
  wave.close
  wave.new
  infos.panel(0).caption="Temps:"+str$(TrackBar2.Position)+"s"
  infos.panel(1).caption="Position:0"
  EditMenu.Enabled=true
  BtPlay.Enabled=true
  BtStop.Enabled=true
  BtPause.Enabled=true
  item4.Enabled=true
  item3.Enabled=true
  if wave.mode=WV_MONO then
    MonoBt.checked=true
  else
    StereoBt.checked=true
  end if
  if wave.bits=WV_BIT8 then
    Bit8Bt.checked=true
  else
    Bit16Bt.checked=true
  end if
  if wave.frequence=WV_KHZ8 then
    Freq8Bt.checked=true
  elseif wave.frequence=WV_KHZ11 then
    Freq11Bt.checked=true
  elseif wave.frequence=WV_KHZ44 then
    Freq44Bt.checked=true
  end if
End Sub

Sub SaveAs
  If SaveDialog.Execute Then
    form.cursor=crHourglass
    if instr(lcase$(SaveDialog.FileName),".wav")>0 then
      wave.save(SaveDialog.FileName)
    else
      wave.save(SaveDialog.FileName+".wav")
    end if
    form.cursor=crDefault
  end if
End Sub

Sub Record
  if wave.FileOpen=false then BtStop.Down=True
  wave.lenght=Trackbar2.Position*1000
  TrackBar1.Max=Wave.lenght
  wave.record
End Sub

Sub DeleteStart
  wave.Delete(0,wave.currentPos)
  infos.panel(0).caption="Temps:"+str$(wave.lenght/1000)
End Sub

Sub DeleteEnd
  wave.Delete(wave.currentPos,wave.lenght)
  infos.panel(0).caption="Temps:"+str$(wave.lenght/1000)+"s"
End Sub

Sub ShowParam
  form2.show
End Sub

Sub TimeRecordChange
  label1.caption="Temps enregistrement(s):"+str$(TrackBar2.Position)
  infos.panel(0).caption="Temps:"+str$(TrackBar2.Position)
End Sub

Sub Init
  New
  infos.panel(0).caption="Temps:"+str$(TrackBar2.Position)+"s"
End Sub


QDebug

QDEBUG.cmp
Version 0.9
March 2, 2002
by Pete Kleinschmidt - petek1827@yahoo.com

The QDebug Component implements functionality similar to the Visual Basic Debug Object. It is
a very simple component that pops up a form containing a QRichedit box where you can print
out the value of variables and such. It is much easier to use than putting SHOWMESSAGE commands
throughout your code since you don't have to keep hitting OK all the time. Of course when you
are done debugging your code you will probably want to remove this component and all your
Debug.Print() statements from your final code.

To use, simply add the following line

$INCLUDE "QDebug.cmp"

to the top of your project and go.

There are three files included in this package.

QDEBUG.CMP This is the file that implements the QDebug Component
DEBUGAPP.BAS This is a small application that demonstrates using the QDEBUG Component
README.TXT Your reading it

Properties

Field Type R/W Default
-------------------------------------------------------
Enabled Short RW 1 (True)

Methods

Name Type Description
---------------------------------------------------------------------
Print SUB(StringToPrint) Prints string to Debug Richedit box
(Remember to convert numbers to
strings using the STR$ function)

This is somewhat of a midnight hack and there are probably better ways
of doing something like this. Sorry, I can't help with debugging your
code. However bug reports and suggestions for improvements are welcome.


Qid3Tag Component

With this component you can read / write id3 tags ver 1.x . It offers a combobox for genre selection too.

Qid3Tag Methods

Field | Type | R/W | Notes | Support
Filename | STRING | RW |  | W
Title | STRING | RW |  | W
Artist | STRING | RW |  | W
Album | STRING | RW |  | W
Year | STRING | RW |  | W
Comment | STRING | RW |  | W
Track | BYTE | RW |  | W
Genre | STRING | RW |  | W
Genreid | BYTE | RW |  | W
GenresList | QSTRINGLIST | R | Used internally (do not touch if you don't know what you're doing) | W
GenresCB | QCOMBOBOX | RW | Be sure it has a parent before any action !! | W

Qid3Tag Methods

Method | Type | Description | Params | Support
ReadTags | SUB | Reads id3 Tags | 0 | W
WriteTags | SUB | Writes id3 Tags | 0 | W
Loadlist | SUB | Loads genres list into GenresCB. Be careful... you MUST assign a parent to GenresCB before you use this function. |  |
Fitlength | FUNCTION (FitTag$, FitLen%) | External. Adds null characters to a text string until it reaches specified length. Cuts the string if the string length exceeds the specified length. | 2 | W

Qid3Tag Events

Event | Type | Occurs when... | Params | Support
None |  |  |  |

Qid3Tag Examples

$include "Qid3tag.inc"

declare sub ReadClickedFile
declare sub UpdateTags

CREATE Form AS QFORM
Caption = "Qid3Tag example"
Width = 381
Height = 244
Center
CREATE Label1 AS QLABEL
Caption = "Title"
Left = 176
Top = 24
Transparent = 1
END CREATE
CREATE Label2 AS QLABEL
Caption = "Artist"
Left = 176
Top = 56
Transparent = 1
END CREATE
CREATE Label3 AS QLABEL
Caption = "Album"
Left = 176
Top = 88
Transparent = 1
END CREATE
CREATE Label4 AS QLABEL
Caption = "Year"
Left = 176
Top = 120
Transparent = 1
END CREATE
create tnlabel as qlabel
caption = "Track"
left = 292
top = 120
transparent = 1
end create
CREATE Label5 AS QLABEL
Caption = "Comment"
Left = 176
Top = 152
Width = 48
Transparent = 1
END CREATE
CREATE Label6 AS QLABEL
Caption = "Genre"
Left = 176
Top = 184
Transparent = 1
END CREATE
CREATE FileListBox AS QFILELISTBOX
Left = 6
Top = 13
Height = 137
Directory = ".\"
onclick = ReadClickedFile
END CREATE
CREATE ed_title AS QEDIT
Left = 232
Top = 16
END CREATE
CREATE ed_artist AS QEDIT
Left = 232
Top = 48
END CREATE
CREATE ed_album AS QEDIT
Left = 232
Top = 80
END CREATE
CREATE ed_year AS QEDIT
Left = 232
Top = 112
width = 40
END CREATE
create ed_track as qedit
left = 332
top = 112
width = 20
end create
CREATE ed_comment AS QEDIT
Left = 232
Top = 144
END CREATE
CREATE ed_genre AS QEDIT
Left = 232
Top = 176
END CREATE
CREATE Button1 AS QBUTTON
Caption = "Write"
Left = 5
Top = 160
Width = 147
onclick = UpdateTags
END CREATE
END CREATE

dim mp3 as qid3tag
'The following code adds the GenresCB. It's optional
mp3.genrescb.parent = form
mp3.genrescb.top = 190
mp3.genrescb.left = 6
mp3.loadlist
  'use this one to load genres list into GenresCB

Form.ShowModal

sub ReadClickedFile
mp3.filename = Filelistbox.filename
mp3.readtags
mp3.genrescb.itemindex = mp3.genreid
ed_title.text = mp3.title
ed_artist.text = mp3.artist
ed_album.text = mp3.album
ed_year.text = mp3.year
ed_comment.text = mp3.comment
ed_track.text = str$(mp3.track)
ed_genre.text = mp3.genre
end sub

Sub UpdateTags
mp3.title = ed_title.text
mp3.artist = ed_artist.text
mp3.album = ed_album.text
mp3.year = ed_year.text
mp3.comment = ed_comment.text
mp3.track = val(ed_track.text)
mp3.genreid = mp3.genrescb.itemindex     'Pay attention,
  you have to give a valid genre id (BYTE),
'so you cannot pass mp3.genre (which is a STRING)
mp3.writetags
end sub


'Math-Expression Evaluator
'Updated: Sept. 10, 2001
'This source code is simply extracted (with minor modifications) from the source code of QEDTukak 1.52
'originally written by Achilles B.Mina.
'
'You can use this file as a module in your program for the evaluation of
'user-entered mathematical expressions (like i.e. sin(.1)^2-3e2*ln(tan(.1*PI))).
'Simply call the function "EvaluateExpression(MathString$, DRGMode)" from your main program:
'MathString$ is the string to be evaluated (passed BYREF)
'DRGMode=0 for deg, DRGMode=1 for rad, DRGMode=2 for grad
'The global variable "EvaluateErrorFlag" can be used for error checking
'Have a look at eval_tst.qb as a simple example)


Syntax Hilighting

' Simple Syntax Hilighting example for Rapid-Q by William Yu
'
' QREdit - Extension of QRichEdit with automatic syntax hilighting
' Not very complete, but you can handle all the special cases.
'
' NEW PROPERTIES:
' HiLighColor - Color to use for hilighting keywords
'
' NEW METHODS:
' AddSyntaxes - Add any keywords you want hilighted
' HiLight - Call first time whenever you load a file, or add new lines
'
' There are actually 2 separate ways of doing this, the hard way, and the
' easy way. The hard way is to learn RTF and create your own RTF document
' programmically. It's definitely more work than the easy way, which I'll
' demonstrate in this example.
' I've decided to incorporate this into a component for easy reuse.


Новая страница 1

' GetDecl parser version 1.0.
' GetDecl parses function declarations and returns an array with corresponding elements.


ObjectToolbox API

' ObjectToolbox API for Rapid-Q! Version 1.1.
'
' About
' ---------------
' ObjectToolbox is a library that provides useful functions and subs for manipulating objects and
' retrieving information about them.
'
' Release Notes
' --------------
' o Code is provided as-is.
' o ObjectToolbox is designed for Windows, not Linux/Unix.
'
'
' This package includes:
' ===============================================================================
' - TypeOf, a function which returns a string representation of the type
' of object the given handle identifies.

'
' Usage Notes:
' --------------
' You can't pass objects by name (by reference) to TypeOf, only their handles. I hope to provide a
' workaround for this, though.
'
' GDI object handles may be implemented for the next version of TypeOf().
'
' Updates:
' --------------
' TypeOf now recognizes QMenuItems


WAD3 (Half-Life Textures)

'***************************************************************************
'WAD3.INC (c)07/2003 by Christian Tandler,
'
'[HMK]St@neCold
'E-Mail: stonecold@csgui.de
'HP : http://www.csgui.de
'
'WAD-Functions for Rapid-Q
'This library realize a basicly WAD3-Texture support for Rapid-Q
'
'I've written this code for my program CsWAD, a program to change the spraylogo in
'Counterstrike. The program uses this functions to show a preview of textures
'of WAD3-Files and save them as a BMP-File.
'You can download this little nice program and other CS-Tools at: http://www.csgui.de
'
'
'Place this file into the Include-Folder of RapidQ and
'Insert into your code with: $INCLUDE "WAD3.INC"
'
'You can use this code free of charge but at your own risk!
'Send comments and suggestions to stonecold@csgui.de
'Last change: 07/23/2003
'
'Many thank's to DrkShadow for some code snippets, documentations and support!
'*****************************************************************************


Appendix A: QDataBase

Documentation component by D.Glodt (c)2004

Appendix A: QDataBase

QDataBase Component

QdataBase is a component to create and manipulate data base files.

The data base manipulated by this component are not standard with other data base.

the limit of fields number and records is limited at the maxi value of 24 bits word.

QDataBase Properties

Field | Type | R/W | Default
FileName | STRING | R |
 | File name of data base with path. |  |
RecordSize | LONG | R |
 | Record size in octet from data base. |  |
RecordCount | LONG | R |
 | Record count from data base. |  |
FieldCount | LONG | R |
 | Field count from a record. |  |
Error | INTEGER | L |
 | Error data base , his number must be compare with the following constantes to identify error en if the methods return false. ErrDbCreate: Pb of file creation. ErrDbOpen: Pb open file ErrDbFile: File not exist ErrDbIndex: Index record out of bound ErrDbRecordEmpty: Record empty or record format empty. ErrDbRecordSize: Size record is not the same that data base format. |  |

QDataBase Methods

Method

Type

Description

Params

GetFieldName

Function(index&) as string

return the field name by his index

1

GetFieldIndex

Function(name$) as long

return the index field by his name

1

GetFieldSize

Function(index&) as long

return the field size in octet by his index.

1

IsOpen

Function as boolean

return the open state of a data base.

0

Create

Function(FileName$,RecordFormat$) as boolean

Create a dat base file and return true if the file is create.

FileName is the fiel name to create, RecordFormat is the record format from records of data base including the name and the size of each field.

2

Format: <FieldName:FieldSize>,<FieldName:FieldSize >,...........

Example:

text= »NAME:10,CITY:20 »

Open

Function(FileName$) as boolean

Open a data base file and return True.

FileName is the file name to open.

1

Close

SUB

Close data base.

0

AddRecord

Function(record$) as boolean

Add a record to the data base and return True.

Record is all fields of record with the same size that of data base format.

1

AddRecordUdt

Function(record&) as boolean

Add a record to the data base by udt and return True.

Record is a UDT type of variant size but always the same size that data base format with string fields only.

1

Example:

Type Customer

name as string*10

city as string*20

End Type

Dim myCustomer as Customer

myCustomer.name= »Peter »

myCustomer.city= »Paris »

dbase.AddRecordUdt( myCustomer)

SaveRecord

Function(index&,record$) as boolean

Save a record by his index in data base and return True.

Record is all fields of record with the same size that the data base format.

2

SaveRecordUdt

Function(index&,record&) as boolean

Save a record of UDT type by his index in data base and return True.

Record is a UDT type of variant size but always the same size that data base format with string fields only.

2

GetRecord

Function(index&,byref record$) as boolean

Put in record parameter the record l'enregistrement identify by his index.

2

GetRecordUdt

Function(index&,record&) as boolean

Put in the record parameter of UDT type the record identify by his index.

The variable UDT must be the same size of data base format.

2

DelRecord

Function(index&) as boolean

Remove a record from data base by his index

1

SearchByRecord

Function(name$) as boolean

Return True if the string of parameter name has be found in all record of the data base..

The records index of record including the string will be returned by event OnSearch.

1

SearchByField

Function(name$,fieldIndex&) as boolean

Return True if the string of parameter name has be found in the field identify by his index of all the records of data base.

The records index including the string in their fields will be returned by event OnSearch.

2

SearchByRequest

Function(operator$,value$,bNum&,fieldIndex&) as boolean

Returne True if there is records fitted in with a request.

The request is made by a operator and a value on a field identify by his index.

4

Operator list is the following:

< , > ,<= , >= , = , <>

Value parameter is the string to check or numeric value if bNum parameter is at True.

The records index fitted in with the request will be returned by event OnSearch.

Example:

dbase.SearchByRequest( « > », »2000 »,1)

QDataBase Evenements

Event | Type | Occurs when... | Params
OnSearch | (index&) | On using Search methods | 1

QDataBase Examples

$typecheck on

$include "rapidq.inc"
$include "Object\QDataBase.inc"

declare sub show
Declare Sub mnFileClick
Declare Sub mnOpenClick
Declare Sub mnSaveClick
Declare Sub mnCloseClick
Declare Sub mnCreateClick
Declare Sub mnRequestClick
Declare Sub mnExitClick
Declare Sub BtOkClick
Declare Sub ShowError
Declare Sub ClearCell
Declare Sub Search(index as long)

Type TClient
  Name as string*15
  Compagny as string*20
  City as string*20
  Postal as string*10
  Country as string*20
End Type

dim dbase as QDataBase
    dbase.OnSearch=Search
const maxSeq=50
dim indexsearch as integer
dim client as TClient
dim OpenDial as QOpenDialog
    OpenDial.Filter="Db file(*.db)|*.db"
    OpenDial.caption="Open database"
dim CreateDial as QSaveDialog
    CreateDial.Filter="Db file(*.db)|*.db"
    CreateDial.caption="Create database"

CREATE Form2 AS QFORM
  BorderStyle=bsDialog
  Caption="Request"
  Width=316
  Height=153
  Center
  CREATE Label1 AS QLABEL
    Caption="Value:"
    Left=26
    Top=16
  END CREATE
  CREATE Label2 AS QLABEL
    Caption="Operator:"
    Left=10
    Top=48
    Width=46
  END CREATE
  CREATE Label3 AS QLABEL
    Caption="Field:"
    Left=115
    Top=48
    Width=46
  END CREATE
  CREATE EdValue AS QEDIT
    Left=63
    Top=12
    Width=233
  END CREATE
  CREATE CbOp AS QCOMBOBOX
    Left=64
    Top=45
    Width=40
    AddItems "=","<",">","<=",">=","<>"
    ItemIndex=0
  END CREATE
  CREATE CbField AS QCOMBOBOX
    Left=145
    Top=45
    Width=80
    AddItems "Name","Compagny","City","Postal","Country"
    ItemIndex=0
  END CREATE
  CREATE CheckNum AS QCHECKBOX
    Caption="Numeric"
    Left=240
    Top=48
    Width=81
  END CREATE
  CREATE BtOk AS QBUTTON
    Caption="&Ok"
    Kind=bkOK
    Left=136
    Top=90
    Default=true
    OnClick=BtOkClick
  END CREATE
  CREATE BtCancel AS QBUTTON
    Caption="&Cancel"
    Kind=bkCancel
    Left=224
    Top=90
  END CREATE
END CREATE

CREATE Form AS QFORM
  Caption="DataBase"
  Width=730
  Height=454
  Center
  OnShow=Show
  Create MainMenu As QMAINMENU
    Create File As QMenuItem
      Caption="&File"
      OnClick=mnFileClick
      Create mnOpen As QMenuItem
        Caption="&Open"
        OnClick=mnOpenClick
      End Create
      Create mnSave As QMenuItem
        Caption="&Save"
        OnClick=mnSaveClick
      End Create
      Create mnClose As QMenuItem
        Caption="&Close"
        OnClick=mnCloseClick
      End Create
      Create mnCreate As QMenuItem
        Caption="C&reate"
        OnClick=mnCreateClick
      End Create
      Create sep1 As QMenuItem
        Caption="-"
      End Create
      Create mnRequest As QMenuItem
        Caption="&Request"
        OnClick=mnRequestClick
      End Create
      Create sep2 As QMenuItem
        Caption="-"
      End Create
      Create mnExit As QMenuItem
        Caption="&Exit"
        OnClick=mnExitClick
      End Create
    End Create
  End Create
  CREATE StringGrid1 AS QSTRINGGRID
    Align=AlClient
    RowCount=maxSeq
    ColCount=6
    Color=&HAAFFFF
    DefaultColWidth=100
    DefaultRowHeight=20
    ColWidths(0)=50
    Cell(0,0)="Record"
    Cell(1,0)=space$(8)+"Name"
    Cell(2,0)=space$(8)+"Company"
    Cell(3,0)=space$(12)+"City"
    Cell(4,0)=space$(8)+"Postal code"
    Cell(5,0)=space$(8)+"Country"
    AddOptions goEditing,goColSizing
  END CREATE
END CREATE

Form.ShowModal

'============================================
' Evenement apparition fenetre
'============================================
Sub Show
  dim i as integer
  for i=1 to maxSeq
    StringGrid1.Cell(0,i)=str$(i)
  next i
End Sub

'============================================
' Evenement menu ouvrir
'============================================
Sub mnOpenClick
  dim i as integer
  dim filename as string
  dim Error as integer

  if OpenDial.Execute() then
    if dbase.open(OpenDial.filename) then
      for i=1 to dbase.RecordCount
        if dbase.GetRecordUdt(i,client)=true then
          StringGrid1.Cell(1,i)=client.name
          StringGrid1.Cell(2,i)=client.Compagny
          StringGrid1.Cell(3,i)=client.City
          StringGrid1.Cell(4,i)=client.Postal
          StringGrid1.Cell(5,i)=client.Country
        else
          Error=True
          Exit For
        end if
      next i
      if Error=true then ShowError
    else
      ShowError
    end if
  end if
End Sub

'============================================
' Effacement contenu cellule
'============================================
Sub ClearCell
  dim i as integer
  dim j as integer

  for i=1 to StringGrid1.RowCount-1
    for j=1 to StringGrid1.ColCount-1
      StringGrid1.Cell(j,i)=""
    next j
  next i
End Sub

'============================================
' Evenement menu fermer
'============================================
Sub mnCloseClick
  ClearCell
  dbase.close
End Sub

'============================================
' Evenement menu créer
'============================================
Sub mnCreateClick
  dim format as string
  dim i as integer
  dim filename as string
  dim Error as integer

  format="NAME:15,COMPAGNY:20,CITY:20,POSTAL:10,COUNTRY:20"
  if CreateDial.Execute() then
    filename=CreateDial.filename
    if instr(LCASE$(FileName),".db")=0 then FileName=FileName+".db"
    if dbase.create(CreateDial.filename,format)=true then
      for i=1 to StringGrid1.RowCount-1
        client.name=StringGrid1.Cell(1,i)
        client.Compagny=StringGrid1.Cell(2,i)
        client.City=StringGrid1.Cell(3,i)
        client.Postal=StringGrid1.Cell(4,i)
        client.Country=StringGrid1.Cell(5,i)
        if dbase.AddRecordUdt(client)=False then
          Error=True
          Exit For
        end if
      next i
      if Error=True then ShowError
    else
      ShowError
    end if
  end if
End Sub

'============================================
' Evenement menu sauver
'============================================
Sub mnSaveClick
  dim i as integer
  dim filename as string
  dim Error as integer

  if CreateDial.Execute() then
    filename=CreateDial.filename
    if instr(LCASE$(FileName),".db")=0 then FileName=FileName+".db"
    if dbase.IsOpen then
      for i=1 to StringGrid1.RowCount-1
        client.name=StringGrid1.Cell(1,i)
        client.Compagny=StringGrid1.Cell(2,i)
        client.City=StringGrid1.Cell(3,i)
        client.Postal=StringGrid1.Cell(4,i)
        client.Country=StringGrid1.Cell(5,i)
        if dbase.SaveRecordUdt(i,client)=False then
          Error=True
          Exit For
        end if
      next i
      if Error=True then ShowError
    end if
  end if
End Sub

'============================================
' Affichage erreur
'============================================
Sub ShowError
  defstr text=""

  Select case dbase.error
  case ErrDbCreate
    text="Error file create"
  case ErrDbOpen
    text="Error file open"
  case ErrDbFile
    text="Error file not exist"
  case ErrDbIndex
    text="Error index out of bound"
  case ErrDbRecordEmpty
    text="Error record empty"
  case ErrDbRecordSize
    text="Error record size"
  End Select
  MessageBox(text,"Error",16)
End Sub

'============================================
' Evenement menu fichier
'============================================
Sub mnFileClick
  if dbase.IsOpen then
    mnSave.enabled=true
    mnRequest.enabled=true
  else
    mnSave.enabled=false
    mnRequest.enabled=false
  end if
End Sub

'============================================
' Evenement menu request
'============================================
Sub mnRequestClick
  form2.showmodal
End Sub

'============================================
' Evenement bouton ok
'============================================
Sub BtOkClick
  dim operator as string
  dim index as long

  if EdValue.text="" then exit sub
  ClearCell
  indexsearch=0
  operator=CbOp.Item(CbOp.ItemIndex)
  index=dbase.GetFieldIndex(CbField.Item(CbField.ItemIndex))
  dbase.SearchByRequest(operator,EdValue.text,CheckNum.checked,index)
End Sub

'============================================
' Evenement OnSearch
'============================================
Sub Search(index as long)
  if dbase.IsOpen()=true then
    if dbase.GetRecordUdt(index,client)=true then
      indexsearch++
      StringGrid1.Cell(1,indexsearch)=client.name
      StringGrid1.Cell(2,indexsearch)=client.Compagny
      StringGrid1.Cell(3,indexsearch)=client.City
      StringGrid1.Cell(4,indexsearch)=client.Postal
      StringGrid1.Cell(5,indexsearch)=client.Country
    end if
  end if
End Sub

'============================================
' Evenement menu quitter
'============================================
Sub mnExitClick
  application.terminate
End Sub


QCGI

QCGI.INC
с 2001-2002 Chris Warrington
rapidq.basic.c45207@spamgourmet.com

Version: 1.3
Date: 09-DEC-2002

Note

a) Please turn "Word Wrap" OFF when viewing this file.
b) Please use a fixed-width font when viewing this file.

========
License
========
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

A copy of GNU General Public License can be found in the file gpl.txt,
included in the archive.

The GNU General Public License allows you to USE this library in any of your programs,
but you MUST release the source code. If you modify this library, those changes must also
be released. Be sure to see gpl.txt for the legal mumbo-jumbo.

====
Use
====
This file, unlike CGI_NEW.INC, is an object implementation of a CGI interface.

QCGI Properties
---------------
None

QCGI Methods
------------
The following functions return a CGI environmental variable in the form of a string:
GetCGIAccept
GetCGIAuthType
GetCGIContentLength*
GetCGIContentType
GetCGICookie
GetCGIGatewayInterface
GetCGIPathInfo
GetCGIPathTranslated
GetCGIReferer
GetCGIRemoteAddr
GetCGIRemoteHost
GetCGIRemoteIdent
GetCGIRemoteUser
GetCGIRequestMethod
GetCGIScriptName
GetCGIServerSoftware
GetCGIServerName
GetCGIServerPort
GetCGIServerProtocol
GetCGIUserAgent

* GetCGIContentLength returns an integer

Name      | Type | Arguments      | Description
InitCgi | SUB | MaxInput AS INTEGER, AutoConvert AS INTEGER | Initializes the CGI object for use.See the section on constants for acceptable values for MaxInput and AutoConvert. This must be called!
GetValue FUNCTION Id$ AS STRING | Returns the value of Id$ as a string. If the Id$ is not found, an empty  string is returned.

HexToAscii | FUNCTION | myInput$ AS STRING | Returns a string in which all %xx string have been converted into their ASCII equivalents. (When AutoConvert is cgiConvertAuto, it calls this.)

==========
Constants
==========

MaxInput Constants:

Name | Value
cgiInputDefault | 32767
cgiInputLarge | 65535
cgiInputSmall | 255

AutoConvert Constants:

Name | Value
cgiConvertManual | 0 (false)
cgiConvertAuto | 1 (true)

========
Contact
========
If you find any bugs, need help, or have any suggestions, please e-mail me at
rapidq.basic.c45207@spamgourmet.com


cgi.inc

' ---------------------------------------------------------------------------------------------------------------
' CGI.INC version 1.0
' By Nick Ruisi
' Acknowledgements to Kevin O'Brien (Author of CGI4VB) for the idea
'
'
'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
dim pairs (2,256) as string,CgiValue as string,rawp(256) as string, strTitle as string, newBlock$ as string
dim strpointer(256) as integer, x as integer,r as integer

dim CGI_Accept            As String
dim CGI_AuthType          As String
dim CGI_ContentLength     As String
dim CGI_ContentType       As String
dim CGI_Cookie            As String
dim CGI_GatewayInterface  As String
dim CGI_PathInfo          As String
dim CGI_PathTranslated    As String
dim CGI_QueryString       As String
dim CGI_Referer           As String
dim CGI_RemoteAddr        As String
dim CGI_RemoteHost        As String
dim CGI_RemoteIdent       As String
dim CGI_RemoteUser        As String
dim CGI_RequestMethod     As String
dim CGI_ScriptName        As String
dim CGI_ServerSoftware    As String
dim CGI_ServerName        As String
dim CGI_ServerPort        As String
dim CGI_ServerProtocol    As String
dim CGI_UserAgent         As String
dim lContentLength As Long

defint d

'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sub SendFooter (void)
    print "</BODY></HTML>"
end sub
'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sub SendB (strData as string)
    print strData;
end sub
'---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sub SendHeader(strTitle as string)
    print "Status: 200 OK"
    print "Content-Type:text/html"
    print chr$(13)
    print "<!DOCTYPE HTML PUBLIC ";chr$(34);"-//IETF//DTD HTML//EN";chr$(34);">"
    print "<HTML>"
    print "<HEAD><TITLE>";strTitle;"</TITLE></HEAD>"

    print "<BODY>"
end sub
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function GetCgiValue (Param as string) as string
  for i = 1 to 256
    if pairs(0, i) = Param then
      GetCgiValue = pairs(1, i)
      exit function
    end if
  next i
end function
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sub InitCgi(void)

CGI_Accept = ENVIRON$("HTTP_ACCEPT")
CGI_AuthType = ENVIRON$("AUTH_TYPE")
CGI_ContentLength = ENVIRON$("CONTENT_LENGTH")
CGI_ContentType = ENVIRON$("CONTENT_TYPE")
CGI_Cookie = ENVIRON$("HTTP_COOKIE")
CGI_GatewayInterface = ENVIRON$("GATEWAY_INTERFACE")
CGI_PathInfo = ENVIRON$("PATH_INFO")
CGI_PathTranslated =ENVIRON$("PATH_TRANSLATED")
CGI_QueryString = ENVIRON$("QUERY_STRING")
CGI_Referer = ENVIRON$("HTTP_REFERER")
CGI_RemoteAddr = ENVIRON$("REMOTE_ADDR")
CGI_RemoteHost = ENVIRON$("REMOTE_HOST")
CGI_RemoteIdent = ENVIRON$("REMOTE_IDENT")
CGI_RemoteUser = ENVIRON$("REMOTE_USER")
CGI_RequestMethod = ENVIRON$("REQUEST_METHOD")
CGI_ScriptName = ENVIRON$("SCRIPT_NAME")
CGI_ServerSoftware = ENVIRON$("SERVER_SOFTWARE")
CGI_ServerName = ENVIRON$("SERVER_NAME")
CGI_ServerPort = ENVIRON$("SERVER_PORT")
CGI_ServerProtocol = ENVIRON$("SERVER_PROTOCOL")
CGI_UserAgent = ENVIRON$("HTTP_USER_AGENT")
lContentLength = VAL(CGI_ContentLength)
'
'
' parse the data sent from the form, extracting fields from the & separator
'
  if CGI_REQUESTMETHOD = "POST" then
    ContentLen = VAL(ENVIRON$("CONTENT_LENGTH"))
    CGI_QUERYSTRING = GET$(ContentLen)
  end if
  qslength = len(CGI_QUERYSTRING)
  x=1
  newBlock$ = ""
  for i = 1 to qslength
    kar$ = mid$(CGI_QUERYSTRING, i, 1)
    select case kar$
           case "&"
           rawp(x) = newBlock$
           newBlock$ = ""
           x = x + 1
    case "+"
        newBlock$ = newBlock$ + " "  ' substitute space for the plus sign
   case "%"
if mid$(CGI_QUERYSTRING,i,3)="%3A" then
        newBlock$ = newBlock$ + ":"
    d=2
    elseif mid$(CGI_QUERYSTRING,i,3)="%2F" then
    newBlock$ = newBlock$ + "/"
    d=2
    end if
    case else
    if d>0 then d=d-1:goto 5
       newBlock$ = newBlock$ + kar$
5      end select
next i
rawp(x) = newBlock$
'
' plug both sides of the equal sign (name and value) into the pairs array
'
  for r = 1 to x
    linelength = len(rawp(r))
    for g = 1 to linelength
      kar$ = Mid$(rawp(r), g, 1)
      if kar$ = "=" then
        pairs(0, r) = Mid$(rawp(r), 1, g-1)
        pairs(1, r) = Mid$(rawp(r), g+1, len(rawp(r))-g)
    exit for
      end if
    next g
  next r

end sub

' ------------------------------------------------------------------------------------------------------------------------------------------------------------------


' eMail.Inc
' ==========
' Usage:
' ReturnCode& = eMail ( Recipients$, Subject$, Message$, Attachments$ )
'
' Recipients$ > Multiple recipients separated by ';', Name and address by ':'
' To sent a CC precede the name by '>'
' To sent a BCC precede the name by '<'
' Attachments$ > Multiple attachments separated by ';'
'
' Examples:
' eMRetCode& = (":me@myserver.com", "eMail.inc", "Does it work ?", "c:\autoexec.bat")
' eMRetCode& = ("You:you@ys.net;>Me:me@myserver.com", "CcTest", "", "")


Новая страница 1

' ----------------------------------------------
' Web.Objects Collection for CGI Development
'
' Absolutely royalty free for any kind of use
'
' Version: 2.1
' July 27, 2002.
'
' arahnoWare Inc. [c] 2002
'
' http://www.arahnoware.com
'
' ----------------------------------------------


QICMP

Last Updated: September 21, 2002

'''''QICMP.INC'''''Copyright 2002 Global Services

This package contains Qicmp.inc, QPing.bas and Qicmp.doc (this file).
Qicmp.inc creates an object for use in RapidQ basic programs to send
and receive icmp echo requests (pings) and replies using Window's
icmp.dll, which implements a few functions in internet control message
protocol (icmp).

QPing.bas illustrates use of the Qicmp.inc file in a ping program.
If the user program sets the TTL value in echo requests, a tracer
route program could be implemented.

RFCs 792, 1122, 1346 and 1812, among others, provide background.

THE QICMP OBJECT provides RapidQ program use of icmp.dll

PROPERTIES (Echo Request) Readable, Writable

Value Type Description
EchoString String Echo data to send (defaults to "Echo This")
Timout Long Echo time out (defaults to 3500 msec)
ReqOpt(0) Byte Time-to-live (TTL) see RFC 792 (defaults to 255)
ReqOpt(1) Byte Type of Service (TOS) see RFC 1346 (usually zero)
ReqOpt(2) Byte Flags see RFC 792 (usually zero)
ReqOpt(3) Byte Number of Options see RFC 792 (usually zero)
ReqOpt(4) Long Pointer to Options list (usually zero)

PROPERTIES (ICMP Reply) Readable, Writable (but why would you?)

Value Type Description
Reply(0) Long Address that replied
Reply(1) Long Status (0 = OK)
Reply(2) Long Round Trip Time in msec
Reply(3) Long Data Length (lower 16 bits); Reserved (upper 16 bits)
Reply(4) Long Pointer to Data
Reply(5) Long Options (lower byte is TTL of reply)
Reply(6) Long Pointer to Options Data
Reply(7-70) Long Data

METHODS Arguments Returns

Ping(ip$) IP address LONG msec for reply or -1 for Ping error.
ReplyStatus None Reply status as string.
ReplyAddress None String (a.b.c.d) of Reply(0), or null if = 0.
ReplyData None Reply data as string; should = EchoString.
ReplyTTL None TTL of reply packet.
CloseHandle None Closes Icmp handle, do before program exit.

Greater flexibility will be found in a raw sockets implementation of
icmp and other protocols.

IF all the files in this zip are put in one directory AND your
RapidQ stuff is in C:\rapidq, then "rc qping" will compile the
program. You will have to edit RC.BAT if C:\rapidq is not the
home directory for RapidQ.


RSocket

Last Updated: June 6, 2003
>>variable/constant type matching added in source code.

''''''RSOCKET.INC''''''Copyright 2002 Global Services

RSocket Extends QSocket (RSocket.inc) with a proof-of-concept program
(RSocket.bas). RSocket.inc contains functions used by getname.bas and
by raw_sock.bas. RSocket requires the free RapidQ Basic compiler and
adds nine new functions to RapidQ's QSocket object:

1. New .S function with ability to create an array of sockets!

Substitute a dimensioned Socket(n) for S. With several arrays storing data
on n socket operations, such as Socket(n), time(n), Host(n), Port(n),
Status(n), etc, -- whatever you need, you can be communicating with dozens
of computers in the same time interval. You just go 1 to n, check status,
update time(n) at .Connect time or whenever, to later check how much time has
passed (IF Timer - time(n) > MaxSecToWait THEN Goto ActionTimedOut), take
appropriate action depending on Status(n) and connection status, etc.
Be sure to include a DoEvents statement as you loop from socket to socket.
A short Sleep 0.1 doesn't hurt either. This is the concept of writing
a multiple socket connection program.

2. New .NonBlock funtion sets socket S to non-blocking mode.

3. New .Block function sets socket S to blocking mode.

These functions may be used to set any socket S (or Socket(n)) to blocking
or nonblocking mode at a particular time.

4. New .Connect function is similar to the QSocket .Connect except *you* have
to create the socket first (see RSocket.bas) and the first argument is S,
the socket number returned by the .S function. At present, .Connect only
accepts dotted IP addresses (like in scanner applications) -- a.b.c.d
(use new .AddrByName function to get the IP address).

[Note: The regular QSocket .Connect returns an error (-1) or a socket number
(S), if the connection was successful, if you can wait that long to find out!]

5. NEW .IsConnected function returns 1 if connected! In actual fact, the
function tests if a connection is ready for writing. Whether or not you plan
to write to the socket, this determination is basically synonymous with an
established TCP connection.
Three return values are 1 = connected, -1 = error, 0 = neither.

6. NEW .LastError function returns a string with both WSA last socket error
code and a text description of the error code. See usage in RSocket.bas.

7. NEW .AddrByName function takes a host name string and resolves it to a
dotted IP address string (or null string if failure). This can be used before
calling .Connect if you need the IP address string. Tip: If you don't know
whether the remote host string is a name or a dotted IP address, try this:

IF inet_addr(host$)=&HFFFFFFFF THEN
ip$ = Sock.AddrByName(host$)
IF ip$ <> "" THEN Goto DoConnect ELSE Goto BadHostString
ELSE
ip$=host$
END IF
DoConnect:
ret = Sock.Connect(S,ip$,port%)

.AddrByName is called "DNS lookup."

8. NEW .NameByAddr function takes an IP address string like a.b.c.d and returns
the Host Name associated with that address. A sample program in this package,
getname.bas, shows how it works. To compile, type "rc getname" and then run it.

.NameByAddr is called "reverse DNS lookup."

9. NEW .EndConnection function implements the socket shutdown API by stopping
both send and receive of data over the socket. The regular .Close function
completely disables a socket and frees system resources. The .EndConnection
function does a mode 2 shutdown and sends a FIN packet to indicate the program
will send no more data.

10. .WriteLine replaces the QSocket .WriteLine. These append <cr><lf> or
only <lf> respectively to the string sent. This replacement is necessary
since some servers require the full <cr><lf> syntax, instead of just <lf>.
This replacement .WriteLine returns error or number of bytes written.

11. .GetPeerName replaces the QSocket .GetPeerName which did not work. Usage
is the same.

=====USAGE (see examples in RSocket.bas & getname.bas):

Dim Sock As RSocket 'creates Sock object
S = Sock.S 'creates socket handle & puts it in S
ret = Sock.NonBlock(S) 'sets socket S to non-blocking mode
ret = Sock.Block(S) 'sets socket S to default blocking mode
ret = Sock.Connect(S,ip$,port%) 'initiates connection
ret = Sock.IsConnected(S,Secs) 'returns 1 if you are connected.
Error$ = Sock.LastError 'gets WSA last error code & description
ip$ = Sock.AddrByName(host$) 'resolves host name to IP address
host$= Sock.NameByAddr(ip$) 'finds host name for an IP address
ret = Sock.EndConnection(S) 'stops socket I/O to free up socket
ret = Sock.Writeline(S,m$) 'returns bytes written or error
ip$ = Sock.GetPeerName(S) 'returns IP address of server client

=====CONNECT DETAILS:

RSocket .Connect works in either blocking or non-blocking mode depending on
calls to .Block or .NonBlock beforehand (.Block is default if no prior call
is made before a .Connect. With Blocking (the default), .Connect in RSocket
returns error (-1) or zero (connected).

The "proof of concept" (RSocket.bas) prints out lots of stuff including timer
values to prove to you that the .Connect call *does not* block!!
The only essential PRINT statement is for the Sock.Read at the end.

This "victory" in extending QSocket allows the writing of truly professional
and fast scanning programs and other applications. As far as I know, every
regular QSocket operation that requires a socknum argument (S) works. Please
email me with any problems you find or other extensions you might want.... ;-)

Now the .AddrByName function is done, so you can use a host name and get the
IP address in the form a.b.c.d.

[.GetPeerName returns an IP address but requires a connection first, as in a
server application where one wants to know the IP address of the client
computer connected to the server.]

=====MORE ABOUT USAGE:

Dim Sock as Rsocket
Dim S as long, ret as long
S=Sock.S 'This creates socket
ret=Sock.NonBlock(S) 'ret = 0 if nonblocking worked
ret=Sock.Connect(S,ip$,Port%) 'ret = -1 is error; ret = 0 is connected

'In non-blocking mode, ret above is always -1 (it's non-blocking, right?)

IF WSAGetLastError <> 10035 THEN Goto SomethingIsWrong

The above test after a .Connect attempt is important. If something is wrong,
it may be a good idea to do a Sock.Close(S) to terminate the socket, and start
fresh with a new socket handle (Sock.S).

=====MONITORING CONNECTION STATUS:

How to test if you are connected in non-blocking mode:

Of course, you have to wait some time (several hundred msec or more). Use the
DoEvents statement especially if you are initiating multiple socket connect
calls in a short interval.

1. IF Sock.IsConnected(S, Secs) > 0 THEN Goto ThisSocketIsConnected

where S is the socket handle and Secs is the timeout in seconds and fractional
quantities are not implemented (i.e., Secs is an integer).

Note: When Secs = 0, the Sock.IsConnected(S, 0) function returns with an answer
immediately (is non-blocking). However, if Secs is greater than 0, then
.IsConnected will block until a connection outcome occurs or until the timeout
has expired. Generally, speaking, multi-socket applications will use a timeout
of zero.

The new twist on the .IsConnected function is that now it will return -1 if an
error occurs. Depending on your environment, the error return will indicate
"connection refused" if sufficient time has passed (similar to what a regular
TCP connection might require). This is an important point since it means that
the remote host has replied with an ACK and RST flag TCP packet indicating it
is there, up and running. Thus, this usage of the .IsConnected function acts
as a sort of TCP ping which can reveal the presence of hosts behind firewalls
that do not respond to ICMP pings. Neat!

2. The following code also works:
ret=Sock.Connect(S,ip$,Port%) 'Do the original call again!!
ret=WSAGetLastError 'if ret = 10056, you are connected!
IF ret = 10056 THEN Goto Connected Else Goto ConnectFailed

WSAError 10056 indicates a call failed *because* the socket is connected.
In this context, IF WSAGetLastError = 10056, S is presently connected.

On the other hand, if you are trying to establish a *new* connection with
socket S and you get error 10056 in the above code, it means the *previous*
connection is still established. Either you did not do the .EndConnection
and .Close OR wait long enough OR use DoEvents to allow the network layer to
close the previous connection. It is usually best to .Close the socket,
create a new one and then proceed to the next connection.

You can test for connection status at any time. Some servers will drop
connections. Common sense suggests other methods. E.g., if an attempt to
write to the socket (Sock.Write...) returns an error, you may not have, or
have lost, a connection.

3. Just wait a little and go straight to your socket read/writes! If they
succeed, jeepers, you must be connected. If not, well, guess!

=====BE CAREFUL WITH READS (Remote computers can do funny stuff!):

Always do this for Sock.Read or Sock.ReadLine if S is in Blocking mode:

Time(n)=timer 'n is the index for S = Socket(n)
ReadData:
IF Sock.IsServerReady(S) > 0 THEN
....Sock.Read .... etc.
END IF
IF timer - Time(n) < MaxSecToWait THEN Goto ReadData

If you do not do the above, a server that maintains the connection but sends
nothing will cause your program to hang and there is NO graceful exit. Do not
assume that the protocol says the server should send something and therefore
it will. Since most will behave themselves, you will have a program that
appears to work just fine and then later just stops. If you do a netstat -a -n
you find there is an established connection there and your program is waiting
for data that the particular server will not send. Maybe after a long time,
the remote host will close it for you.

Be careful with use of any other Sock.Method with no S argument because it may
not know what to do. E.g., Sock.MySocket cannot be relied on unless you
experiment with a specific context. However, .GetHostName and .GetHostIP work
(they do not require the S argument). Just experiment to see what works.

ALWAYS do Sock.EndConnection(S) when you are done with a connected S. This is
a graceful manner to shutdown a TCP connection. Reads and writes are disabled
and a FIN packet is sent to the peer indicating the inpending closure of the
connection.

To free system resources, do .Close(S) when you are done with a particular
attempt to connect, whether or not a connection occurs. This means another
Sock.S will be done to get a new S handle. Reliable sockets programming uses
this procedure to insure that events in the last connect operation do not
affect the results of a subsequent connection.

For example, for n sockets in an array Socket(n), one can start a loop:

DIM Socket(1 to MaxSockets) As LONG
n = 1
NextSock:
IF Socket(n) <= 0 THEN Socket(n)=Sock.S: Flag(n) = 0
S = Socket(n): Sleep 0.05

'.Connect or .IsConnected depending on Flag(n), Timer-Time(n), status of S, etc
'free the socket if you are done with it, else go to LoopSock
Sock.EndConnection(S): Sock.Close(S): Socket(n) = 0

LoopSock:
IF n < MaxSockets THEN n = n + 1 ELSE n = 1
DoEvents: Goto NextSock

IF all the files in this zip are put in one directory AND your RapidQ stuff is
in C:\rapidq, then "rc rsocket" will compile the demo program. You will have to
edit RC.BAT if C:\rapidq is not the home directory for RapidQ.


Appendix A: QDownload

Rapid-Q Documentation by Andreas Fink (c)2000 Appendix A: QDownload

QDownload Component

Offers an interface to download files from HTTP-Servers, either in the background or apparently, it has a sophisticated error diagnostic interface

QDownload Properties
Field | Type | R/W | Default | Support
Server | STRING | RW |  | W
Port | INTEGER | RW | 80 | W
File | STRING | RW |  | W
Outfile | STRING | RW |  | W
Outvar | STRING | R |  | W
Outdevice | INTEGER | RW | 1 | W
Statedevice | INTEGER | RW | 1 | W
State | INTEGER | R |  | W
Size | INTEGER | R |  | W
LastError | INTEGER | R |  | W
LastStringError | STRING | R |  | W
StateGauge | QGAUGE | RW | .height=20; .width=200 |

QDownload Methods
Method | Type | Description | Params | Support
Leechfile | FUNCTION | Performs the Download, needs all settings to be made | 0 | W
Check | FUNCTION | Checks for an Internet Connection | 0 | W
Percent | FUNCTION | Calculates the current State in Percent | 2 | W

QDownload Events
Event | Type | Occurs when... | Params | Support
None |  |  |  |

QDownload Examples

'Example for Qdownload usage

$TYPECHECK ON                           'Use these !!!!
$include "rapidq.inc"
$include "qdownload.inc"

dim download as qdownload               ' You should create an instance here
declare sub test

'That's all well known

create form as qform
 width = 220
 height = 260
 caption = "QDownload Example"
  create button as qbutton
   top = 10
   width = 80
   left = (form.clientwidth/2)-button.width/2
   Caption = "Download!"
   onclick  = test
  end create
  create edit1 as qedit
   top = 50
   text ="Server.com"
   left = (form.clientwidth/2)-edit1.width/2
  end create
  create edit2 as qedit
   top = 80
   text ="Path/Filename"
   left = (form.clientwidth/2)-edit2.width/2
  end create
  create edit3 as qedit
   top = 110
   text ="LocalDrive:/Localpath/Filename"
   left = (form.clientwidth/2)-edit2.width/2
  end create
  create checkbox1 as qcheckbox
   top = 140
   width = 160
   left = (form.clientwidth/2)-checkbox1.width/2
   caption = "Show Status in Gauge"
  end create
  create checkbox2 as qcheckbox
   top = 170
   width = 200
   left = (form.clientwidth/2)-checkbox2.width/2
   caption = "Save to file (X) or show using word ()"
   end create
end create

'Here you should determine the qgauge's appearance
download.stategauge.parent = form
download.stategauge.left = (form.clientwidth/2)-t.stategauge.width/2
download.stategauge.top = 200

form.showmodal

sub test
DIM Object AS QOLEOBJECT                  'This one is just for demonstrative issues

download.server =edit1.text               'The Server property is to be set, assuming the port is 80
download.file=edit2.text                  'The File property is set, i.e. the name of the file to be gotten
download.outfile=edit3.text               'The Outfile property is set, i.e. the file the downloaded file
                                          'will be saved in

select case checkbox2.checked
case True
  download.outdevice = 2                  'The Outdevice property is set, i.e. 1 = qdownload.outvar
end select                                '                                    2 = qdownload.outfile

select case checkbox1.checked
case True
  download.statedevice=2                  'The Statedevice property is set, i.e. 1 = qdownload.state
end select                                '                                      2 = qdownload.stategauge

if download.leechfile then                'And do it, if all works well leechfile returns True
 select case checkbox2.checked
 case False
   Object.CreateObject("word.basic")
   Object.AppShow
   Object.FileNew
   Object.Insert(t.outvar)
   Object.Free
 end select
else
 showmessage (download.laststringerror)   'and if not False, then qdownload.lasterror, .laststringerror are
end if                                    'interesting
end sub


QHyperlink

' QHyperLink version 13.5.1.10b
' -----------------------------

' Notes:
' Some stuff within this file needs to be taken out and some stuff needs to be
' added. So if you find what appears to be useless code, just remember that I'm not
' yet finished with developing this component (hey, it works dosen't it? ;))

' Documentation of revision history will start at versions greater than 13.5.1.10 because I forgot what I
' revised... silly me :P

' An example program is included; right now, documentation isn't... except that which is given within this file.

' Disclaimer:
' You may use this component within your applications provided you acknowledge that it
' is distributed as as-is freeware and that it has been created by me - you don't have
' to document that within your app if you don't want to.

' ******************************** Special Thanks! *************************************
' * *
' * Peter Scheutz -- Thanks for sharing your QArrow component with the RapidQ community! *
' * Until recently, I didn't know how to implement rollovers within my RapidQ applications. But *
' * when I took a deeper look into your code, I woke up and figured out how to do it... *
' * and here's the end result ;) *
' * *
' ***********************************************************************************
' ====================================================================================

' The following bitmap resource should be placed in the same directory as
' this file: QHyperLink.occ


QHTML

'************************************************************************
'* Class QHTML Version 1.0 L Pascal Delcombel-2003-2008 *
'************************************************************************
' Class to show (readonly) simplified HTML pages. *
' Principle: no API no DLL *
' (in order to be switchable to Linux version) *
'************************************************************************
' LIMITS *
' > just a few of the tags supported (ie TABLE not included so far...) *
' > no frame so far *
' > maximum of 200 000 elements (because no way to do dynamically redim *
' arrays from within a QObj) *
' you may change that number to smaller or greater one (and smaller *
' or greater html pages) through constant htmlMaxElements, here below* *
' > no formulaire (button, field, ...) *
' > no download !! *
' > see OnLoadImage to use external routine in order to load pictures *
' like jpeg , GIF and other image files *
'************************************************************************
' Events *
' ****** *
' OnHover(TypeObject as String, URL as String, x as long, y as long _*
' , shift as long) *
' -- TypeObject HREF or Tag Type *
' -- URL URL/Filename (if HREF) or hovered text/tag *
' ****** *
' OnTagClick(URL as String, x as long, y as long, shift as long) *
' -- URL HREF (URL or FileName) *
' ****** *
' OnLoadImage(Image as QImage, FileName as String) *
' -- Image QImage in which loading the FileName image *
' -- FileName FileName of the image to be loaded *
'************************************************************************
' Properties *
' ********** *
' HTMLTExt as String RW get/set HTMLText *
' DefaultFontName RW get/set default font name *
' DefaultFontSize RW get/set default font size *
' DocumentTitle R get html page title *
' PopUpMenu RW get/set popupmenu (heritage) *
'************************************************************************
' Methods *
' ******* *
' OpenFile(FileName as String) *
' -- FileName (not URL so far) *
' ******* *
' Repaint *
' ******* *
' PrintPreview *
' ******* *
' SearchText(Text as String,Popupwindow as Integer) *
' -- Text Text to be searched *
' -- Popupwindow True to open popup window / false otherwise *
'************************************************************************


FileOps

'========================================================================|
' Fileops is a set functions to manipulate file names and paths.         |
' QUOTE - Returns a quoted string                                        |
' STRIPPATH - Returns file path (without file name)                      |
' STIPFILENAME - Returns file name (without path)                        |
' STRIPFILEEXT - Returns file extension (like ".exe", ".html" etc.)      |
' FILENAMENOEXT - Returns file name without extension                    |
' FULLPATHNOEXT - Returns full path without file extension               |
'========================================================================|

$include "fileops.inc"

declare sub file_operations

create form as qform
       center
       width = 500

       create fl as qfilelistbox
       align = 3
       ondblclick = file_operations
       end create

       create re as qrichedit
       align = 5
       font.name = "Courier new"
       wordwrap = 0
       end create
showmodal
end create

sub file_operations
re.clear
dim sta as string
sta = fl.filename
re.addstrings "ORIGINAL FILE NAME" + chr$(9) + sta, _
              "QUOTED FILE NAME" + chr$(9) + quote(sta), _
              "FILE PATH" + chr$(9) + chr$(9) + StripPath(sta), _
              "FILE NAME" + chr$(9) + chr$(9) + stripfilename(sta), _
              "FILE EXTENSION" + chr$(9) + stripfileext(sta), _
              "WITHOUT EXTENSION" + chr$(9) + filenamenoext(sta), _
              "FULL NAME (NO EXT)" + chr$(9) + fullpathnoext(sta)
end sub

' QUOTE : Returns a quoted string
function Quote (StringToQuote as string) as string
StringToQuote =  chr$(34) + StringToQuote + chr$(34)
result = replacesubstr$(stringtoquote, chr$(34) + chr$(34), chr$(34))
end function

'===============================================================================
' STRIPPATH : Returns file path (without file name)
Function StripPath (fullname as string) as string
result = left$(fullname, rinstr(fullname, "\"))
end function

'===============================================================================
' STRIPFILENAME : Returns file name (without path)
Function StripFileName (fullname as string) as string
result = right$(fullname, len(fullname) - rinstr(fullname, "\"))
end function

'===============================================================================
' STRIPFILEEXT : Returns file extension (like ".exe", ".html" etc.)
Function StripFileExt (fullname as string) as string
result = right$(fullname, len(fullname) - rinstr(fullname, ".") + 1)
end function

'===============================================================================
' FILENAMENOEXT : Returns file name without extension
function FileNameNoExt(fullname as string) as string
fullname = right$(fullname, len(fullname) - rinstr(fullname, "\"))
result = left$(fullname, rinstr(fullname, ".") - 1)
end function

'===============================================================================
' FULLPATHNOEXT : Returns full path without file extension
function FullPathNoExt(fullname as string) as string
result = left$(fullname, rinstr(fullname, ".") - 1)
end function

'===============================================================================
' C_Style : Returns "slashed" path from a "backslashed" one
function C_Style (fullname as string) as string
fullname = replacesubstr$(fullname, "\\", "\")
result = replacesubstr$(fullname, "\", "/")
end function

'===============================================================================
' SYSDIR : Retrieves windows shell directories

'-------------------------|
' Allowed values for dir  |
'-----------------------------------------------------------------------------|
' Desktop                 | Templates               | AppData                 |
' Start Menu              | Programs                | Startup                 |
' Fonts                   | SendTo                  | Recent                  |
' Favorites               | Cache                   | Cookies                 |
' History                 | NetHood                 | Personal                |
' PrintHood               | Local AppData           | My Pictures             |
' Administrative Tools    |                         |                         |
'-----------------------------------------------------------------------------|

function SysDir (dir as string) as string
DIM fo_reg AS QRegistry
fo_reg.RootKey = &H80000001
fo_reg.openkey ("Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0)
result = fo_reg.readstring(dir) + "\"
end function

'===============================================================================
' HOMEDIR : The folder where the application is

function homedir() as string
result = left$(command$(0), rinstr(command$(0), "\"))
end function

'===============================================================================
' BROWSEFORFOLDERS : Returns the selected folder

function BrowseForFolders (initialdir as string, wincapt as string) as string
dim bff_form as qform
with bff_form
.height = 400
.center
.caption = wincapt
.delbordericons 2
end with
dim bff_tree as qdirtree
with bff_tree
.parent = bff_form
.align = 5
end with
if bff_form.caption = "" then bff_form.caption = "Select folder"
if direxists(initialdir) then
bff_tree.directory = initialdir
else
bff_tree.directory = curdir$
end if
bff_form.showmodal
result = bff_tree.directory
end function

'===============================================================================
' BROWSEFORFILE : Returns the selected folder

Function BrowseForFile (caption as string, filter as string, _
initialdir as string) as string

dim bff_od as qopendialog
with bff_od
.caption = caption
.filter = filter
.initialdir = initialdir

if .execute then
    result = .filename
end if
end with

end function

'===============================================================================
(Andrew Shelkovenko dec 2003)

sub MKSubDir (DirDst$)
'Create DirDst$ directory with full subdir structure
Example: MKSubDir ("C:\BAS\RAPIDQ\RQ_E140\old\RQDPhlp\")

sub SubDirCopy (DirSrc$, DirDst$, mask$)
'Copy DirSrc$ directory with full subdir structure and files (by mask$) to DirDst$
sub DirCopy (DirSrc$, DirDst$, mask$) '- -----------------------------------'
'Copy files (by mask$) from DirSrc$ to DirDst$

'===============================================================================
sub KillFiles (FileName$)
'Kill files in FileName$
' for example FileName$="C:\BAS\RAPIDQ\tmp\*.tmp"

FName$ = DIR$(FileName$, 0) '-- Get first file
while FName$ <>""
kill FName$
if fileexists (FName$)>0 then print "Can't kill file "+FName$
FName$ = DIR$ '-- Get next file
wend
end sub


File Utils

$ESCAPECHARS ON

'ChangeFileExt:
'Returns: String
'Parameters:
'FileName (String): Name of file with old extention
'NewExt (String): New extention. This must include the leading ".".

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'Changes the extention of FileName to NewExt. For example:
'ChangeFileExt("File.bas", ".inc")
'returns File.inc. This function does not delete the old string,
'instead, it simply returns a new one with the extention.
'You must include the leading "." for it to be added, as it is not
'done by the function.

FUNCTION ChangeFileExt(FileName as String, NewExt as STRING) as STRING
    DIM Returns as STRING
    DIM CurrentExt as String
    DIM CurrentExtLoc as INTEGER
    DIM FileNoExt as STRING

    CurrentExtLoc = RInStr(FileName, ".")
    CurrentExt = MID$(FileName, CurrentExtLoc, LEN(FileName))
    FileNoExt = DELETE$(FileName, CurrentExtLoc, LEN(FileName))

    Result = INSERT$(NewExt, FileNoExt, LEN(FileName))
    ChangeFileExt = Result
END FUNCTION

'ExtractFileName:
'Returns: String
'Parameters:
'FileName (String): File with full path

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ExtractFileName takes a file name with a path and returns only
'the file name. For example:
'ExtractFileName("C:\\Program Files\\AFile.bas")
'returns AFile.bas. You can use either two back-slashes or a single
'forward slash (/) for folder seperators.
'Both forward and back-slashes are supported by Windows.
'The back-slash takes procedure over the forward slash.
'Note that ExtractFileName does _not_ check the validity of the path passed.
'You must check yourself.

FUNCTION ExtractFileName(FileName as STRING) AS STRING
    DIM Length as INTEGER
    DIM Result as STRING

    Length = RInStr(FileName, "\\") OR RInStr(FileName, "/")
    Result = MID$(FileName, Length+1, LEN(FileName) - Length + 1)
    ExtractFileName = Result
END FUNCTION

'ExtractFilePath
'Returns: String
'Parameters:
'FileName (String): File with full path

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ExtractFilePath takes string with full path and returns a string
'with only the path. For example:
'ExtractFilePath("C:\\Program Files\\AProgram.bas")
'returns C:\Program Files (the \\'s are for RQ and back-slashes).
'ExtractFilePath also takes forward-slashes (/). Window's supports
'these as well.
'The back-slash takes procedure over the forward slash.
'Note that ExtractFilePath does _not_ test the validity
'of the passed name. You must check it yourself. Even if the name is
'invalid, the path will be returned. For example, if C:/ProgramErrorFiles/AFile.txt
'is passed, C:/ProgramErrorFiles will be returned.

FUNCTION ExtractFilePath(FileName as STRING) AS STRING
    DIM Length as INTEGER
    DIM Result as STRING

    Length = RInStr(FileName, "\\") OR RInStr(FileName, "/")
    Result = MID$(FileName, 0, Length)
    ExtractFilePath = Result
END FUNCTION

'ChangeFileName
'Returns: String
'Parameters:
'FileName (String): File with full path
'NewName (String): Text that will replace old file name

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ChangeFileName takes a file name with full path and file and a new name.
'It replaces the current filename (in FileName) and replaces it with NewName.
'ChangeFileName does not actually change FileName, instead it returns a new
'string which contains the new name.
'Note that ChangeFileName does not check the validity of FileName
'or the new result. You must do it yourself (if you want). ChangeFileName
'takes both the back-slash and forward slash to serperate folder and file names.
'You can use either \\ or /. Both are supported by Windows.
'The back-slash takes procedure over the forward slash.

FUNCTION ChangeFileName(FileName as STRING, NewName as STRING) AS STRING
    DIM FileNameLoc as INTEGER
    DIM Result as STRING
    DIM PathNoName AS STRING

    PathNoName = ExtractFilePath(FileName)
    Result = PathNoName+NewName
    ChangeFileName = Result
END FUNCTION

'ChangeFilePath
'Returns: String
'Parameters:
'FileName (String): File with full path
'NewPath (String): New path that will replace the path in FileName

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ChangeFilePath takes FileName and replaces the path with NewPath.
'It does not change FileName to have the new path, instead, it returns
'a string which has the new path. It's up to you to take the correct
'action. Also, old or new path and names' are not checked for validity,
'you must do it yourself.
'You may use either the \\ or the / to seperate your paths. Windows supports
'both.

FUNCTION ChangeFilePath(FileName as STRING, NewPath as STRING) AS STRING
    DIM Result AS STRING
    DIM FileNoPath AS STRING

    FileNoPath = ExtractFileName(FileName)

    Result = NewPath+FileNoPath
    ChangeFilePath = Result
END FUNCTION


FtiQuery

' Warranties: None. This code is provided AS-IS.
' Developed on the Windows 98 SE platform.
' Version: 1.6.1!
'
' Dependencies:
' ftiExtractFileName
' ftiExtractProgNane
' ftiExtractProgPath
'
' Description:
' A cool include file that uses the registry to retrieve information on
'any file extension/type!

'Several constants have been defined that are used to retrieve this
'information, they are:

'
' Note(s):
' I'm going to try to put some of the code that reads the registry into
' a function, to reduce the file size.
'
' ftiClassName:
' queries the class name of the specified filetype
'
' ftiDefCommand:
' queries the value of the "shell/open/command" sub key
' of the parent program (module), the default command
'
' ftiContentType:
' queries the content type of the specified file type
'
' ftiQueryDefault:
' queries the integrity of the registered file extension
' (helps to see if there are any errors in the registry ;) )
'
' ftiProgramCommand:
' queries the parent (module) of the specified file type
'
' ftiDefaultIcon:
' queries the icon for the specified file type
'
' New updates:
'*****************************
' ftiProgramName:
' gets the actual file name of the parent of the specified file type
'
' ftiProgramExt:
' Gets the extension of the parent program. Later on I want to enable
' queries for the file extension.
'
' ftiProgramPath:
' Gets the actual program path.
'
' ** end of description *******************************************
' Special precautions:
' Whatever you do, DON'T turn the $escapechars preprocessor
' directive ON! Doing so may result in incorrect registry
' settings, and/or may cause Windows to CRASH (not being able to boot
' up Windows sounds about right).
'
' When you enter the first string argument of the GetFileTypeInfo function,
' make sure that you do not have 2 or more forward/backward slashes beside each other.
' Instead, enter the first argument like this: "C:/blah/files";
' not like this: "C:///blah//files".
'
' Of course, you wouldn't actually have paths like that,
' that is, unless Windows was playing dominoes with your ASCII character set at the time :P
'
' Known bugs:
' None actually, unless you consider the forward/backward slash problem a bug ;)
' You should be fine if you just obey the special rule.
'
' Usage:
'
' function:
' GetFileTypeInfo(FileType, ftiQueryValue)
'
' FileType: string
' ftiQueryValue: integer
'
' FileType can be a file extension, file name, path and file name,
' or even a dot with a file extension; basically anything as long as
' you obey the special rule defined in the Special precautions
' section. I'm trying to fix this =)
'
' ftiQueryValue is any of the several constants defined in the
' Description section.
'
' If an error occurs in reading the registry, GetFileTypeInfo will return -1.
' If you get a return value of one, that value is TRUE.
' If you get a return value of zero, that value is FALSE.


Control.inc

' Control panel library for Rapid-Q!!!
' Version 1.0
' 3/25/01
' The name goes with the shell program name: control.exe
' I found out the arguments required to run the control panel applets!!!
' use: rundll32 <library (Shell32)>,Control_RunDLL <cplfile>
' (@)<which dialog>
' optional comma and index to display the desired tab on the dialog!

' NOTE: if you have a cpl file that dosen't take any arguments and you would like
' to display it's tabbed index, use @0, comma, <index>
' else, just use the above usage on lines 4-5.
' Not all dialogs of the Control Panel have arguments.

' If you see a sub/function that is prefixed with an 'n', it indicates that
' that dialog (applet) of the Control Panel has tabs, and the argument of the sub/function
' is the index of the tab (I think that indexing of any tab starts at 1).

' Thanks to Rudy Elyn (email: Rudy@vt4.net) for his Config program (and source);
' it served as a base to help me out in "cracking the command line".

' If you have any questions, comments, or just want to say hello, please email me at b_j0@yahoo.com :)

' It would be nice to email me if you like the library ;)

' It may not be all of them, but I did my best ;)

' The Control_RunDLL code in the shell command points out to me that there is an undocumented API
' sub/function called Control_RunDLL hiding in Shell32.dll and that it's argument(s) is/are:
'
' 1: the cpl file (located in the Windows System directory)
'
' 2: the number (tag) of the applet located in the cpl file that you wish to run (prefixed with an "@" (at) sign);
'     the "tags" of each applet start at zero (I think!)
'
' 3:  the tab to display when the applet is shown (if the applet has one)
'
'
' Oh yeah:
' - not all of the subs load applets, they can load folders too.
' - you need Windows in order for this library to work
' - I will refer to all of the applets that have tabs, as dialogs,
'   so all of them will be suffixed with Dlg
'
' - more libraries are coming soon :)

sub nOpenMouseDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @0,"+str$(index), 5)
end sub

sub nOpenKeyboardDlg(index%)
if index%>1 then index%=0
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL __
            main.cpl @1,"+str$(index%), 5))
end sub

sub OpenPrintersFolder
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @2", 5)
end sub

sub OpenFontsFolder
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @3", 5)
end sub

sub nOpenDisplayDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl @0,"+str$(index%), 5)
end sub

sub OpenTimeDlg
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl @0", 5)
end sub

sub nOpenDialingDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL telephon.cpl @0,"+str$(index%), 5)
end sub

sub nOpenSystemDialog(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @0"+str$(index%), 5)
end sub

sub OpenAddNewHardwareDlg
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1", 5)
end sub

sub nOpenScannerDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL sticpl.cpl @0", 5)
end sub

sub OpenThemesDlg
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL themes.cpl @0", 5)
end sub

sub nOpenAddRemoveProgramsDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl @0,"+str$(index%), 5)
end sub

sub nOpenPowerMgmtDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl @0,"+str$(index%), 5)
end sub

sub nOpenPasswordsDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL password.cpl @0,"+str$(index%), 5)
end sub

sub nOpenModemDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL modem.cpl @0,"+str$(index%), 5)
end sub

sub nOpenMMDeviceDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @0,"+str$(index), 5)
end sub

sub OpenSoundsDlg
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1", 5)
end sub

sub nOpenGamesDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL joy.cpl @0,"+str$(index%), 5)
end sub

sub nOpenRegionalDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL intl.cpl @0,"+str$(index%), 5)
end sub

sub nOpenInternetDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl @0,"+str$(index%), 5)
end sub

sub nOpenUsersDlg(index%)
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl @1,"+str$(index%), 5)
end sub

' Only if one has TweakUI98 (or greater?) installed
' this one is not configured to accept arguments to display tabs at index%
sub OpenTweakUIDlg
PID = Shell("rundll32.exe shell32.dll,Control_RunDLL tweakui.cpl @0", 5)
end sub


QSHFileOperation.bas

' ============================================================== '
' QSHFileOperation component - version 1 January 2002 '
' Marcin Szafran '
' Implemented API SHFileOperation function. '
' Allows copy, rename, delete and move files and folders '
' with wildcard and recursivly... and much more! '
' ***** BE CAREFULL WITH DELETE AND RECURSE! ***** '
' Thanks for Jacques Philippe for his help '
' ============================================================== '
'= QSHFileOperation methods description ==================

'--- Copying ---
' .CopyEx: Copying with extended attributes
' .Copy: Simple copying
' Usage ObjName.CopyEx(ExistingFileName(s),SourceFileName(s),flags,handle)
' ObjName.Copy(ExistingFileName(s),SourceFileName(s))
' RQ keyword: - (none)

'--- Moving and Renaming ---
' .MoveEx: Moving with extended attributes
' .Move: Simple moving
' .RenameEx: Renaming with extended attributes
' .Rename: Simple renaming
' Usage ObjName.MoveEx(ExistingFileName(s),SourceFileName(s),flags,handle)
' ObjName.Move(ExistingFileName(s),SourceFileName(s))
' ObjName.RenameEx(ExistingFileName(s),SourceFileName(s),flags,handle)
' ObjName.Rename(ExistingFileName(s),SourceFileName(s))
' RQ keyword: RENAME (does not work with dirs)

'--- Deleting ---
' .DeleteEx: Deleting with deleting confirmation on/off and other extended attributes - enables delete to Recycle Bin
' .Delete: Simple deleting with deleting confirmation on/off - enables delete to Recycle Bin
' Usage ObjName.DeleteEx(FileName(s),to_Bin_on/off,confirm_on/off,flags,handle)
' ObjName.Delete(FileName(s),to_Bin_on/off,confirm_on/off)
' RQ keyword: KILL (does not work with dirs)

'= QSHFileOperation properties description ===============

' .DefaultFlagsEx: Setting default flags for methods with extended attributes (.MethodNameEx) - now = 0
' .DefaultFlags: Setting default flags for simple methods (.MethodName)

' I hope that parameters names are clear

Function CopyEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long

Function Copy (dSHfoFrom As String, dSHfoTo As String) As Long

Function MoveEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long

Function Move (dSHfoFrom As String, dSHfoTo As String) As Long

Function RenameEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long

Function Rename (dSHfoFrom As String, dSHfoTo As String) As Long

Function DeleteEx (dSHfoFrom As String, SHfoToBin As Integer, SHConfirm As Integer, _
SHfoFlags As Integer, SHfoHandle As Long) As Long

Function Delete (dSHfoFrom As String, SHfoToBin As Integer, SHConfirm As Integer) As Long

'= CONSTANTS =============================================

'--- Operations ---

Const foMove = &H1 ' Move the files specified in pFrom to the location specified in pTo

Const foCopy = &H2 ' Copy the files specified in the pFrom member to the location specified in the pTo member

Const foDelete = &H3 ' Delete the files specified in pFrom

Const foRename = &H4 ' Rename the file specified in pFrom. You cannot use this
'flag to rename multiple files with a single function call. Use FO_MOVE instead

'--- Flags - should be set with OR operator if used more than one ---
'--- Constants names were changed to RapidQ kind --------------------

Const fofAllowUndo = &H40 ' Preserve Undo information, if possible. If pFrom
'does not contain fully qualified path and file names, this flag is ignored

Const fofConfirmMouse = &H2 ' Not currently used

Const fofFilesOnly = &H80 ' Perform the operation on files only if a wildcard
'file name (*.*) is specified

Const fofMultiDestFiles = &H1 ' The pTo member specifies multiple destination
'files (one for each source file) rather than one directory where all source
'files are to be depos

Const fofNoConnectedElements = &H2000 ' Do not move connected files as a group.
'Only move the specified files

Const fofNoConfirmation = &H10 ' Respond with Yes to All for any dialog box that is displayed
Const fofNoConfirmMkDir = &H200 ' Do not confirm the creation of a new directory if the operation requires one to be created
Const fofNoCopySecurityAttribs = &H800 ' Do not copy the security attributes of the file
Const fofNoErrorUI = &H400 ' Do not display a user interface if an error occurs
'Const fof_RecurseReparse = ' Recurse into reparse points. The default is to not recurse
'Const fof_NoRecurseReparse = ' Treat reparse points as objects, not containers.
'You must set _WIN32_WINNT to 5.01 or later to use this flag

Const fofNoRecursion = &H1000 ' Only operate in the local directory. Don't operate recursively into subdirectories

Const fofRenameOnCollision = &H8 ' Give the file being operated on a new name in
'a move, copy, or rename operation if a file with the target name already exists

Const fofSilent = &H4 ' Do not display a progress dialog box

Const fofSimpleProgress = &H100 ' Display a progress dialog box but do not show the file names
'Const fofWantMappingHandle = &H20 ' If FOF_RENAMEONCOLLISION is specified and
'any files were renamed, assign a name mapping object containing their old and new names to the hNameMappings member

Const fofWantNukeWarning = &H4000 ' Send a warning if a file is being destroyed
'during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION


Appendix A: QAbout

Documentation component by D.Glodt (c)2002-2003 Appendix A: QAbout

QAbout Component

QAbout is a dialog box "About" showing the name,version,author of an application,email link and web link.

QAbout Properties
Field | Type | R/W | Défault
Caption | STRING | R/W |
 | Title of dialog box |  |
Name | STRING | R/W |
 | Application name |  |
AppVersion | STRING | R/W |
 | Version and révision of application |  |
Image | QIMAGE | R/W |
 | Icone or image of application |  |
Text | STRING | R/W |
 | Text of application for copyright and other |  |
Email | STRING | R/W |
 | Link e-mail adress , example:"dominique.glodt@libertysurf.fr" |  |
Web | STRING | R/W |
 | Link web page ,example:"www.allapi.net" |  |
AppFont | QFONT | R/W |
TextFont | QFONT | R/W |
EmailFont | QFONT | R/W |
WebFont | QFONT | R/W |

QAbout Methods
Method | Type | Description | Params
Show | SUB | Show the dialog box |

QAbout Events
Event | Type | Occurs when... | Params

QAbout Examples
$TYPECHECK ON
$include "object\qabout.inc"

$resource ico as "icone.ico"
declare sub routine1
dim about as QAbout

create form as QFORM
width=300
height=200
center
onclick=routine1
end create

form.showmodal

sub routine1
about.AppFont.color=&h007700
about.AppFont.bold=1
about.Appname="Platforme"
about.Appversion="1.02"
about.caption="A propos de "+about.Appname
about.text="Auteur:Glodt dominique"+chr$(13)+"Copyright(c)software
2000-2002  "
about.image.icohandle=ico
about.email="dominique.glodt@libertysurf.fr"
about.web="www.allapi.net"
about.show
end sub


Appendix A: QAnim

Documentation component by D.Glodt (c)2003 Appendix A: QAnim

QAnim Component

QAnim is component of animation inherited from QImage component.
Dimensions Width and Height must be fixed and identical to dimensions of the images.

QAnim Properties
Field | Type | R/W | Default
Width | SHORT | R/W |
Height | SHORT | R/W |
Left | SHORT | R/W |
Top | SHORT | R/W |
Visible | INTEGER | R/W | False
ImageList | QIMAGELIST | R/W |
 | images for animation |  |
Index | SHORT | R/W | 0
 | Index image and show image |  |
BackColor | LONG | R/W |
 | Backcolor used for images if use image mask |  |
Masked | BOOLEAN | R/W | False
 | Use image mask |  |
Move | BOOLEAN | R/W | False
 | Start/Stop animation |  |

QAnim Methods
Method | Type | Description | Params

QAnim Events
Event | Type | Occurs when... | Params

QAnim Example
$TypeCheck on
$include "rapidq.inc"
$include "Object/QAnim.inc"
$resource img1 as "earthspn_frame_000.bmp"
$resource img2 as "earthspn_frame_001.bmp"
$resource img3 as "earthspn_frame_002.bmp"
$resource img4 as "earthspn_frame_003.bmp"
$resource img5 as "earthspn_frame_004.bmp"
$resource img6 as "earthspn_frame_005.bmp"
$resource img7 as "earthspn_frame_006.bmp"
$resource img8 as "earthspn_frame_007.bmp"
$resource img9 as "earthspn_frame_008.bmp"
$resource img10 as "earthspn_frame_009.bmp"

declare sub anim
declare sub opaque
declare sub transparent
declare sub close

CREATE Form AS QFORM
Caption = "Form1"
Width = 220
Height = 170
Center
OnClose=close
CREATE bt1 as QBUTTON
caption="Opaque"
left=120
top=10
OnClick=Opaque
END CREATE
CREATE bt2 as QBUTTON
caption="Transparent"
left=120
top=40
OnClick=Transparent
END CREATE
CREATE bt3 as QBUTTON
caption="Start/Stop"
left=120
top=70
OnClick=Anim
END CREATE
CREATE Image1 AS QAnim
Left=10
Top=10
width=96
height=96
BackColor=&hff0000
Masked=true
Imagelist.AddBMPhandle img1, &h0
Imagelist.AddBMPhandle img2, &h0
Imagelist.AddBMPhandle img3, &h0
Imagelist.AddBMPhandle img4, &h0
Imagelist.AddBMPhandle img5, &h0
Imagelist.AddBMPhandle img6, &h0
Imagelist.AddBMPhandle img7, &h0
Imagelist.AddBMPhandle img8, &h0
Imagelist.AddBMPhandle img9, &h0
Imagelist.AddBMPhandle img10, &h0
speed=100
index=0
END CREATE
END CREATE
Form.ShowModal

sub anim
if Image1.move then
Image1.Move=false
else
Image1.Move=true
end if
end sub

sub opaque
Image1.BackColor=&haa0000
end sub

sub transparent
Image1.BackColor=form.color
end sub

sub close
Image1.Move=false
application.terminate
end sub


Appendix A: QCHART

QChart Documentation by Michael Zito (c) 2003-2004
         Appendix A: QChart

QChart Component

=============================================================================================
                           QChart:  A Charting Class for Rapid-Q
                          Copyright (c) 2003-2004  Michael J. Zito
                              Released under the LPGL License
=============================================================================================

QChart provides a rich set of 2-D charting routines for Rapid-Q programmers.
It generates histograms, bar charts, XY-scatter plots, line graphs, pie charts
and box plots.  Each charting routine will calculate an appropriate scale and plot
the data contained in the .Data or .XYData property of the object.  The user may
optionally specify the scaling as well as fonts, grids or other properties
(see code and HTML documentation). Once the data is formatted graphs can be called
with a few lines of simple code.

----> To create an instance and call QChart:

                $INCLUDE "QChart.inc"
                CREATE YourInstanceName AS QChart
                  Parent = QForm, QTabControl or QPanel
                  Set any other desired properties of a QCanvas
                END CREATE
                WITH YourInstanceName
                   .Initialize
                   .ChartType = ctXXXX
                   .ChartStyle = csXXXX
              ---->Change Any Desired Properties (See code or HTML Documentation)
              ---->REDIM .Data array property (See below)
              ---->Load Data Into .LabelList, .LegendList and .Data Array
                   .DrawChart (Overlay T or F)
                END WITH

NOTE: There is little error checking in this class.  It is up to the user
      to insure that the data is formatted properly before calling each routine.

LegendList and LabelList are implemented as QStringLists.
     *Use the .AddItems Method of each property to add text to the lists.
     *LegendList contains legend text and usually refers to the Cols (i.e. Series)
     *LabelList contains text used to label the X Axis and usually refers to Rows
      (i.e. Categories).  LabelList items are NOT USED by XY Charts

The .Data property is a 2 dimensional array of DOUBLE which must be REDIMd by the user
    prior to filling the grid with data.  The first dim is Cols and the second is Rows.
    Each Col represents a series to be plotted.  The Rows represent the data values
    within each series. Use the .Data property for all charts EXCEPT XY Charts.

XY Charts have their own data array.
    The .XYData property is a 3 dimensional array of DOUBLE. The first dim is Cols
    and the second is Rows. The third dim is ALWAYS 2. Each Col represents a series
    to be plotted. The Rows represent the number of XY data pairs within each
    series. The third dimension refers to the X and Y data values for each
    point to be plotted: 1 = X and 2 = Y values

----> To REDIM the .Data or .XYData array property:

You MUST set the .Cols and .Rows properties before calling QChart.  These values are used
throughout the QChart class as loop counters. Set .Cols to number of series to be plotted
and set .Rows to number of values in each series. REDIM the array using .Cols and .Rows.

NOTE:  To REDIM you MUST EXPLICITLY REFERENCE your QChart instance by name (even inside a
       WITH block) or RapidQ will not find and REDIM the array.  (A RapidQuirk?!?)
          WITH YourInstanceName
            .Cols = 2                                     <-- Num series
            .Rows = 2                                     <-- Num values in each series
            REDIM YourInstanceName.Data(.Cols, .Rows)     <-- for all EXCEPT XY Charts
            REDIM YourInstanceName.XYData(.Cols, .Rows, 2)<-- for XY Charts
          END WITH

   ----> Sample Data Formats (given the DIMs above):

              XY Charts                                All Other Charts
         =====================                         ================
         Series  NumPts Values                          Series  Values
         (Col)   (Row)  (dim 3)                         (Col)   (Row)
           1       1      1 <-- X                         1     val 11
           1       1      2 <-- Y                         1     val 12
           1       2      1                               2     val 21
           1       2      2                               2     val 22
           2       1      1
           2       1      2
           2       2      1
           2       2      2

   Box Plots         HiLo Plots        Pie Charts      BarLine Plots
  (5 rows only)     (3 rows only)     (1 Col only)     (2 Cols only)
================  =================  ==============   ===============
 Row  1 = Max      Row   1 = Hi        Col     Row     Col 1    Col 2
      2 = Q3             2 = Close    =====   =====    =====    =====
      3 = Median         3 = Lo         1       1       Bar      Line
      4 = Q1                            1       2       Data     Data
      5 = Min                           1       n

See QChartEx.rqb for more examples of setting up and calling each chart type.
See QChart.inc for named CONSTs used for ChartType, ChartStyle, HatchStyle and LineStyle

QChart Properties (Inherited from QCanvas)
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
ClientHeight INTEGER RW
W
ClientWidth INTEGER RW
W
Color INTEGER RW
WXG
CopyMode | INTEGER | RW | cmBlackness | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WXG
Font QFONT W
W
Height INTEGER RW
WXG
Hint STRING RW
W
Left | INTEGER | RW | 0 | WXG
Parent QFORM/QPANEL/QTABCONTROL W
WXG
Pixel 2D ARRAY of INTEGER RW
WXG
PopupMenu QPOPUPMENU W
W
ShowHint | INTEGER | RW | False | W
Tag INTEGER RW
WXG
Top | INTEGER | RW | 0 | WXG
Width INTEGER RW
WXG
Visible | INTEGER | RW | True | WXG

QChart Specific Properties
Field Type Description RW Default
AxisBorder
         BYTE
Draws border around plot
RW
True
ChartBorder
BYTE Draws border around entire chart RW True
Colors()
ARRAY of LONG
Array of predefined colors
RW
bgColor
LONG
Chart background color
RW
fgColor
LONG Chart foreground color RW
PlotAreaColor
LONG Color of plot area
RW
GridColor
LONG Color of gridlines
RW
BW
BYTE Plots in Black and White
RW False
GreyScale
BYTE Plots in GreyScale RW False
DoLegend
BYTE Draw a legend to right of chart
RW True
MarkerSize
SINGLE
Size of markers for XY and Line charts
RW 3
Viewport
INTEGER
Specifies Viewport width for Real Time Graphs
RW 100
ChartType
INTEGER
Sets type of Chart to plot
RW ctXY

ctBar, ctLine, ctXY, ctPie, ctHiLo, ctBox, ctBarLine, ctReal

ChartStyle
INTEGER Sets style of Chart Type to plot
RW csPoints

Bar           Line and XY      Pie        HiLo
==================================================
csBar          csPoints     csPisPct    csAntenna
csHisto        csLines      csPieVal    csHiLoBox
csStacked      csBoth
csPctStacked
Missing
DOUBLE
Value used to represent missing data
RW -9.999E-45
Data
2D ARRAY of DOUBLE
Data used in plotting all Charts EXCEPT XY
RW

Series   Values
(Col)    (Row)
  1      val 11
  1      val 12
  2      val 21
  2      val 22
XYData
3D ARRAY of DOUBLE Data used to plot XY Charts ONLY
RW

Series  NumPts Values
(Col)   (Row)  (dim 3)
  1       1       1 <-- X
  1       1       2 <-- Y
  1       2       1
  1       2       2
  2       1       1
  2       1       2
  2       2       1
  2       2       2
Cols
INTEGER
Number of series to plot
RW 1
Rows
INTEGER
Number of data values in each series
RW 1

To REDIM the .Data or .XYData array property:

You MUST set the .Cols and .Rows properties before calling QChart. These values are used throughout the QChart class as loop counters. Set .Cols to number of series to be plotted and set .Rows to number of values in each series. REDIM the array using .Cols and .Rows.

NOTE:  To REDIM you MUST EXPLICITLY REFERENCE your QChart instance by name (even inside a WITH block) or RapidQ will not find and REDIM the array.  (A RapidQuirk?!?)

WITH YourInstanceName
  .Cols = 2                                    <-- Num series
  .Rows = 2                                    <-- Num values
   REDIM YourInstanceName.XYData(.Cols, .Rows, 2) <-- XY Only
   REDIM YourInstanceName.Data(.Cols, .Rows)   <-- All Others
END WITH
MainFont
QFONT
Font used to draw the Main Title
RW Times
MainTitle.Text
STRING

RW ""
SubFont
QFONT Font used to draw the Sub Title RW Times
SubTitle.Text
STRING
RW ""
LegendFont
QFONT Font used to draw the Legend RW Times
LegendList
QSTRINGLIST Legend text items; usually one for each series
RW ""

Use the .AddItems Method to add text to the lists.
LegendList contains legend text and usually refers to the Cols
(i.e. Series)
AxisFont
QFONT Font used to draw the Axis Labels RW Times
LabelList
QSTRINGLIST Axis label text items; usually one for each category RW ""

Use the .AddItems Method to add text to the lists.
LabelList contains text used to label the X Axis and usually refers to Rows (i.e. Categories).  LabelList items are NOT USED by XY Charts
XTitle.Text
STRING
RW ""
YTitle.Text
STRING
RW ""
XAxis / YAxis
UDTs (Elements Below)
There is 1 UDT for the XAxis and 1 for the YAxis
RW
.AutoScale
BYTE
QChart scales the axes
RW True
.Color
LONG
Color of axis line
RW
.Div
INTEGER
Number of divisions on the axis
RW 10
.DrawZero
BYTE Draw a zero line if data spans origin
RW True
.ZeroColor
LONG
Color of Zero line
RW
.Grid
BYTE Draw gridlines for the axis
RW True
.Labeled
BYTE Label the axis at tic intervals
RW True
.LogScale
BYTE TRUE = Log Scale, FALSE = Linear Scale
RW False
.Min
DOUBLE
Data Minimum. Must be set if AutoScale = FALSE
RW
.Max
DOUBLE
Data Maximum. Must be set if AutoScale = FALSE RW
.Tics
BYTE Draw tic marks on the axis
RW True
.MnrTics
BYTE Draw minor tic marks on the axis RW True
Series()
UDT ARRAY (Elements Below)
Contains format inforamtion for each series plotted
RW
.AutoColor
BYTE
Cycle through 18 available colors
RW True
.AutoMark
BYTE Cycle through 8 available marker styles RW True
.Color
LONG
Color used in plotting the series
RW
.HatchStyle
LONG Hatch style used in plotting the series RW hsSolid
.LineStyle
LONG Line style used in plotting the series RW lsSolid
.LineWidth
LONG LineWidth used in plotting the series RW 1
.Marker
BYTE
Marker style used in plotting the series RW msFilledCircle

QChart Methods
Method Type Description Params
Initialize
SUB
Sets all values to default
0
ClearAll
         SUB
Clears drawing buffer and paints blank canvas
0
PaintChart
         SUB Draws Chart on Canvas. Assign this method to your OnPaint event 0
DrawChart
SUB (Overlay%) Draws the currently defined chart to screen
1
RedrawChart
SUB
Redraws chart at new size. Call from Resize event
0
CopyToClipboard
SUB (Wid%, Hgt%) Copies at specified width and height
2
SaveChart
SUB (SaveAs%) SaveAs = 0:No dialog if previously saved; 1:Always shows dialog
1
PrintChart
SUB (Prn%, Orient%, Margin%, Copies%, Color%) Uses CopyRect method to print chart. May not work with all printers
5

QChart Events (Inherited from QCanvas)
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on canvas | 0 | WXG
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WXG
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WXG
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WXG
OnPaint | VOID | Receives WM_PAINT message | 0 | WXG

QChart Example

$OPTIMIZE ON
$TYPECHECK ON
$INCLUDE "QChart.inc" '<--- change path to point to file on your system

'----- Form Event SUB Declarations
Declare Sub btnOnClick (SENDER As QBUTTON)
Declare Sub frmMainResize (SENDER As QFORM)
Declare Sub frmMainClose (SENDER As QFORM)

'----- Define the main form
Create frmMain As QFORM
  Center
  Width = 640
  Height = 480
  Caption = "QChart Example"
  OnResize = frmMainResize
  OnClose = frmMainClose
    Create drwBar1 As QBUTTON
      Caption = "Bar Graph"
      OnClick = btnOnClick
    End Create
    Create btnPie As QBUTTON
      Caption = "Pie Chart"
      Top = 25
      OnClick = btnOnClick
    End Create
    Create drwXYboth As QBUTTON
      Caption = "XY Both"
      Top = 50
      OnClick = btnOnClick
    End Create
    Create drwBox As QBUTTON
      Caption = "Box Plot"
      Top = 75
      OnClick = btnOnClick
    End Create
    Create drwHiLo1 As QBUTTON
      Caption = "HLC Style 1"
      Top = 100
      OnClick = btnOnClick
    End Create
    Create Graph As QCHART                        	'Create a copy of the new object
      Align = 4                                   	'alRight
      Width = frmMain.ClientWidth - btnPie.Width
      Height = frmMain.ClientHeight
      OnPaint = Graph.PaintChart                        'This line REQUIRED to process Repaints
    End Create'Graph
End Create'frmMain

Graph.ClearAll
frmMain.Showmodal

Sub btnOnClick (SENDER As QBUTTON)

  Dim i  As Integer                                     'Loop counters...
  Dim j  As Integer
  Dim k  As Single                                      'A Scratch Variable

  Select Case Sender.Caption
    Case "Bar Graph"
      With Graph
        .Initialize                                     'Set defaults
        .ChartType = ctBar                              'Bar Chart
        .ChartStyle = csBar                             'Grouped Bars
        .MainTitle.Text = "Bar Graph Example 1"         'change desired options
        .SubTitle.Text = "Standard Bar Graph"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Cols = 6                                       '<- Set Num Series
        .Rows = 3                                       '<- Set Num Groups
        REDIM Graph.Data(.Cols,.Rows)                   '<- REDIM the Data Array
        k = 75
        Randomize
        For j = 1 To .Rows                              'Do this outside data loop
          .LabelList.AddItems "Treatment " + Str$(j)    'to avoid duplication of entries
        Next j
        For i = 1 To .Cols        'Load the data
         .LegendList.AddItems "Grp " + Str$(i)
          For j = 1 To .Rows
             .Data(i,j) = Rnd * k
          Next j
        Next i
        .DrawChart (FALSE)                              'Draw it!
      End With

    Case "Pie Chart"
      With Graph
        .Initialize                                     'Always call this first
        .ChartType = ctPie
        .ChartStyle = csPiePct                          'Show % at wedges (csPieVal shows Values)
        .AxisFont.Size = 12
        .LegendFont.Size = 12
        .MainTitle.Text = "Pie Chart"
        .SubTitle.Text = "Click Again For New Data"
        .Cols = 1                                       'Only 1 col for pie data
        .Rows = 6                                       'Set Num data points
        REDIM Graph.Data(.Cols,.Rows)                   'Redim the Data Array
        k = 100                                         'Load the data
        Randomize
        For i = 1 To .Rows
          .Series(i).AutoColor = FALSE
          .Series(i).Color = .Colors(i + 12)
          .LegendList.AddItems "Group " + Str$(i)
          .Data(1,i) = Rnd * k ' * i
        Next
        .DrawChart(FALSE)                               'Always call this last
      End With

    Case "XY Both"
      With Graph
        .Initialize                                     'Set defaults
        .ChartType = ctXY                               'XY Scatter Chart
        .ChartStyle = csBoth                            'Lines and Points
        .MainTitle.Text = "Scatter Plot With Lines"     'change desired options
        .SubTitle.Text = "Double Width Lines"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .MarkerSize = .MarkerSize * 1.5
        .Cols = 3                                       'Number of series
        .Rows = 11                                      'Number of data points per series
        REDIM Graph.XYData(.Cols,.Rows,2)               'Redim XYData.  Note 3rd dim always 2
        k = 132                                         'Load the data
        Randomize
        For i = 1 To .Cols
          .LegendList.AddItems "Group " + Str$(i)
          .Series(i).LineWidth = 2
          For j = 1 To .Rows
            .XYData(i,j,1) = Str$(j)                    'X Values (3rd dim 1)
            .XYData(i,j,2) = Str$(Rnd * k)              'Y Values (3rd dim 2)
          Next j
        Next i
        .DrawChart (FALSE)                              'Draw it!
      End With

    Case "Box Plot"
      With Graph
        .Initialize                                     'Set defaults
        .ChartType = ctBox                              'Box and Whisker Plot
        .MainTitle.Text = "Box and Whisker Plot"        'change desired options
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = FALSE
        .DoLegend = FALSE
        .Cols = 6                                       'Number of series
        .Rows = 5                                       'Always 5 for Box Plots
        REDIM Graph.Data(.Cols,.Rows)                   'Redim the data array
        k = 20                                          'Load the data
        Randomize
        For i = 1 To .Cols                              'for each col
          .Series(i).AutoColor = FALSE
          .Series(i).Color = .Colors(2)
          .LabelList.AddItems "Group " + Str$(i)
          .Data(i , 1) = Str$(Rnd * k + 100)            'Max Values
          .Data(i , 2) = Str$(Rnd * k + 75)             'Q3 Values
          .Data(i , 3) = Str$(Rnd * k + 50)             'Q2 Values
          .Data(i , 4) = Str$(Rnd * k + 25)             'Q1 Values
          .Data(i , 5) = Str$(Rnd * k)                  'Min Values
        Next i
        .DrawChart (FALSE)                              'Draw it!
      End With

    Case "HLC Style 1"
      With Graph
        .Initialize                                     'Set defaults
        .ChartType = ctHiLo                             'Hi-Lo-Close Plot
        .ChartStyle = csAntenna
        .MainTitle.Text = "Hi-Lo-Close Plot"            'change desired options
        .SubTitle.Text = "Antenna Style"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = FALSE
        .Cols = 12                                      'Number of series
        .Rows = 3                                       'Always 3 for HiLo charts
        REDIM Graph.Data(.Cols,.Rows)                   'Redim the data array
        k = 10                                          'Load the data
        Randomize
        For i = 1 To .Cols                              'for each col
          .LabelList.AddItems "Group " + Str$(i)
          .Data(i , 1) = Rnd * k + 100                  'Hi Value
          .Data(i , 2) = Rnd * k + 75                   'Close Value
          .Data(i , 3) = Rnd * k + 50                   'Lo Value
        Next i
        .DrawChart (FALSE)                              'Draw it!
      End With
  End Select
End Sub
'-------------------------------------------------------------------------------------------
Sub frmMainResize (SENDER As QFORM)
  With Graph
    .Width = frmMain.ClientWidth - btnPie.Width       'Calculate new sizes
    .Height = frmMain.ClientHeight
    .RedrawChart                                       'Redraw the QChart Object
  End With
End Sub
'-------------------------------------------------------------------------------------------
Sub frmMainClose (SENDER As QFORM)
  Application.Terminate
End Sub
'-------------------------------------------------------------------------------------------


Appendix A: QCursor

Documentation component by D.Glodt (c)2003 Appendix A: QCursor

QCursor Component

QCursor is component used to load cursor from resource or file.
After loading , the cursors are using by set value(1 to n) to Cursor property of each component.

QCursor Properties
Field | Type | R/W | Défault
Count | INTEGER | R | 0
 | Number of cursor loaded by the component. |  |
Visible | BOOLEAN | R/W | True

QCursor Methods
Method | Type | Description | Params
LoadFromResource | SUB(Resource&) | Load cursor from resource, Resource parameter is the resource number(0 to n) | 1
LoadFromFile | SUB(FileName$) | Load cursor from file | 1
Move | SUB(X&,Y&) | Move cursor at position x, y of screen. | 2

QCursor Events
Event | Type | Occurs when... | Params

QCursor Example
$TypeCheck On
$include "Object/QCursor.inc"

$resource cur1 as "Pen.cur"
$resource cur2 as "Paint.cur"

dim curseur asQCursor
curseur.loadfromResource(0) 'loading cursor cur1
curseur.loadfromResource(1) 'loading cursor cur2
curseur.loadfromfile("M_Busy.ani") 'loading from file

CREATE Form ASQFORM
Center
caption=str$(curseur.count)
Cursor=2 'using cursor cur2
ShowModal
END CREATE


qcalendar.inc

'-------------------------------------------------------------------------------------------
'    QCalendar Control by Pasquale P.C.B.        4-2001
'    Dedicated to my beautiful wife Ana
'-------------------------------------------------------------------------------------------
$include "apidate.bas"
TYPE qcalendar EXTENDS Qpanel
    PUBLIC:
    M AS INTEGER
    Y AS INTEGER
    D AS INTEGER
    week1% AS INTEGER '------------------------------------------<<<<<<<<<<<<<<<<<<'
    PopupMenu AS QPopupMenu
    mesi(1 to 12) AS QmenuItem
    Today AS Qcoolbtn

    Grid AS QSTRINGGRID

    Panel1 AS QPANEL
        BTNprev AS QCOOLBTN
        btnnext AS QCOOLBTN
        bntupy AS QcooLBTN
        bntdowny AS QCOOLBTN
    Panel2 AS QPANEL
'-- ************************************************************************************'
    SUB LoadCal(datum$ as string)

        nowd$=field$(datum$,"-",2)

        qcalendar.d=val(nowd$)
        nowm$=field$(datum$,"-",1)
        qcalendar.m=val(nowm$)
        nowy$=field$(datum$,"-",3)
        qcalendar.y=val(nowy$)
        qcalendar.panel1.caption=qcalendar.mesi(val(nowm$)).caption
        qcalendar.panel1.caption=qcalendar.panel1.caption+" "+nowy$
        qcalendar.week1%=weekday(nowm$+"-"+"01"+"-"+nowy$)

        if qcalendar.week1%=1 then qcalendar.week1%=8
        dim v as integer

        if qcalendar.m=1 then
            lastd%=val(field$(lastdaym("12-1-"+str$(qcalendar.y-1)),"-",2))
        else
            lastd%=val(field$(lastdaym(str$(qcalendar.m-1)+"-1-"+str$(qcalendar.y)),"-",2))
        end if
        v=0

        for i=qcalendar.week1%-2 to 0 step -1
            qcalendar.grid.cell(i,1)=str$(lastd%-v)

            v++
        next

        lb%=val(field$(lastdaym(datum$),"-",2))
        ri=1:co=0
        if qcalendar.week1%=8 then
            ri=2:co=0
        else
            co=qcalendar.week1%-1
        end if
        i=0

        do
            for c=co to 6
                i++
                qcalendar.grid.cell(c,ri)=str$(i)
                if i=lb% then exit do
            next
            ri++
            co=0
        loop until i=lb%

        i=1
        if c=6 then
            ri++:co=0
        else
            co=c+1
        end if
        do

            for c=co to 6
                qcalendar.grid.cell(c,ri)=str$(i)
                i++
            next

            co=0:ri++
        loop until ri=8

        ri=int((val(nowd$)+qcalendar.week1%-2)/7)+1

        co=weekday(nowm$+"-"+nowd$+"-"+nowy$)-2     '!!!    1  cause error !!!

        qcalendar.grid.row=ri:
        qcalendar.grid.col=co

    END SUB
'-- ************************************************************************************'
    SUB mnuclick(s as QmenuItem)
      qcalendar.loadcal(str$(s.menuindex+1)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y))
    END SUB
'-- ************************************************************************************'
    SUB INIT(inidatum$)
        Dim pBuffer As String , ST As SYSTEMTIME
        if inidatum$<>"" then
            st.wYear=val(field$(inidatum$,"-",3))
            st.wmonth=val(field$(inidatum$,"-",1))
            st.wDay =val(field$(inidatum$,"-",2))
            pbuffer="Init"
            pBuffer = String$(255, 0)
            r=GetDateFormat( ByVal 0&, 0, st, "ddd", Varptr(pBuffer), Len(pBuffer))
            pBuffer = Left$(pBuffer, InStr(1, pBuffer, Chr$(0)) - 1)
            if len(pbuffer)=0 then
                 showmessage inidatum$+" it's not valid. Format must be 'MM-DD-YYYYY' ie. '04-23-2001' and the date must be exist"
                 qcalendar.visible=0
                 exit sub
            end if
        end if
        dim b as string
        b=string$(4,0)
        getlocaleinfo(ByVal 0&, 5  ,varptr(b),len(b))
        dim todayC as string
        select case val(b)
            case 386
                todayC="Danes"
            case 39
                todayC="Oggi"
            case 33
                todayC="Aujourd'hui"
            case 55,52,34
                todayC="Hoy"
            case 49
                todayC="Heute"
            case else
                todayC="Today"
        end select
        for i = 1 to 12
             b=string$(10,0)
             getlocaleinfo(ByVal 0&, i+55,varptr(b),len(b))
             qcalendar.mesi(i).OnClick=qcalendar.mnuClick
             qcalendar.mesi(i).Caption = b
             qcalendar.PopupMenu.AddItems qcalendar.mesi(i)
        next
        qcalendar.panel1.popupmenu=qcalendar.popupmenu
        dim week(1 to 7)as string
        for i=1 to 7
            b=string$(3,0)
            getlocaleinfo(ByVal 0&, i+48  ,varptr(b),len(b))
            week(i)=b
        next
        for i=1 to qcalendar.grid.colcount+1
            qcalendar.grid.cell(i-1,0)=week(i)
        next
        ST.wDay = val(field$(date$,"-",2))
        ST.wMonth = val(field$(date$,"-",1))
        ST.wYear = val(field$(date$,"-",3))
        b=string$(15,0)
        getlocaleinfo(ByVal 0&, &H20,varptr(b),len(b))
        pBuffer = String$(255, 0)
        GetDateFormat( ByVal 0&, 0, ST, b, Varptr(pBuffer), Len(pBuffer))
        pBuffer = Left$(pBuffer, InStr(1, pBuffer, Chr$(0)) - 1)
        qcalendar.today.caption=todayC+": "+pbuffer
        qcalendar.grid.deloptions 4
        if inidatum$="" then
            qcalendar.loadcal(date$)
        else
            qcalendar.loadcal(inidatum$)
        end if
    END SUB

'-- ************************************************************************************'
    EVENT grid.onselectcell (Col%, Row%, CanSelect%,s as qstringgrid)
       qcalendar.d=val(s.cell(col%,row%))
       if row%=1 then
           if col%<qcalendar.week1%-1 then
               canselect%=0
               exit sub
           end if
       end if
       if row%>4 then
            if val(s.cell(col%,row%))<22 then
                canselect%=0
                exit sub
            end if
       end if
       Dim pBuffer As String, ST As SYSTEMTIME
       ST.wDay =qcalendar.d
       ST.wMonth = qcalendar.m
       ST.wYear = qcalendar.y
       dim b as string
       b=string$(15,0)
       getlocaleinfo(ByVal 0&, &H20,varptr(b),len(b))
       pBuffer = String$(255, 0)
       GetDateFormat( ByVal 0&, 0, ST, b, Varptr(pBuffer), Len(pBuffer))
       pBuffer = Left$(pBuffer, InStr(1, pBuffer, Chr$(0)) - 1)
       qcalendar.panel2.caption=pBuffer
    END EVENT
'-- ************************************************************************************'
    EVENT bntupy.onclick
        qcalendar.y=qcalendar.y+1
        if val(field$(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)),"-",2))<qcalendar.d then
            qcalendar.loadcal(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)))
        else
            qcalendar.loadcal(str$(qcalendar.m)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y))
        end if
    END EVENT
'-- ************************************************************************************'
    EVENT  btnnext.onclick(s as qcoolbtn)
        if qcalendar.m=12 then
            qcalendar.m=1:qcalendar.y=qcalendar.y+1
        else
            qcalendar.m=qcalendar.m+1
        end if
        if val(field$(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)),"-",2))<qcalendar.d then
            qcalendar.loadcal(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)))
        else
            qcalendar.loadcal(str$(qcalendar.m)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y))
        end if
    END EVENT
'-- ************************************************************************************'
    EVENT bntdowny.onclick
        if qcalendar.y>1753 then
            qcalendar.y=qcalendar.y-1
        else
            exit sub
        end if
        if val(field$(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)),"-",2))<qcalendar.d then
            qcalendar.loadcal(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)))
            exit sub
        else
            qcalendar.loadcal(str$(qcalendar.m)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y))
        end if
    END EVENT
'-- ************************************************************************************'
    EVENT btnprev.onclick(s as qcoolbtn)
        if qcalendar.m=1 then
            if qcalendar.y=1753 then exit sub
            qcalendar.m=12:qcalendar.y=qcalendar.y-1
        else
            qcalendar.m=qcalendar.m-1
        end if
        if val(field$(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)),"-",2))<qcalendar.d then
            qcalendar.loadcal(lastdaym(str$(qcalendar.m)+"-01-"+str$(qcalendar.y)))
            exit sub
        else
            qcalendar.loadcal(str$(qcalendar.m)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y))
        end if
    END EVENT
'-- ************************************************************************************'
    EVENT Today.onclick(s as qcoolbtn)
        qcalendar.loadcal(date$)
    END EVENT
'-- ************************************************************************************'
    EVENT grid.onDrawcell (Col% AS LONG, Row% AS LONG, State AS LONG, R AS QRECT, S AS QSTRINGGRID)
        w=((s.colwidths(col%)-s.textwidth(s.cell(col%,row%)))\2)-1
        s.fillrect(r.left,r.top,r.right,r.bottom,-2147483643)
        if row%=1 then
            if col%<qcalendar.week1%-1 then
                s.textout(r.left+w,r.top+1,s.cell(col%,row%),-2147483631,-1)
                exit sub
            end if
        end if
        if row%>4 then
            if val(s.cell(col%,row%))<22 then
                s.textout(r.left+w,r.top+1,s.cell(col%,row%),-2147483631,-1)
                exit sub
            end if
        end if
        if state=1 then
            s.circle(r.left,r.top,r.right,r.bottom,9437183,9437183)
        end if
        if format$("%.2d-%.2d-%d",qcalendar.m,val(s.cell(col%,row%)),qcalendar.y)=date$ then
            s.circle(r.left,r.top,r.right,r.bottom,8716543,-1)
            s.circle(r.left+1,r.top+1,r.right-1,r.bottom-1,8716543,-1)
        end if
        if col%=6 then
            s.textout(r.left+w,r.top+1,s.cell(col%,row%),5732096,-1)
        else
            s.textout(r.left+w,r.top+1,s.cell(col%,row%),-2147483640,-1)
        end if
    END EVENT
'-- ************************************************************************************'
    FUNCTION QDate$ as string
       result=str$(qcalendar.m)+"-"+str$(qcalendar.d)+"-"+str$(qcalendar.y)
    END FUNCTION
'-- ************************************************************************************'
    CONSTRUCTOR
        Caption = "Calendar"
        Width = 179
        Height = 183
        BevelInner = 1
        'BevelOuter = 1
            panel2.parent=qcalendar
            panel2.Left = 0
            panel2.Top = 146
            panel2.Caption = "QCalendar by P.C.B."
            panel2.Width = 173
            panel2.Height = 25
            panel2.BevelInner = 1
            'BevelOuter = 1
            panel2.Align = 1
            panel2.TabOrder = 2
                bntdowny.parent=qcalendar.panel1
                'BMP = "C:\RapidQ\cdx.bmp"
                bntdowny.caption="6"
                bntdowny.font.name="Webdings"
                bntdowny.Left = 25
                bntdowny.Top = 1
                bntdowny.Width = 15
                bntdowny.Height = 21
                bntdowny.Flat = 1
                bntdowny.font.color=-2147483639
                bntdowny.Align = 3
               'BMP = "C:\RapidQ\cdx.bmp"
                bntupy.parent=qcalendar.panel1
                bntupy.caption="5"
                bntupy.font.name="Webdings"
                bntupy.Left = 100
                bntupy.Top = 1
                bntupy.Width = 15
                bntupy.Height = 13
                bntupy.Flat = 1
                bntupy.font.color=-2147483639
                bntupy.Align = 4
                btnnext.parent=qcalendar.panel1
                'BMP = "C:\RapidQ\cdx.bmp"
                btnnext.caption="è"
                btnnext.font.name="Wingdings"
                btnnext.Left = 148
                btnnext.Top = 1
                btnnext.Width = 23
                btnnext.Height = 21
                btnnext.Flat = 1
                btnnext.font.color=-2147483639
                btnnext.Align = 4
                'btnnext.onclick=btnnextc
                BTNprev.parent=qcalendar.panel1
                'BMP = "C:\RapidQ\csx.bmp"
                BTNprev.caption="ç"
                BTNprev.font.name="Wingdings"
                BTNprev.Left = 2
                BTNprev.Top = 1
                BTNprev.Width = 23
                BTNprev.Height = 21
                BTNprev.Flat = 1
                btnprev.font.color=-2147483639
                BTNprev.Align = 3
                'BTNprev.onclick=btnprevc
            Panel1.parent=qcalendar
            Panel1.Left = 0
            Panel1.Top = 0
            Panel1.Caption = "Panel1"
            Panel1.Width = 173
            Panel1.Height = 29
            Panel1.bevelinner=1
            Panel1.Align = 1
            Panel1.TabOrder = 1
            Panel1.font.addstyles 0
            Panel1.color=-2147483646
            Panel1.font.color=-2147483639
            grid.parent=qcalendar
            grid.borderstyle=0
            grid.Left = 0
            grid.Top = 25
            grid.Height = 106
            grid.Width = 173
            grid.Align = 1
            grid.ScrollBars = 0
            grid.GridLineWidth = 0
            grid.ColCount =7'' 8 '-- was 7 - and error occures
            grid.RowCount =7'' 8 '-- was 7 - and error occures
            grid.Col = 0
            grid.DefaultColWidth = 25
            grid.DefaultRowHeight = 15
            grid.FixedCols = 0
            Today.parent=qcalendar
            Today.Caption = "Today"
            Today.Left = 0
            Today.Top = 110
            Today.flat=1
            Today.Width = 173
            Today.Align = 1
            Today.height=18
            Today.font.addstyles=0
    END CONSTRUCTOR
END TYPE


Appendix A: QDIGDISPLAY

Rapid-Q Documentation by Peter Molloy (c) 2001

Appendix A: QDIGDISPLAY

QDIGDISPLAY Component

QDigDisplay simulates a seven segment LED display.

QDigDisplay Properties

Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
 | Align determines how the control aligns within its parent control.
ClientHeight | INTEGER | RW |  | W
ClientWidth | INTEGER | RW |  | W
Color | INTEGER | RW |  | WXG
CopyMode | INTEGER | RW | cmBlackness | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WXG
Font | QFONT | W |  | W
Height | INTEGER | RW | 24 | WXG
Hint | STRING | RW |  | W
Left | INTEGER | RW | 0 | WXG
Parent | QFORM/QPANEL/QTABCONTROL | W |  | WXG
Pixel | 2D ARRAY of INTEGER | RW |  | WXG
PopupMenu | QPOPUPMENU | W |  | W
ShowHint | INTEGER | RW | False | W
Tag | INTEGER | RW |  | WXG
Top | INTEGER | RW | 0 | WXG
Width | INTEGER | RW | 12 | WXG
Visible | INTEGER | RW | True | WXG
Display | STRING | RW | “0” | W

QDigDisplay Events

Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on canvas | 0 | WXG
OnDblClick | VOID | User double clicked on canvas | 0 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | WXG
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | WXG
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | WXG
OnPaint | VOID | Receives WM_PAINT message | 0 | WXG

QDigDisplay Example

'  Count from 0 to 100

$INCLUDE “RAPIDQ.INC”
$INCLUDE “QDIGDISPLAY.INC”

DECLARE SUB CountLoop

CREATE Form AS QFORM
CREATE Button AS QBUTTON
        Left = 100
        Top = 120
        Caption = “Start Count”
        OnClick = CountLoop
END CREATE
CREATE Counter AS QDIGDISPLAY
        Left = 20
        Top = 80
        Display = “000”
END CREATE
END CREATE
Form.ShowModal

SUB CountLoop
FOR Loop1 = 0 TO 100
        Counter.Display = RIGHT$ (“000”+ STR$(Loop1),3)
        Form.Repaint
        SLEEP 1
NEXT
END SUB


QDir

Documentation component QDIR By Jacques Philippe Beta Version 0.0.3 October 28th, 2002

Version 1.0.0 available
-------------
Not BETA anymore ???
- the proprety .WithDotsDirs did not work under .DIR
- add .WithDotsDirs in documentation

 Appendix A: QDIR

QDIR Component

QDIR is a analog of "DOS" DIR and DIR /S command

QDIR Internal Types See File Times for addition information

Type QDIR_FILETIME
lowDateTime As Long
highDateTime As Long
End Type

Type QDIR_WIN32_FIND_DATA ' WIN32 NAMES
attributes As Long ' dwFileAttributes As Long
' RAPIDQ BUGS WITH NESTED TYPES so REPLACED BY ! No Differences
' ftCreationTime As FILETIME
creationLowDateTime As Long ' ftCreationTime.dwLowDateTime As Long
creationHighDateTime As Long ' ftCreationTime.dwHighDateTime As Long

' ftLastAccessTime As FILETIME
lastAccessLowDateTime As Long ' ftLastAccessTime.dwLowDateTime As Long
lastAccessHighDateTime As Long ' ftLastAccessTime.dwHighDateTime As Long

' ftLastWriteTime As FILETIME
lastWriteLowDateTime As Long ' ftLastWriteTime.dwLowDateTime As Long
lastWriteHighDateTime As Long ' ftLastWriteTime.dwHighDateTime As Long

fileSizeHigh As Long ' nFileSizeHigh As Long
fileSizeLow As Long ' nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * 260
cAlternate As String * 14
End Type

Type QDIR_SYSTEMTIME ' VB integer = RQ Short
year As Short ' the year as a number
month As Short 'the month as a number
dayOfWeek As Short ' number of the day of the week SUNDAY = 0, MONDAY = 1, ...
day As Short 'day in the month 1, 2, 3,... 12, 13, 14, ... 28/30/31
hour As Short 'the hour as a number
minute As Short 'the minute as a number
second As Short 'the second as a number
milliseconds As Short 'the milliseconds as a number
' Extended
DateTime As Double ' The DateTime As A Number
date As String * 10 ' Date as a String mm/dd/yyyy
dateEU As String * 10 ' EU date Foramt dd/mm/yyyy
dateAlpha As String * 16 ' "ddd" "mmm" DD, yyyy
dateAlphaEU As String * 15 ' "ddd" DD "mmm" yyyy
time As String * 8 ' without ms HH:MM:SS
timems As String * 12 ' Time As a String HH:MM:SS.iii
strDayOfWeek As String * 3 ' day of the week as in Day(0 To 6) : "Mon", "Tue", "Wed", ... "Sun"
nWeekDay As String * 1 ' "0", "1", "2", ... "6"
strMonthOfYear As String * 3 ' day of the week as in Months(1 To 12) : "Jan", "Feb", ... "Dec"
End Type

QDIR Properties
Field | Type | R/W | Défault
Find Files Parameters
fileName | string | R/W
the name of the founded file
dosFileName | string | R/W
dos the name of the founded file
path | String | R/W | applicationPath = Command$(0) - Application.exeName
Absolute path to the file ie : C:\myDir\otherDir\
pathFileName | string | R/W
Absolute path + the fileName ie : c:\Windows\system.dat
size | Double | R/W
the size as a double (use StrF$(size, ffFixed, 18, 0) to exp (ffNumber to have thousands separators)
Date and Time Variable
creation | as QDIR_SYSTEMTIME
the Type contaning informations about the creationTime
lastAccess | as QDIR_SYSTEMTIME
the Type contaning informations about the lastAccessTime
lastWrite | as QDIR_SYSTEMTIME
the Type contaning informations about the lastWriteTime
File Times

The File Time Properties decribed below for lastwriteTime may be found here for all three File Times : ie
- QDir.Creation.dateAlphaEU
- QDir.lastAccess.dateEU and even
- QDir.lastWrite.timems (which is equal to QDir.timems)

These three time TYPES give access to 3 x 18 porpeties (=54), not used every day :)

To compare dates and times, use dateTime. The dateTimes are DOUBLE precision numbers
(64 bit Integer, converted here in DOUBLE) holding a date and time associated with
a file. That DOUBLE specifies the number of 100-nanosecond intervals which have
passed since January 1, 1601 (10,000,000 for each elapsed second since then).
dateTime | Double
the lastWriteTime of the file as a double
time | String
the lastwriteTime of the file, format HH:MM:SS
timems | String
the lastWriteTime of the file + milliseconds, format HH:MM:SS,mmm
date | String
the lastWriteTime date, format MM/DD/YYYY
dateEU | String
the lastWriteTime date, EU foramt DD/MM/YYYY
dateAlpha | String
the lastWriteTime in alphanumeric format "mon dec 24 2001"
dateAlphaEU | string
the lastWriteTime in alphanumeric EU format "mon 24 dec 2001"
strDayOfWeek | string
the lastWriteTime Day Of The Week : "Mon", "Tue", "Wed", Thu" ...
strMonthOfYear | String
the lastWriteTime Month Of The Year : "Jan", "Feb", "Mar", "Apr", ...
Attibutes
attributes | Long
the attributes af the file (sum of attributes)
attributesAsString | String
the attributes transformed in a string "ADHNRSTC0" If Instr(myDir.AttributesAsString, "A") Then ....
Text Month, WeekDay
days(0 To 6)
As String days(0) = "Sunday" '"Dim" ' May Be Changed days(0 To 6)
days(1) = "Monday" '"Lun"
days(2) = "Tuesday" '"Mar"
days(3) = "Wednesday" '"Mer"
days(4) = "Thursday" '"Jeu"
days(5) = "Friday" '"Ven"
days(6) = "Saturday" '"Sam"
the 7 names of the strDayOfWeek. Source for AlphaNumeric dates
months(1 To 12)
As String months(1) = "January" ' May be Changed months(1 To 12)
months(2) = "February"
months(3) = "March"
months(4) = "April"
months(5) = "May"
months(6) = "June"
months(7) = "July"
months(8) = "August"
months(9) = "September"
months(10) = "October"
months(11) = "November"
months(12) = "December"
the 12 names of strMonthOfYear. Source for AlphaNumeric dates

QDIR Methods
Method | Description
Function Close As Long | CLOSE FIND
Function GetFirstFile (sPathFilter As String) As String | FIND FIRST FILE
Function GetNextFile As String | FIND NEXT FILE
Sub Dir (sPathFilter As String, sRejectedAttributes As String, sMustAttributes As string) | File Search without Scanning The Sub Directories
Sub Dirs (sPathFilter As String, sRejectedAttributes As String, sMustAttributes As String) File Search with Scanning the Sub Directories
Dirs chosen to remember the Command Dir /s
Note!
Dir and Dirs will only return when ALL the directory job has been done.
There is no DoEvents in QDir.
- Once a QDir.Dir or QDir.Dirs is Started, a busy flag forbids to start another occurence of QDir.Dir or QDir.Dirs, until the first job is
finished. To start more than one QDir.Dir or QDir.Dirs simultneously, you must DECLARE (DIM) two or more Variables As QDIR.
Functioni ChangeFileDateAndTime ( ... ) As Long ChangeFileDateAndTime (pathFileName$, Year%, month%, day%, hour%, minute%, second%, optionWhichTimes$)
Return 0 (False) on Failure or 1 (True) on success
EXAMPLES :
- ChangeFileDateAndTime ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33) ' the LastWriteTime Of MyFile is set to June 21 st 1983 at 17:22:23

- ChangeFileDateAndTime("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33, "Access") ' the LastAccessTime Of myFile is set to June 21 st 1983 at 17:22:23

- ChangeFileDateAndTime("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33, "ACCESS Write CREATION")
' the LastAccessTime, CreationTime and LastWriteTime Of myFile are set to June 21 st 1983 at 17:22:23

Used in the Event OnFileFound with Qdir.pathFilename can change the Date and Time of all matching files.
A File is Stored on Disk with Three Different Dates and Times Named :
- the creationTime
- the lastAccesstime
- the lastWriteTime (the one mostly mostly used shown)

Six NUMERIC Parameters **MUST** be Passed to the Functioni :
- the First is the YEAR of the new Date Time For the File
- the Second is the MONTH of the new Date Time For the File
- the Third is the DAY of the new Date Time For the File
- the Fourth is the HOUR of the new Date Time For the File
- the Fifth is the MINUTE of the new Date Time For the File
- the Sixth is the SECOND of the new Date Time For the File

The FILENAME With or Without a Path must be Passed as a STRING !

The optionWhichTimes Parameter is a STRING that Indicates to the Functioni
which file Times must be Changed. If that String contains :
- "CREATION" the creationTime will be Changed ("CRE" is enough)
- "ACCESS" the lastAccessTime will be changed ("ACC" is enough)
- "WRITE" the lastWriteTime will be changed ("WRI" is enough)
Not case sensitive
If that string is not Passed or is Empty, the lastWriteTime only will
be changed

ERROR : on error a ShowMessage is POPED UP and the Functioni Returns 0 (False
Function ChangeFileAttributes (sPathFileName As string, attributesAsString As String) As Long
- attributes are passed as a String, elements of that string are :
"A" for Archive
"D" for Directory
"H" for Hidden
"N" for Normal
"R" for Read Only
"S" for System
"T" for Temporary
"C" for Compressed
"0" for No Attribute Set (?=N?)

EXAMPLE :
-------
ChangeFileAttributes ("c:\myDir\myFile","AR")
the attributes of myFile are set to Archive and ReadOnly

The function returns 1 (True) if attributes have been changed and 0 if
an error has occured.

Used in the Event OnFileFound with Qdir.pathFilename can change the
attributes of all matching files.
Parameters description

sPathFilter - Path + FileMask, i.e "C:/Rapid-Q/*" or "c:\\Windows\\*.txt".
  • Path may be relative or absolute ie : dir2\myfile.Ext or c:\dir1\dir2\myfile.Ext.
  • relative path is relative to APPLICATION directory (where the .EXE is)
  • filter may be any kind of filter using wild card "*.Txt", "*name.Txt"

sRejectedAttributes - in rejectedAttributes$, if more than one attribute is rejected, all file having one of these rejected attributes set is rejected from the search.

sMustAttributes - in mustAttributes$, if more than one attibute is present, to be accepted a file must have all these attributes set. ie : no file can match "0A"
rejectedAttribites and mustAttributes maybe any of these letters in ANY order "ADHNRSTC0"
- attributes are passed as a String, elements of that string are :
"A" for Archive
"D" for Directory
"H" for Hidden
"N" for Normal
"R" for Read Only
"S" for System
"T" for Temporary
"C" for Compressed
"0" for No Attribute Set (?=N?)
- You can use multiple attributes in any order ie : "HTCA"
- an unknown attribute letter will be ignored.
- attributes are not case sensitive

sPathFileName -- Path , i.e "C:/Rapid-Q/" or "c:\\Windows\\".

  • Path may be relative or absolute ie : dir2\ or c:\dir1\dir2\
  • relative path is relative to APPLICATION directory (where the .EXE is)

attributesAsString - the attributes transformed in a string "ADHNRSTC0" If Instr(myDir.AttributesAsString, "A") Then ....

QDIR Events
Event | Type | Occurs when... | Params
OnFileFound | Sub OnFileFound | OnFileFound = 0

QDIR Examples

$INCLUDE "QDir.Inc"

Declare Sub ShowFileParamsShortList
Declare Sub ShowFileParamsLongList
Declare Sub ChangeAttributes

$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

'-------------- SHORT DOC valid for ALL 4 Examples -------------
'
' path : relative to the Application Directory and absolute path are accepted
' directory separator maybe "\" or "/"
' filter : accept Wild Cards like "dir/*.ba?" ...
'
' rejectedAttribites and mustAttributes maybe any of these letters in ANY
' order "ADHNRSTC0"
' ----------------------------------------------------------------------------------

Dim myFile As QFileStream
Dim myDir As QDir
DefInt iCount

 '---------------------------------------------------------------------------------
' EXAMPLE 1 SIMPLE DIR with Event myDir.OnFileFound
' ---------------------------------------------------------------------------------
    myFile.Open ("dirOut.txt", fmCreate)
        myDir.OnFileFound = ShowFileParamsLongList
        myDir.Dir ("C:/Rapid-Q/*", "D", "A")
        ' all files with archive attribute set in this directory
' Directories not listed
' Attributes : "ADHNRSTC0"
    myFile.Close
    Print "path    = ";myDir.path
    Print "EXAMPLE 1          FINISHED"

' ---------------------------------------------------------------------------------
' EXAMPLE 2 RECURSIVE DIR SEARCH with Event myDir.OnFileFound
' ---------------------------------------------------------------------------------
    iCount = 0
    myFile.Open ("dirOut.txt", fmCreate)
        myDir.OnFileFound = ShowFileParamsShortList
        myDir.Dirs ("c:\\Windows\\*.txt", "D", "")
        ' all files with extention ".txt" in directory Windowsand sub directories
' Directories not listed
' Attributes : "ADHNRSTC0"
    myFile.Close
    Print "path    = ";myDir.path
    Print "EXAMPLE 2          FINISHED"
' ---------------------------------------------------------------------------------

' ---------------------------------------------------------------------------------
' EXAMPLE_3
' ---------------------------------------------------------------------------------
' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' !!!!!!!! WARNING : This will change Selected Files dates !!!!!!!!!
' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' To test this, create a directory c:/tmp/ and copy any file in it
    myFile.Open ("dirOut.txt", fmCreate)
        myDir.OnFileFound = ChangeAttributes
        myDir.Dir ("c:/tmp/*", "D", "")
        myDir.OnFileFound = ShowFileParamsLongList
        myDir.Dir ("c:/tmp/*", "D", "")
    myFile.Close
    Print "path    = ";myDir.path
    Print "EXAMPLE 3          FINISHED"
' ---------------------------------------------------------------------------------

' Redate files to Sat Jan 01/02/1982 01:02:03
' and set the archive, readonly and compressed attributes

'****************************************************************************
Sub ChangeAttributes
        myDir.ChangeFileDateAndTime (myDir.pathFilename, 1982, 1, 2, 1, 2, 3, "cre acc wri")
        myDir.ChangeFileAttributes (myDir.pathFileName, "ARC")
End Sub

 'Print Routines
'****************************************************************************
Sub ShowFileParamsShortList
     DefStr sLine
    sLine = Space$(9)
    With myDir
        sLine = Replace$ (sLine, .AttributesAsString, 1)
        sLine = sLine &  .pathFileName & "  " & StrF$(.Size,ffFixed, 18, 0)
        Print sline
        myFile.WriteLine (sLine)
    End With
End Sub

'****************************************************************************
Sub ShowFileParamsLongList
    DefStr sLine
    With myDir
 sLine = ""
 sLine =         "\n       FileName = " & .fileName
 sLine = sLine & "\n        DosName = " & .dosFileName
 sLine = sLine & "\n         path\\ = " & .path
 sLine = sLine & "\n path\\fileName = " & .pathFileName
 sLine = sLine & "\n           Size = " & Strf$(.Size, ffFixed, 18, 0)
 sLine = sLine & "\n      Attributs = " & Str$(.Attributes)
 sLine = sLine & "\n  Attr_AsString = " & .AttributesAsString
 sLine = sLine & "\n   CreationTime = " & Strf$(.creation.DateTime, ffFixed, 18, 0)
 sLine = sLine & "\n             or = " & .creation.strDayOfWeek & " " & .creation.strMonthOfYear & " " & .creation.date _
                                                        & " " & .creation.time & " WeekDay#=" & .creation.nWeekDay
 sLine = sLine & "\n LastAccessTime = " & Strf$(.lastAccess.DateTime, ffFixed, 18, 0)
 sLine = sLine & "\n        or = " & .lastAccess.strDayOfWeek & " " & .lastAccess.strMonthOfYear & " " & .lastAccess.date _
                                                        & " " & .lastAccess.time & " WeekDay#=" & .lastAccess.nWeekDay

 sLine = sLine & "\n     LastWriteTime = " & Strf$(.DateTime, ffFixed, 18, 0)
 sLine = sLine & "\n                or = " & .strDayOfWeek & " " & .strMonthOfYear & " " & .date _
                                               & " " & .time & " WeekDay#=" & .lastWrite.nWeekDay
 sLine = sLine & "\n              Time = " & .Time
 sLine = sLine & "\n              Date = " & .date
 sLine = sLine & "\n            DateEU = " & .dateEU
 sLine = sLine & "\n         DateAlpha = " & .dateAlpha
 sLine = sLine & "\n       DateAlphaEU = " & .dateAlphaEU
 Print sline
 myFile.WriteLine (sLine)
    End With
End sub
' ---------------------------------------------------------------------------------
' EXIT CONSOLE


Appendix A: QDrawFocus

Documentation component by D.Glodt (c)2000-2001 Appendix A: QDrawFocus

QDrawFocus Component

QDrawFocus is a focus to use as selection in graphic components.

QDrawFocus Properties
Field | Type | R/W | Défault
Left | SHORT | R |
 | Position x of focus when it is visible |  |
Top | SHORT | R |
 | Position y of focus when it is visible |  |
Width | SHORT | R |
 | Width of focus when it is visible |  |
Height | SHORT | R |
 | Height of focus when it is visible |  |
Move | BOOLEAN | R | FALSE
 | At true if focus has moved. |  |
Visible | BOOLEAN | RW | FALSE
 | At true if focus is visible |  |
Inside | BOOLEAN | R | FALSE
 | At true if cursor is inside the focus |  |
NoResize | BOOLEAN | RW | FALSE
 | No resize when the value is true |  |
ShowCursor | BOOLEAN | RW | TRUE
 | Change the cursor state following the actions on focus |  |

QDrawFocus Methods
Method | Type | Description | Params
Remove | SUB(handle&) | Remove the focus | 1
Start | SUB(handle&,x%,y%) | Start the drawing of focus | 3
Draw | SUB(handle&,x%,y%,flagDraw%) | Draw the focus | 4
Stop | SUB(handle&,flagRemove%) | Stop the drawing of focus | 2

QDrawFocus Events
Event | Type | Occurs when... | Params

QDrawFocus Examples
'==============================================================================================
' the Start method gives the starting point of focus
' the Draw method draws the focus , moves it or the resize if this one is already visible and if flagDraw is at true,
' if flagDraw is at false only the state of the cursor changes
' the Stop method gives the cursor at its state of origin after action on the focus and removes the focus if the flagRemove is at true.
'===============================================================================================
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QDrawFocus.inc"

declare sub StartFocus(button as short,x as short,y as short)
declare sub StopFocus(x as short,y as short)
declare sub DrawFocus(x as short,y as short)
declare sub paint
declare sub resize
dim focus as QDrawFocus
dim flag as byte

CREATE Form AS QFORM
Caption = "Form1"
Width = 686
Height = 452
Center
OnResize=resize
CREATE Canvas1 AS QCANVAS
Left = 0
Top = 0
Width = 678
Height = 425
OnPaint=paint
OnMouseDown=StartFocus
OnMouseUp=StopFocus
OnMouseMove=DrawFocus
END CREATE
END CREATE

Form.ShowModal

Sub StartFocus(button as short,x as short,y as short)
focus.start(Canvas1.handle,x,y)
flag=true
End Sub

Sub DrawFocus(x as short,y as short)
focus.draw(Canvas1.handle,x,y,flag)
End Sub

Sub StopFocus(x as short,y as short)
focus.stop(Canvas1.handle,false)
flag=false
End Sub

Sub paint
if focus.visible then
focus.visible=false
Canvas1.fillrect(0,0,1000,1000,&HFFFFFF)
focus.start(Canvas1.handle,focus.left,focus.top)
focus.draw(Canvas1.handle,focus.left+focus.width,focus.top+focus.height,true)
else
Canvas1.fillrect(0,0,1000,1000,&HFFFFFF)
end if
end sub

sub resize
canvas1.repaint
end sub


Appendix A: QDrawMenu

Documentation component by D.Glodt (c)2001-2003 Appendix A: QDrawMenu

QDrawMenu Component

QDrawMenu is used to draw bitmap in an item of menu.

QDrawMenu Properties
Field | Type | R/W | Défault

QDrawMenu Methods
Method | Type | Description | Params
AddBitmap | SUB(SubMenu as QMenuItem,Item as QMenuItem,Picture as Qbitmap,Button as boolean,Backcolor as long) | Add a bitmap to item menu | 5
 | The Button parameter determines if it is necessary to reveal a button has the selection, the Backcolor parameter determines the color of transparency of the bitmap |  |
DelBitmap | SUB(SubMenu as QMenuItem,Item as QMenuItem) | Delete a bitmap from item menu | 2
MenuProc | SUB(hwnd&,uMsg&,wParam&,lParam&) | Procédure de menu | 4
 | This méthod must be set to event WndProc from QForm component |  |

QDrawMenu Events
Event | Type | Occurs when... | Params

QDrawMenu Examples

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$INCLUDE "Object\QDrawMenu.INC"
$RESOURCE New_bmp as "New.bmp"
$RESOURCE Open_bmp as "Open.bmp"
$RESOURCE Save_bmp as "Save.bmp"
$RESOURCE Exit_bmp as "Exit.bmp"
$RESOURCE Cut_bmp as "Cut.bmp"
$RESOURCE Copy_bmp as "Copy.bmp"
$RESOURCE Paste_bmp as "Paste.bmp"
$RESOURCE Empty_bmp as "Empty.bmp"

declare SUB MenuItemClick (Sender AS QMENUITEM)
declare SUB Show

dim menu as qdrawmenu
dim picture as qbitmap

CREATE Form AS QForm
Center
Caption = "Ownerdraw Menus"
OnShow=show
WndProc=menu.MenuProc
CREATE MainMenu AS QMainMenu
CREATE FileMenu AS QMenuItem
Caption = "&File"
CREATE OpenItem AS QMenuItem
Caption = "&Open"
OnClick=MenuItemClick
END CREATE
CREATE NewItem AS QMenuItem
Caption = "&New"
OnClick=MenuItemClick
END CREATE
CREATE BreakItem AS QMenuItem
Caption = "-"
END CREATE
CREATE ExitItem AS QMenuItem
Caption = "E&xit"
OnClick=MenuItemClick
END CREATE
END CREATE
CREATE EditMenu AS QMenuItem
Caption = "&Edit"
CREATE CutItem AS QMenuItem
Caption = "&Cut Ctrl+X"
OnClick=MenuItemClick
ShortCut="CTRL+X"
END CREATE
CREATE CopyItem AS QMenuItem
Caption = "&Copy Ctrl+C"
OnClick=MenuItemClick
ShortCut="CTRL+C"
END CREATE
CREATE PasteItem AS QMenuItem
Caption = "&Paste Ctrl+V"
OnClick=MenuItemClick
ShortCut="CTRL+V"
END CREATE
CREATE SelectItem AS QMenuItem
Caption = "&Select all Ctrl+A"
OnClick=MenuItemClick
ShortCut="CTRL+A"
END CREATE
END CREATE
CREATE Aff AS QMenuItem
caption="show"
END CREATE
END CREATE
END CREATE
Form.ShowModal

Sub Show
picture.bmpHandle=Open_bmp
menu.AddBitmap(FileMenu,OpenItem,picture,true,&hC0C0C0)
picture.bmpHandle=New_bmp
menu.AddBitmap(FileMenu,NewItem,picture,true,&hC0C0C0)
picture.bmpHandle=Exit_bmp
menu.AddBitmap(FileMenu,ExitItem,picture,true,&hC0C0C0)
picture.bmpHandle=cut_bmp
menu.AddBitmap(EditMenu,CutItem,picture,true,&hC0C0C0)
picture.bmpHandle=copy_bmp
menu.AddBitmap(EditMenu,copyItem,picture,true,&hC0C0C0)
picture.bmpHandle=paste_bmp
menu.AddBitmap(EditMenu,pasteItem,picture,true,&hC0C0C0)
picture.bmpHandle=empty_bmp
menu.AddBitmap(EditMenu,SelectItem,picture,false,&hFFFFFF)
End Sub

SUB MenuItemClick (Sender AS QMENUITEM)
ShowMessage("Thanks for clicking " + Sender.Caption)
END SUB


Appendix A: QDrive

Documentation component by D.Glodt (c)2000-2001 Appendix A: QDrive

QDrive Component

QDrive is a component no visible of infos drivers.

QDrive Properties
Field | Type | R/W | Default
Name | ARRAY OF STRING | R |
 | Name of présent drivers |  |
Count | INTEGER | R |
 | Number of présent drivers |  |

QDrive Methods
Method | Type | Description | Params
GetType | FUNCTION(index&) as long | return the type of driver. | 1
Possible values:DRIVE_REMOVABLE (2)
DRIVE_FIXED(3)
DRIVE_REMOTE(4)
DRIVE_CDROM(5)
DRIVE_RAMDISK(6)
GetFreeSpace | FUNCTION(index&) as long | return free space in octet of driver | 1
GetSize | FUNCTION(index&) as long | return the size in octet from driver | 1

QDrive Events
Event | Type | Occurs when... | Params

QDrive Examples

$INCLUDE "Object\QDrive.inc"

dim drive as QDrive
declare sub show

CREATE Form AS QFORM
Caption = "Proprietés disque dur"
Width = 320
Height = 240
Center
OnShow=show
CREATE Label1 AS QLABEL
Caption = ""
Left = 22
Top = 22
END CREATE
END CREATE

Form.ShowModal

sub show
dim i as integer
dim number as integer

    For i=1 to drive.Count
if drive.GetType(i)=DRIVE_FIXED then
number=i
next i
label1.caption="Nom lecteur: "+drive.name(number)+chr$(13)+
_
"Capacité: "+str$(drive.GetSize(number))+" octets"+chr$(13)+ _
"Espace libre: "+str$(drive.GetFreeSpace(number))+" octets"
end sub


Appendix A: QDriveCombobox

Documentation component by D.Glodt (c)2000-2001 Appendix A: QDriveCombobox

QDriveCombobox Component

QDriveCombobox is a component as QCombobox with filling of present drivers.

QDriveCombobox Properties
Field | Type | R/W | Default

QDriveCombobox Methods
Method | Type | Description | Params
GetDrives | SUB | Fill the box of present drivers | 0

QDriveCombobox Events
Event | Type | Occurs when... | Params

QDriveCombobox Examples


Appendix A: QFlashLabel

Documentation component by D.Glodt (c)2003 Appendix A: QFlashLabel

QFlashLabel Component

QFlashLabel is a flashing label component.

QFlashLabel Properties
Field | Type | R/W | Défault
LightColor | LONG | R/W | 0
 | Label light color. |  |
DarkColor | LONG | R/W | 0
 | Label dark color. |  |
Flash | BOOLEAN | R/W | FALSE
 | Activate flashing |  |
State | SHORT | R/W | 0
 | state lighted or extinct |  |
Speed | LONG | R/W | 1000
 | Flashing speed |  |
Parent | QFORM,QPANEL,QTABCONTROL | W |
Left | INTEGER | R/W | 0
Top | INTEGER | R/W | 0

QFlashLabel Methods
Method | Type | Description | Params

QFlashLabel Events
Event | Type | Occurs when... | Params

QFlashLabel Example
$typecheck on
$optimize on
$include "Rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QSkin.inc"
$include "Object\QSkinBtn.inc"
$include "Object\QTextBtn.inc"
$include "Object\QFlashLabel.inc"
$include "Object\QVuMeter.inc"
$include "Object\QVideo.inc"

$resource img as "skin3.bmp"
$resource play1 as "play1.bmp"
$resource play2 as "play2.bmp"
$resource stop1 as "stop1.bmp"
$resource stop2 as "stop2.bmp"
$resource pause1 as "pause1.bmp"
$resource pause2 as "pause2.bmp"
$resource back1 as "back1.bmp"
$resource back2 as "back2.bmp"
$resource fwd1 as "foreward1.bmp"
$resource fwd2 as "foreward2.bmp"
$resource power1 as "power1.bmp"
$resource power2 as "power2.bmp"

declare sub quit
declare sub volume
declare sub SetVolume
declare sub open
declare sub play
declare sub stop
declare sub foreward
declare sub backward
declare sub pause
Declare Sub ShowTime(Position as long,timePos aslong)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"

Dim OpenDialog asQOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"

CREATE Form ASQSkin
Center
skin.bmpHandle=img
skin.top=-1
skin.left=-1
caption="Player"
OffsWidth=-5
create display asqpanel
top=20
left=16
width=311
height=72
bevelinner=0
bevelouter=0
color=&h994400
create bar asqpanel
top=50
left=0
width=display.width
height=2
bevelinner=0
bevelouter=0
color=color1
end create
create FlashPlay
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=2
caption="Play"
end create
create FlashStop
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=16
caption="Stop"
state=true
end create
create FlashPause
asQFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=30
caption="Pause"
end create
create FlashTime
asQFlashlabel
DarkColor=color1
LightColor=color2
left=150
top=6
font.size=24
caption=RazClock
State=true
end create
create vu asQVuMeter
top=1
left=290
width=10
height=45
DarkColor=color1
LightColor=color2
value=50
end create
create btOpen
asQTextBtn
UpColor=color1
DownColor=color2
left=5
top=55
font.bold=true
caption="Open"
OnClick=open
end create
create btVol
asQTextBtn
UpColor=color1
DownColor=color2
left=265
top=55
font.bold=true
caption="Volume"
OnClick=Volume
end create
end create
create btPlay asQskinBtn
btUp.bmphandle=play1
btDown.bmphandle=play2
top=110
left=12
mode=1
OnClick=play
end create
create btStop asQskinBtn
btUp.bmphandle=stop1
btDown.bmphandle=stop2
top=110
left=44
OnClick=stop
end create
create btPause asQskinBtn
btUp.bmphandle=pause1
btDown.bmphandle=pause2
top=110
left=76
mode=1
OnClick=pause
end create
create btBack asQskinBtn
btUp.bmphandle=back1
btDown.bmphandle=back2
top=110
left=108
OnClick=backward
end create
create btFwd asQskinBtn
btUp.bmphandle=fwd1
btDown.bmphandle=fwd2
top=110
left=140
OnClick=foreward
end create
create btPower asQskinBtn
btUp.bmphandle=power1
btDown.bmphandle=power2
top=110
left=300
OnClick=quit
end create
END CREATE

CREATE Form2 ASQFORM
Caption="Volume"
Width=60
Height=190
Center
borderStyle=bsToolWindow
CREATE TbVol ASQTRACKBAR
cursor=crHandPoint
Orientation=tbVertical
Frequency=5
TickMarks=tmBoth
TickStyle=tsAuto
Left=5
Top=5
Max=0
Min=-100
Width=45
Height=150
position=-50
OnChange=SetVolume
END CREATE
END CREATE

CREATE video ASQVideo
Parent=0
volume=50
OnChange=ShowTime
timer.interval=200
BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff)
form.setdeskbar
Form.ShowModal

Sub quit
video.close
form2.close
application.terminate
End Sub

Sub volume
form2.show
End Sub

Sub SetVolume
vu.value=Abs(TbVol.position)
video.volume=Abs(TbVol.position)
End Sub

Sub open
If OpenDialog.Execute Then
video.close
if video.open(OpenDialog.FileName)then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
video.caption=GetFileName(OpenDialog.FileName)
else
showmessage
video.error
end if
end if
End Sub

Sub play
if video.FileOpen=false
then
btPlay.Down=false
else
FlashPause.flash=false
FlashStop.state=false
FlashPlay.state=true
btPause.Down=false
video.play
end if
End Sub

Sub stop
video.stop
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
End Sub

Function GetMinutes(seconds aslong)asstring
dim min asinteger
dim sec asinteger
dim sMin asstring
dim sSec asstring

min=seconds/60
sec=seconds mod 60
if min<10 then
sMin="0"+str$(min)
else
sMin=str$(min)
end if
if sec<10 then
sSec="0"+str$(sec)
else
sSec=str$(sec)
end if
result=sMin+":"+sSec
End Function

Sub ShowTime(Position aslong,timePos
aslong)
FlashTime.caption=GetMinutes(timePos)
If Video.State=VD_STOP then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
end if
End Sub

Sub pause
if video.state=VD_PLAY then
video.pause
btPlay.down=false
FlashPlay.state=false
FlashPause.flash=true
else
if video.FileOpen=false
then
btPause.Down=false
end if
End Sub

Sub foreward
if (video.currentFrame+1)<video.lenght
then
video.currentFrame=video.currentFrame+1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub

Sub backward
if video.currentFrame>0 then
video.currentFrame=video.currentFrame-1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub


Новая страница 1

QLineGraph
Copyright (c) Jonathan Boles 2002

PROPERTIES

Height AS Integer | self explanatory
Width AS Integer |
Top AS Integer |
Left AS Integer |
ExtrapolateToZero AS Boolean | whether the graph should start at 0,0
AxisColour AS Integer | Colour for axes
TextColour AS Integer | Colour for text
BackColour AS Integer | Colour for background
LineColour AS Integer | Colour for plotted line
XTitle AS String | X axis title
YTitle AS String | Y axis title
Title AS String | Title for graph
Data AS QStringGrid | Graph data, stored in form
 | x=Data.Cell(0,i) y=Data.Cell(1,i) where i is an integer
TextFont AS QFont | Font for graph text
Visible AS Boolean |
Hint AS String |
ShowHint AS Boolean |
Cursor AS Integer | Cursor for the graph

METHODS

SUB Initialise | Initialise graphsystem
SUB SaveToFile | save graph to .bmp (can't get this 2 work


Appendix A: QICON

Documentation component by D.Glodt (c)2000-2004 Appendix A: QICON

QICON Component

QICON is a component no visible with icons extraction from exe,dll,icl,ico files or associated files and save file to icon format.

QICON Properties
Field | Type | R/W | Default
FileName | STRING | RW |
 | Name of icon file including the path, the files type are *.ico,*.exe,*.dll,*.icl or other files associated to an exé.a empty string delete the current icon in mémory.
Count | INTEGER | R |
 | Number of icons in the file.
Handle | LONG | R |
 | Icon handle.
Index | INTEGER | RW | 0
 | Icon index ,for selection of icon from file if it has many icons.
Associated | BOOLEAN | RW | FALSE
 | Icon associated to a exe file if the value is true. |  |

QICON Methods
Method | Type | Description | Params
SaveToFile | Sub(FileName$,pixelFormat%,mask%) | Save to icon format FileName is the file name,PixelFormat can be pf4bit(16 colors) or pf8bit(256 colors , mask is transparence(true or false) | 3
SaveBmpToFile | Sub(QBitmap,FileName$,pixelFormat%,mask%) | Save a bitmap to icon format. | 4
ConvertAsCursor | Sub(FileName$,XHotSpot?,YHotSpot?) | Convert icon filename$ as cursor, parameters XHotSpot and YHotSpot are cursor coordinates | 3

QICON Events
Event | Type | Occurs when... | Params

QICON Examples

$TYPECHECK ON
$Option ICON "IconLib.ico"
$Include "Rapidq.inc"
$Include "QFuncLib.inc"
$Include "Object\QICON.inc"
$Include "Object\QCanvasEx.inc"
$INCLUDE "Object\QCOLORDIALOG.INC"
$INCLUDE "Object\QDrawFocus.INC"
$INCLUDE "Object\QFileListView.inc"
$INCLUDE "Object\QFormEx.inc"
$include "Object\QAbout.inc"

$Resource CODE as "IconLib.ico"
$Resource ICO_DEFAUT as "defaut.ico"
$Resource ICO_EXE as "exe.ico"
$Resource ICO_DLL as "dll.ico"
$Resource ICO_IMG as "img.ico"

$Resource ICO_SMALL_DEFAUT as "SmallDefaut.ico"
$Resource ICO_SMALL_EXE as "SmallExe.ico"
$Resource ICO_SMALL_DLL as "SmallDll.ico"
$Resource ICO_SMALL_IMG as "SmallImg.ico"

declare Sub open(file as string)
declare Sub draw
declare sub ChangeDirectory
declare sub ShowFiles
declare sub ShowIco
declare sub ShowIcl
declare sub ShowDll
declare sub ShowExe
declare sub ShowCur
declare sub showColor
declare sub SaveAs
declare sub MenuMask
declare sub SelectIco(button as long,x as long,y as long,shift as long)
declare Sub ShowList(sender as QMenuItem)
declare sub ResizeImage
declare sub OnAbout
declare sub DrawCursor
declare sub GridCursor
declare sub InfoGrid(x as short,y as short)
declare sub CloseGrid(Button as short,x as short,y as short)
declare sub OpenGrid
declare sub CheckIco

const Offset=38
dim bitmap as QBITMAP
bitmap.PixelFormat=pf24bit
bitmap.width=32
bitmap.height=32
dim rect as QRECT
dim dest as QRECT
dim icon as Qicon
dim Dial as QColorDialog
dim ImageColor as long
ImageColor=&HFFFFFF
Dim SaveDialog as QSaveDialog
SaveDialog.Filter="icones 16 couleurs(*.ico)|*.ico|icones 256 couleurs(*.ico)|*.ico|bitmap 24 bits(*.bmp)|*.bmp|"
SaveDialog.Caption= "Sauver sous"
dim popup as QPOPUPMENU
dim pop1 as QMENUITEM
pop1.caption="&Sauver sous..."
pop1.OnClick=SaveAs
popup.addItems(pop1)
popup.autoPopup=true
dim IconSelect as integer
dim focus as QDrawFocus
    focus.noresize=true
    focus.showcursor=false
dim about as QAbout
const AppTitle="Icon viewer"
const AppVersion="1.2"

CREATE Form AS QFormEx
    Caption=AppTitle
    Width=640
    Height=500
    Center
    DeskBar=true
    CREATE Menu as QMAINMENU
      CREATE Menu1 as QMENUITEM
        caption="&Fichier"
        OnClick=CheckIco
        CREATE item11 as QMENUITEM
          caption="&Sauver sous..."
          OnClick=SaveAs
        END CREATE
        CREATE item12 as QMENUITEM
          caption="&Mode transparent"
          checked=true
          OnClick=MenuMask
        END CREATE
        CREATE item13 as QMENUITEM
          caption="-"
        END CREATE
        CREATE item14 as QMENUITEM
          caption="&Conversion curseur"
          OnClick=OpenGrid
        END CREATE
      END CREATE
      CREATE Menu2 as QMENUITEM
        caption="&Affichage"
        CREATE item1 as QMENUITEM
          caption="&Couleur de fond"
          OnClick=ShowColor
        END CREATE
        CREATE item2 as QMENUITEM
          caption="-"
        END CREATE
        CREATE item3 as QMENUITEM
          caption="&Fichiers ico"
          checked=true
          OnClick=ShowIco
        END CREATE
        CREATE item4 as QMENUITEM
          caption="&Fichiers icl"
          checked=true
          OnClick=ShowIcl
        END CREATE
        CREATE item5 as QMENUITEM
          caption="&Fichiers dll"
          checked=true
          OnClick=ShowDll
        END CREATE
        CREATE item6 as QMENUITEM
          caption="&Fichiers exe"
          checked=true
          OnClick=ShowExe
        END CREATE
        CREATE item7 as QMENUITEM
          caption="&Fichiers cur"
          checked=true
          OnClick=ShowCur
        END CREATE
        CREATE item8 as QMENUITEM
          caption="-"
        END CREATE
        CREATE item21 as QMENUITEM
          caption="&Grandes icones"
          Tag=1
          OnClick=ShowList
        END CREATE
        CREATE item22 as QMENUITEM
          caption="&Petites icones"
          Tag=2
          OnClick=ShowList
        END CREATE
        CREATE item23 as QMENUITEM
          caption="&Liste"
          Tag=3
          OnClick=ShowList
        END CREATE
        CREATE item24 as QMENUITEM
          caption="&Détails"
          Tag=4
          checked=true
          OnClick=ShowList
        END CREATE
      END CREATE
      CREATE Menu3 as QMENUITEM
        caption="&?"
        CREATE item31 as QMENUITEM
          caption="&A Propos..."
          OnClick=OnAbout
        END CREATE
      END CREATE
    END CREATE
    CREATE Splitter1 AS QSPLITTER
      Align=alLeft
      width=5
    END CREATE
    CREATE DirTree AS QDirTree
      Align=alLeft
      InitialDir = CURDIR$
      Width =300
      OnChange=ChangeDirectory
    END CREATE
    CREATE EXEList AS QFileListView
      Align=alClient
      Width = 325
      ViewStyle=vsReport
      ExtensionsList.AddItems ("exe","dll","icl","ico","cur","ani")
      SmallImageList.AddIcoHandle(ICO_SMALL_DEFAUT)
      LargeImageList.AddIcoHandle(ICO_DEFAUT)
      SmallImageList.AddIcoHandle(ICO_SMALL_EXE)
      LargeImageList.AddIcoHandle(ICO_EXE)
      SmallImageList.AddIcoHandle(ICO_SMALL_DLL)
      LargeImageList.AddIcoHandle(ICO_DLL)
      SmallImageList.AddIcoHandle(ICO_SMALL_IMG)
      LargeImageList.AddIcoHandle(ICO_IMG)
      SmallImageList.AddIcoHandle(ICO_SMALL_IMG)
      LargeImageList.AddIcoHandle(ICO_IMG)
      SmallImageList.AddIcoHandle(ICO_SMALL_IMG)
      LargeImageList.AddIcoHandle(ICO_IMG)
      SmallImageList.AddIcoHandle(ICO_SMALL_IMG)
      LargeImageList.AddIcoHandle(ICO_IMG)
      ColumnCaption(1)="Nom"
      ColumnCaption(2)="Taille"
      ColumnCaption(3)="Type"
      ColumnCaption(4)="Modifié"
      Mask = "*.dll;*.exe;*.icl;*.ico;*.cur;*.ani"
      OnFileChange=Open
    END CREATE
    CREATE Splitter2 AS QSPLITTER
      Align=alBottom
      cursor=crVSplit
      width=5
    END CREATE
    CREATE box as QSCROLLBOX
      Align=alBottom
      height=150
      OnResize=ResizeImage
      CREATE image as QCanvasEx
        top=0
        left=0
        width=box.width-4
        height=box.height-4
        fillrect(0,0,image.width,image.height,&HFFFFFF)
        PopupMenu=Popup
        OnPaint=Draw
        OnMouseDown=SelectIco
      END CREATE
    END CREATE
    CREATE Infos AS QSTATUSBAR
       SizeGrip=false
       AddPanels "Nombre d'icons:","selection:"
       Panel(0).width=200
    END CREATE
END CREATE

'========================================================
' boite dialogue coordonnées x,y curseur
'========================================================
CREATE Form2 as QFORM
  width=300
  height=340
  caption="Coordonnées curseur"
  center
  borderstyle=4
  CREATE SpotInfo as QLABEL
    top=10
    left=15
    autosize=true
    caption="X:"+space$(3)+"Y:"
    transparent=true
  END CREATE
  CREATE BoxIco AS QSCROLLBOX
    top=40
    left=15
    width=260
    height=260
    CREATE ImgIco AS QCANVASEX
      left=0
      top=0
      width=256
      height=256
      OnPaint=DrawCursor
      OnMouseMove=InfoGrid
      OnMouseDown=CloseGrid
    END CREATE
  END CREATE
END CREATE

Form.ShowModal

sub OpenGrid
  Dim msgButton as integer

  msgButton=MessageBox("Convertir "+GetFileName(icon.filename)+" en curseur?",application.title,36)
  if msgButton=mrYes then form2.show
end sub

sub CheckIco
  if instr(lcase$(icon.filename),".ico")>0 then
    item14.enabled=true
  else
    item14.enabled=false
  end if
end sub

sub DrawCursor
  ImgIco.fillrect(0,0,256,256,&hffffff)
  ImgIco.DrawIco(0,0,256,256,Icon.handle)
  GridCursor
end sub

'============================
' Affichage grille zoom
'============================
Sub GridCursor
  dim ptHorz as integer
  dim ptVert as integer
  dim i as integer

  ptHorz=0
  ptVert=0
  ImgIco.pensize=1
  for i=1 to int(ImgIco.height/8)
    ptHorz=ptHorz+8
    ImgIco.line(0,ptHorz,ImgIco.width,ptHorz,&h0)
  next i
  for i=1 to int(ImgIco.width/8)
    ptVert=ptVert+8
    ImgIco.line(ptVert,0,ptVert,ImgIco.height,&h0)
  next i
End Sub

Sub InfoGrid(x as short,y as short)
  SpotInfo.caption="X:"+str$(int(x/8)+1)+" Y:"+str$(int(y/8)+1)
End Sub

Sub CloseGrid(Button as short,x as short,y as short)
  Form2.close
  icon.ConvertAsCursor(icon.filename,(x/8)+1,(y/8)+1)
  icon.filename=FullPathNoExt(icon.filename)+".cur"
  EXEList.Refresh
End Sub

Sub Open(file as string)
  icon.filename=file
  image.repaint
  infos.panel(0).caption="Nombre d'icons:"+str$(icon.count)
  infos.panel(1).caption="Selection:"
End Sub

Sub ResizeImage
 image.width=box.width-4
End Sub

Sub Draw()
  dim i as integer
  dim col as integer
  dim x as integer
  dim y as integer

  x=0
  y=0
  focus.remove(image.handle)
  image.fillrect(0,0,image.width,image.height,ImageColor)
  if icon.count>1 then
    if icon.count*Offset>(image.width-Offset) then
      col=icon.count/((image.width-Offset)/Offset)
      if box.height<(Offset*col+Offset) then
        image.height=Offset*col+Offset
      else
        image.height=box.height-4
      end if
    else
      image.height=box.height-4
    end if
    for i=0 to icon.count
      if x+Offset>image.width then
        x=0
        y=y+Offset
      end if
      icon.index=i
      image.DrawIco(x,y,0,0,Icon.handle)
      x=x+Offset
    next i
  else
    image.height=box.height-4
    image.DrawIco(0,0,0,0,Icon.handle)
  end if
End Sub

SUB ChangeDirectory
  EXEList.Directory =DirTree.Directory
END SUB

Sub ShowFiles
  EXElist.Mask=""
  if item3.checked then
    if EXElist.Mask="" then
      EXElist.Mask=EXElist.Mask+"*.ico"
    else
      EXElist.Mask=EXElist.Mask+";*.ico"
    end if
  end if
  if item4.checked then
    if EXElist.Mask="" then
      EXElist.Mask=EXElist.Mask+"*.icl"
    else
      EXElist.Mask=EXElist.Mask+";*.icl"
    end if
  end if
  if item5.checked then
    if EXElist.Mask="" then
      EXElist.Mask=EXElist.Mask+"*.dll"
    else
      EXElist.Mask=EXElist.Mask+";*.dll"
    end if
  end if
  if item6.checked then
    if EXElist.Mask="" then
      EXElist.Mask=EXElist.Mask+"*.exe"
    else
      EXElist.Mask=EXElist.Mask+";*.exe"
    end if
  end if
  if item7.checked then
    if EXElist.Mask="" then
      EXElist.Mask=EXElist.Mask+"*.cur;*.ani"
    else
      EXElist.Mask=EXElist.Mask+";*.cur;*.ani"
    end if
  end if
End Sub

Sub ShowIco
  if item3.checked then
    item3.checked=false
  else
    item3.checked=true
  end if
  ShowFiles
End Sub

Sub ShowIcl
  if item4.checked then
    item4.checked=false
  else
    item4.checked=true
  end if
  ShowFiles
End Sub

Sub ShowDll
  if item5.checked then
    item5.checked=false
  else
    item5.checked=true
  end if
  ShowFiles
End Sub

Sub ShowExe
  if item6.checked then
    item6.checked=false
  else
    item6.checked=true
  end if
  ShowFiles
End Sub

Sub ShowCur
  if item7.checked then
    item7.checked=false
  else
    item7.checked=true
  end if
  ShowFiles
End Sub

Sub ShowColor
  Dial.style=cdNormal
  if Dial.Execute then
    ImageColor=Dial.Color
    image.repaint
  end if
End Sub

Function Selection(x as long,y as long)as integer
  dim left as integer
  dim top as integer
  dim i as integer

  left=0
  top=0
  for i=1 to icon.count
    if left+Offset>image.width then
      left=0
      top=top+Offset
    end if
    if x>left and x<(left+32) and y>top and y<(top+32) then
      Selection=i
      IconSelect=i-1
      rect.left=left
      rect.top=top
      rect.right=left+32
      rect.bottom=top+32
      focus.start(image.handle,left-1,top-1)
      focus.draw(image.handle,left+34,top+34,true)
    end if
    left=left+Offset
  next i
End function

Sub SelectIco(button as long,x as long,y as long,shift as long)
  if Selection(x,y)=0 then focus.remove(image.handle)
  infos.panel(1).caption="Selection:icon"+str$(Selection(x,y))
End Sub

Sub MenuMask
  if item12.checked then
    item12.checked=false
  else
    item12.checked=true
  end if
End Sub

Sub ShowList(sender as QmenuItem)
  item21.checked=false
  item22.checked=false
  item23.checked=false
  item24.checked=false
  sender.checked=true
  Select Case sender.tag
  Case 1
    ExeList.ViewStyle=vsIcon
  Case 2
    ExeList.ViewStyle=vsSmallIcon
  Case 3
    ExeList.ViewStyle=vsList
  Case 4
    ExeList.ViewStyle=vsReport
  End Select
End Sub

Sub SaveAs
  If SaveDialog.Execute Then
    Select case SaveDialog.FilterIndex
    case 1
      icon.index=IconSelect
      if instr(lcase$(SaveDialog.filename),".ico")=0 then
        icon.saveToFile(SaveDialog.filename+".ico",pf4bit,item12.checked)
      else
        icon.saveToFile(SaveDialog.filename,pf4bit,item12.checked)
      end if
    case 2
      icon.index=IconSelect
      if instr(lcase$(SaveDialog.filename),".ico")=0 then
        icon.saveToFile(SaveDialog.filename+".ico",pf8bit,item12.checked)
      else
        icon.saveToFile(SaveDialog.filename,pf8bit,item12.checked)
      end if
    case 3
      dest.left=0
      dest.top=0
      dest.right=32
      dest.bottom=32
      bitmap.fillrect(0,0,32,32,&HFFFFFF)
      Bitmap.copyRect(Dest,image,rect)
      if instr(lcase$(SaveDialog.filename),".bmp")=0 then
        Bitmap.saveToFile(SaveDialog.FileName+".bmp")
      else
        Bitmap.saveToFile(SaveDialog.FileName)
      end if
    end Select
  end if
End Sub

Sub OnAbout
  about.AppName=AppTitle
  about.AppVersion=AppVersion
  about.Caption="A propos"
  about.text="Auteur:Glodt dominique"+chr$(13)+"License libre"
  about.image.icohandle=Code
  about.EmailFont.color=&hff0000
  about.email="dominique.glodt@libertysurf.fr"
  about.show
End Sub


Appendix A: QImageDialog

Documentation component by D.Glodt (c)2004 Appendix A: QImageDialog

QImageDialog Component

QImageDialog is dialog box selection of files with visualization of the graphic types.

This component requires DLL NVIEWLIB for the visualization of the jig , gif, jpg, pcx, tga, dib, rle types ,
if this one is not present in the system or in the directory of executable, only the bmp, ico, cur, ani types will be
visualized.

QImageDialog Properties
Field | Type | R/W | Défault
Caption | STRING | R/W |
 | Title of dialog box |  |
FileName | STRING | R/W |
 | File name with path. |  |
Filter | STRING | R/W |
 | Filter for file type. |  |
FilterIndex | INTEGER | R/W |
 | Filter index for file type. |  |
InitialDir | STRING | R/W |
 | Set the initial directory |  |
DlgCaption | ARRAY OF STRING | R/W |
 | Label of controls of dialog box,in english by default item 1 is label of file name item 2 is label of file type item 3 is caption of open button item 4 is caption of cancel button |  |
ErrorLanguage | STRING | R/W |
 | Error language for dll. (French,English,German,Dutch,Portuguese,Spanish,Japanese,Italian) |  |
MultiSelect | BOOLEAN | R/W | FALSE
SelCount | INTEGER | R |
 | Number of file selected |  |
Selected | QSTRINGLIST | R/W |
 | Files selected with path |  |

QImageDialog Methods
Method | Type | Description | Params
Execute | FUNCTION AS BOOLEAN | Show the dialog box | 0

QImageDialog Events
Event | Type | Occurs when... | Params

QImageDialog Examples

$typecheck on
$include "object\QImageDialog.inc"

dim a as
QimageDialog
a.filter="Tous format(*.bmp;*.ico;*.ani;*.cur*.gif;*.jpg;*.dib;*.rle;*.tga;*.pcx)|*.bmp;*.ico;*.ani;*.cur*.gif;*.jpg;*.dib;*.rle;*.tga;*.pcx|Fichiers
bitmap(*.bmp)|*.bmp|Fichiers gif(*.gif)|*.gif|Fichiers jpg(*.jpg)|*.jpg|Fichiers
ico(*.ico)|*.ico|Fichiers curseur(*.cur;*.ani)|*.cur;*.ani"
a.caption="Ouvrir"
a.DlgCaption(1)="Nom
du fichier:"
a.DlgCaption(2)="Type
du fichier:"
a.DlgCaption(3)="Ouvrir"
a.DlgCaption(4)="Annuler"
a.errorLanguage="french"
a.MultiSelect=true
a.execute
end


Appendix A: QINI

Documentation component by D.Glodt (c)2000-2001 Appendix A: QINII

QINI Component

QINI is a component no visible to read and write init files for application.

QINI Properties
Field | Type | R/W | Default
FileName | STRING | RW |
 | Init file name (*.ini)
Exist | INTEGER | R | FALSE
 | TRUE if file exist
Section | STRING | LE |
 | Name of parameters section from file
WinDir | STRING | R |
 | Path of window dir
SystemDir | STRING | R |
 | Path of directory system window |  |
TempDir | STRING | R |
 | Path of directory temp window |  |

QINI Methods
Method | Type | Description | Params
Get | FUNCTION(Key$,Default$) AS STRING | Return the value of Key$ parameter | 2
Write | FUNCTION(Key$,Value$) AS LONG | Write value of Key$ parameter in the init file | 2

QINI Events
Event | Type | Occurs when... | Params

QINI Examples

$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QINI.inc"

dim ini as QINI
ini.FileName="c:\Temp\test.ini"
ini.Section="Parametres"
ini.write("par1","1")
ini.write("par2","2")

CREATE Form AS QFORM
  Caption="init"
  Width=300
  Height=110
  Center
END CREATE
if ini.exist then form.caption=ini.get("par1","no param")
Form.ShowModal


Appendix A: QLine

Documentation component by Glodt dominique (c)2003 Appendix A: QLINE

QLINE Component

QLine is a line for separator of toolbar.

QLine Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
 | Align determines how the control aligns within its parent control.
Color | INTEGER | RW |
Cursor | INTEGER | RW | crDefault
Enabled | INTEGER | RW | True
Height | INTEGER | RW |
Hint | STRING | RW |
Left | INTEGER | RW | 0
Parent | QFORM/QPANEL/QTABCONTROL | W |
ShowHint | INTEGER | RW | False
Top | INTEGER | RW | 0
Width | INTEGER | RW |
Visible | INTEGER | RW | True

QLine Methods
Method | Type | Description | Params

QLine Events
Event | Type | Occurs when... | Params
OnClick | VOID | User clicked on line | 0
OnDblClick | VOID | User double clicked on line | 0

QLine Example

$TypeCheck on
$Include "Object\QLine.inc"

CREATE Form AS QFORM
Caption = "Line"
Width = 320
Height = 240
Center
CREATE Menu as QMainMenu
CREATE Menu1 as QMenuItem
caption="Fichier"
END CREATE
END CREATE
Create Line as QLine
Align=1
Left = 10
Top = 10
End Create
END CREATE

Form.ShowModal


Appendix A: QProcess

Documentation component by D.Glodt (c)2003 Appendix A: QProcess

QProcess Component

QProcess is a no visible component, it function is to execute process background via a user routine.

QProcess Properties
Priority | LONG | R/W | 0
 | Process priority with following values: ProcessLow=-2 ProcessBelowNormal=-1 ProcessNormal=0 ProcessHight=2 ProcessAboveNormal=1 ProcessTimeCritical=15 ProcessIdle=-15 |  |

QProcess Methods
Method | Type | Description | Params
Open | SUB | execute process | 0
Close | SUB | Stop process | 0

QProcess Events
Event | Type | Occurs when... | Params
OnProcess |  | Process execution | 0

QProgress Example

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$include "Object\QProcess.inc"
'Subs internal
declare sub rout1
DECLARE SUB OpenClick
DECLARE SUB SendClick
DECLARE SUB fin
'Variables globales
dim num as long
dim process as QProcess
process.OnProcess=rout1 'process routine
CREATE Form ASQFORM
Caption = "Test process"
Width=200
Height=200
Center
CREATE OpenButton ASQBUTTON
Caption="&Open"
Left=20
Top=50
height=20
OnClick=OpenClick
END CREATE
CREATE butexit ASQBUTTON
Caption="Close"
Left=20
Top=75
height=20
Enabled=0
OnClick=fin
END CREATE
CREATE ED ASQEDIT
left=10
top=10
width=100
END CREATE
END CREATE
Form.ShowModal

SUB fin
process.close
OpenButton.enabled=1
end sub

SUB OpenClick
OpenButton.enabled=0
butexit.enabled=1
process.priority=ProcessNormal
process.open
END SUB

sub rout1 ' process routine
while true
sleep 0.1
num++
ed.text="Count"+str$(num)
wend
end sub


QResourceStream.bas

'   **********************************************************************
'   **                                                                  **
'   **  Resource stream for Rapid-Q (c) 2000 Pavel "Crusher" Minayev    **
'   **  Version 1.10 (built on 6/25/2000)                               **
'   **  If you find a bug, e-mail me to minayev@aport.ru                **
'   **                                                                  **
'   **  You can freely distribute & modify this file if you mention     **
'   **  somewhere that original file was written by me.                 **
'   **                                                                  **
'   **  To use this file, $INCLUDE it in your programs, and you will    **
'   **  be able to declare variables of QResourceStream type. They'll   **
'   **  work exactly like file streams opened in fmOpenRead mode, but   **
'   **  you should open resources by <variable>.Open(<resource-number>) **
'   **  Note that you don't have to use RESOURCE() function, it's done  **
'   **  automatically. Access mode is always read-only, calls to Write  **
'   **  functions doesn't do anything. Also, ReadUDT will not work at   **
'   **  all for now. And you should NEVER use resource streams as       **
'   **  arguments of CopyFrom method - that'll give you an error.       **
'   **                                                                  **
'   **  I don't know if this library will work on future versions of    **
'   **  Rapid-Q. It may work, or may not. However, I'll try to release  **
'   **  new versions of this library for the new versions of Rapid-Q.   **
'   **                                                                  **
'   **  This library was made for Win32. I doubt it works under Unix or **
'   **  Linux, and I don't have one to test it. You can however port it **
'   **  it to any OS you like if you want to do so.                     **
'   **                                                                  **
'   **  Program history:                                                **
'   **                                                                  **
'   **  Version 1.10                                                    **
'   **  - got rid of ResourceStart definition                           **
'   **  - implemented EOF property                                      **
'   **                                                                  **
'   **  Version 1.00                                                    **
'   **  - initial release                                               **
'   **                                                                  **
'   **********************************************************************

$TYPECHECK ON
$INCLUDE "rapidq.inc"

TYPE QResourceStream EXTENDS QFileStream
    PRIVATE:
        DataTypeToSize(Num_BYTE TO Num_DOUBLE) AS INTEGER
        Offset AS INTEGER
        ResourceStart AS INTEGER
        RealFile AS QFileStream

    PUBLIC:
        LineCount AS INTEGER
        Position AS INTEGER
        Size AS INTEGER

        CONSTRUCTOR
            Offset = 0
            LineCount = 0
            DataTypeToSize(Num_BYTE) = SIZEOF(BYTE)
            DataTypeToSize(Num_SHORT) = SIZEOF(SHORT)
            DataTypeToSize(Num_WORD) = SIZEOF(WORD)
            DataTypeToSize(Num_LONG) = SIZEOF(LONG)
            DataTypeToSize(Num_DWORD) = SIZEOF(DWORD)
            DataTypeToSize(Num_SINGLE) = SIZEOF(SINGLE)
            DataTypeToSize(Num_DOUBLE) = SIZEOF(DOUBLE)
            RealFile.Open(Command$(0), fmOpenRead)
            RealFile.Seek(-4, soFromEnd)
            ResourceStart = QResourceStream.RealFile.Size - QResourceStream.RealFile.ReadNum(Num_LONG) - 4
        END CONSTRUCTOR

        FUNCTION Open(Res AS INTEGER) AS INTEGER
            WITH QResourceStream
                IF Res >= RESOURCECOUNT THEN
                    Result = False
                ELSE
                    .Offset = .ResourceStart + RESOURCE(Res)
                    .RealFile.Seek(.Offset, soFromBeginning)
                    .Size = .RealFile.ReadNum(Num_LONG)
                    .Offset + = SIZEOF(LONG)
                    .Position = 0
                    Result = True
                END IF
            END WITH
        END SUB

        SUB Close
            QResourceStream.Offset = 0
        END SUB

        SUB Seek(NewPos AS INTEGER, From AS INTEGER)
            WITH QResourceStream
                SELECT CASE From
                    CASE IS = soFromBeginning
                        .Position = NewPos
                    CASE IS = soFromCurrent
                        .Position + = NewPos
                    CASE IS = soFromEnd
                        .Position = .Size - NewPos - 1
                END SELECT
                IF .Position < 0 THEN .Position = 0
                IF .Position >= .Size THEN .Position = .Size - 1
                .RealFile.Seek(.Offset + .Position, soFromBeginning)
            END WITH
        END SUB

        FUNCTION EOF AS INTEGER
            IF QResourceStream.Position = QResourceStream.Size THEN
                Result = True
            ELSE
                Result = False
            END IF
        END FUNCTION

    PRIVATE:

        SUB CheckForEOF
            WITH QResourceStream
                IF .Position > .Size THEN
                    .Position = .Size
'                    .Seek(0, soFromEnd)
                END IF
            END WITH
        END SUB

    PUBLIC:

        FUNCTION ReadNum(Size AS INTEGER) AS DOUBLE
            WITH QResourceStream
                IF .Position = .Size THEN EXIT FUNCTION     ' EOF
                Result = .RealFile.ReadNum(Size)
                .Position + = .DataTypeToSize(Size)
                .CheckForEOF
            END WITH
        END FUNCTION

        FUNCTION ReadStr(Size AS INTEGER) AS STRING
            DEFSTR Tmp
            WITH QResourceStream
                IF .Position = .Size THEN EXIT FUNCTION     ' EOF
                Tmp = .RealFile.ReadStr(Size)
                IF .Position >= .Size THEN
                    Tmp = LEFT$(Tmp, LEN(Tmp) - (.Position - .Size + 1))
                    .Position = .Size - 1
                    .Seek(0, soFromEnd)
                END IF
                Result = Tmp
            END WITH
        END FUNCTION

        FUNCTION ReadBinStr(Size AS INTEGER) AS STRING
            Result = QResourceStream.ReadStr(Size)
        END FUNCTION

        FUNCTION ReadLine AS STRING
            DEFINT char
            DEFSTR Res
            WITH QResourceStream
                IF .Position = .Size THEN EXIT FUNCTION     ' EOF
                char = 0 : Res = ""
                WHILE char <> 13 AND .Size <> .Position
                    char = .ReadNum(Num_BYTE)
                    IF char <> 13 AND char <> 10 THEN
                        Res = Res + CHR$(char)
                    END IF
                WEND
                Result = Res
            END WITH
        END FUNCTION

        SUB ReadUDT(Data AS QObject)
            ' Not yet implemented
        END SUB

        SUB WriteNum(Number AS INTEGER, Size AS INTEGER)
            ' Does nothing
        END SUB

        SUB WriteStr(Data AS STRING, Size AS INTEGER)
            ' Does nothing
        END SUB

        SUB WriteBinStr(Data AS STRING, Size AS INTEGER)
            ' Does nothing
        END SUB

        SUB WriteLine(Line AS STRING)
            ' Does nothing
        END SUB

        SUB WriteUDT(Data AS QObject)
            ' Does nothing
        END SUB

        SUB CopyFrom(Stream AS QObject, Bytes AS INTEGER)
            ' Does nothing
        END SUB

END TYPE


Appendix A: QRun

Documentation component by D.Glodt (c)2001-2002

Appendix A: QRun

QRun Component

QRun is a coponent no visible to execute applications or associated files.it can find all desktop application and take their control.

QRun Properties

Field | Type | R/W | Default

QRun Methods

Method | Type | Description | Params
FindApplication | FUNCTION(FileName$) AS STRING | Return the name and path of associated application. | 1
FileRun | SUB(FileName$,cmdShow%) | Run a associated file or an exe file. cmdShow can be SW_HIDE SW_SHOWNORMAL SW_NORMAL SW_SHOWMINIMIZED SW_SHOWMAXIMIZED SW_MAXIMIZE SW_SHOWNOACTIVATE SW_SHOW SW_MINIMIZE SW_SHOWMINNOACTIVE SW_SHOWNA SW_RESTORE SW_SHOWDEFAULT SW_MAX | 2
ExeRun | SUB(ExeName$,Param$,cmdShow%) | Run an exe file with parameters. | 3
EnumWindow | FUNCTION(All&) As Boolean | The desktop windows will be returned by event OnEnumWindows if the parameter All is at false , only visibles windows will be returned.The method return true if there is find windows | 1
FindChild | FUNCTION(handle&,class$,name$) As Boolean | Return handle of children control by arguments following: handle& is the parent handle , class$ is the class name of search control , name$ is the title of control. | 3
EnumFromPoint | FUNCTION(X&,Y&) As Boolean | Return the window at the position x,y by event OnEnumFromPoint. The method return true if there is a find window. | 2
Close | SUB(handle&) | Close window identify by handle parameter. | 1
Minimize | SUB(handle&) | Minimize window identify by handle parameter. | 1
Maximize | SUB(handle&) | Maximize window identify by handle parameter. | 1
Restore | SUB(handle&) | Restore window state identify by handle parameter. | 1
SetFocus | SUB(handle&) | Set focus on control identify by handle parameter. | 1
SetTopMost | SUB(handle&,flag&) | Put the window identify by handle parameter to the top level of Z order if parameter flag is at true | 2

QRun Events

Event | Type | Occurs when... | Params
OnEnumWindows | (handle&,name$,ClassName$) | On execution of the method EnumWindow | 3
OnEnumFromPoint | (handle&,name$,ClassName$) | On execution of the method EnumFromPoint | 3

QRun Examples

QRun Exemple 1

$typecheck on
$INCLUDE "Rapidq.inc"
$INCLUDE "Object\QRun.inc"

declare sub OuvrirClick
declare sub QuitterClick

dim App as QRun

CREATE Form AS QFORM
  Caption ="Execute"
  Width = 200
  Height = 200
  Center
  CREATE Menu AS QMAINMENU
    CREATE item1 AS QMENUITEM
      Caption="&Fichier"
      CREATE item2 AS QMENUITEM
        Caption="&Ouvrir"
        OnClick=OuvrirClick
      END CREATE
      CREATE item5 AS QMENUITEM
        Caption="-"
      END CREATE
      CREATE item6 AS QMENUITEM
        Caption="&Quitter"
        OnClick=QuitterClick
      END CREATE
   END CREATE
 END CREATE
END CREATE

Form.ShowModal

sub OuvrirClick
 dim file as QOPENDIALOG

 file.Filter="Fichiers(*.*)|*.*"
 file.InitialDir=CurDir$
 if file.Execute then
 if App.FindApplication(file.fileName)<>"" then
 App.fileRun(file.fileName,SW_SHOW)
 end if
 end if
end sub

sub QuitterClick
 Form.Close
end sub

QRun Exemple 2

$typecheck on
$include "rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QRun.inc"

declare sub rout1
declare sub rout2(handle as Long,name as string,ClassName as string)

dim app as QRun
    app.OnEnumWindows=rout2

create form as qform
  center
  caption="Enum windows"
  width=600
  height=400
  create lb as qlistbox
    width=300
    height=200
  end create
  create bt as qbutton
    caption="Enum"
    onclick=rout1
    left=340
  end create
end create

form.showmodal

sub rout1
  lb.clear
  app.enumWindow false
end sub

sub rout2(handle as Long,name as string,ClassName as string)
  if handle<>form.handle and handle<>application.handle then
    lb.additems name
    lb.additems ClassName
  end if
end sub


Appendix A: QSkin

Documentation component by D.Glodt (c)2003 Appendix A: QSkin

QSkin Component

QSkin is component inherited from QForm used to have the shapes and skins of file bitmap.

QSkin has all the properties, methods and events of QForm.
Dimensions of QSkin are those of the size of the affected bitmap to its Skin property.

QSkin Properties
Field | Type | R/W | Défault
Skin | QIMAGE | R/W |
 | Bitmap Image to the skin of window |  |
OffsWidth | SHORT | R/W |
 | Offset width form |  |
OffsHeight | SHORT | R/W |
 | Offset height form |  |

QSkin Methods
Method | Type | Description | Params
SetDeskBar | SUB | The application will be in the task bar during its reduction | 0
Resize | SUB | Resize window after a skin change | 0

QSkin Events
Event | Type | Occurs when... | Params

QSkin Example
$typecheck on
$optimize on
$include "Object\QSkin.inc"
$resource img as "clock.bmp" ' skin bitmap file
declare sub showTime
dim tim as qtimer
tim.interval=1000
tim.OnTimer=ShowTime

CREATE Form AS QSkin
Center
skin.bmpHandle=img ' using skin bitmap
skin.top=-1 ' offset position of bitmap
OffsWidth=-5 'offset width form
caption="Clock"
create clock as qlabel
top=60
left=80
font.bold=true
font.size=24
font.color=&hff0000
caption=Time$
labelStyle=2
transparent=true
end create
Create b1 as qbutton
top=140
left=120
kind=6
end create
END CREATE
form.shapeform(img,&hffffff) ' define the shape with the same skin bitmap
form.setdeskbar
Form.ShowModal

sub showTime
clock.caption=Time$
end sub


Appendix A: QSkinBtn

Documentation component by D.Glodt (c)2003 Appendix A: QSkinBtn

QSkinBtn Component

QSkinBtn is button component of skin type.

QSkinBtn Properties
Field | Type | R/W | Défault
btUp | QBITMAP | R/W |
 | Bitmap Image for up state. |  |
btDown | QBITMAP | R/W |
 | Bitmap image for down state. |  |
btEnable | QBITMAP | R/W |
 | Bitmap image for disable state. |  |
mode | SHORT | R/W | 0
 | Run mode button Mode to 0:same to a QButton Mode to 1:button stay a the down state after click. Mode to 2:button change state after each click. |  |
down | BOOLEAN | R/W | FALSE
 | down state of button |  |
Enabled | BOOLEAN | R/W | TRUE
Parent | QFORM,QPANEL,QTABCONTROL | W |
Left | INTEGER | R/W | 0
Top | INTEGER | R/W | 0

QSkinBtn Methods
Method | Type | Description | Params

QSkinBtn Events
Event | Type | Occurs when... | Params
OnClick |  | Click on button | 0

QSkinBtn Example
$typecheck on
$optimize on
$include "Rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QSkin.inc"
$include "Object\QSkinBtn.inc"
$include "Object\QTextBtn.inc"
$include "Object\QFlashLabel.inc"
$include "Object\QVuMeter.inc"
$include "Object\QVideo.inc"

$resource img as "skin3.bmp"
$resource play1 as "play1.bmp"
$resource play2 as "play2.bmp"
$resource stop1 as "stop1.bmp"
$resource stop2 as "stop2.bmp"
$resource pause1 as "pause1.bmp"
$resource pause2 as "pause2.bmp"
$resource back1 as "back1.bmp"
$resource back2 as "back2.bmp"
$resource fwd1 as "foreward1.bmp"
$resource fwd2 as "foreward2.bmp"
$resource power1 as "power1.bmp"
$resource power2 as "power2.bmp"

declare sub quit
declare sub volume
declare sub SetVolume
declare sub open
declare sub play
declare sub stop
declare sub foreward
declare sub backward
declare sub pause
Declare Sub ShowTime(Position as long,timePos aslong)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"

Dim OpenDialog asQOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"

CREATE Form ASQSkin
Center
skin.bmpHandle=img
skin.top=-1
skin.left=-1
caption="Player"
OffsWidth=-5
create display asqpanel
top=20
left=16
width=311
height=72
bevelinner=0
bevelouter=0
color=&h994400
create bar asqpanel
top=50
left=0
width=display.width
height=2
bevelinner=0
bevelouter=0
color=color1
end create
create FlashPlay
as
QFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=2
caption="Play"
end create
create FlashStop
as
QFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=16
caption="Stop"
state=true
end create
create FlashPause
as
QFlashlabel
DarkColor=color1
LightColor=color3
left=5
top=30
caption="Pause"
end create
create FlashTime
as
QFlashlabel
DarkColor=color1
LightColor=color2
left=150
top=6
font.size=24
caption=RazClock
State=true
end create
create vu asQVuMeter
top=1
left=290
width=10
height=45
DarkColor=color1
LightColor=color2
value=50
end create
create btOpen
as
QTextBtn
UpColor=color1
DownColor=color2
left=5
top=55
font.bold=true
caption="Open"
OnClick=open
end create
create btVol
as
QTextBtn
UpColor=color1
DownColor=color2
left=265
top=55
font.bold=true
caption="Volume"
OnClick=Volume
end create
end create
create btPlay asQskinBtn
btUp.bmphandle=play1
btDown.bmphandle=play2
top=110
left=12
mode=1
OnClick=play
end create
create btStop asQskinBtn
btUp.bmphandle=stop1
btDown.bmphandle=stop2
top=110
left=44
OnClick=stop
end create
create btPause asQskinBtn
btUp.bmphandle=pause1
btDown.bmphandle=pause2
top=110
left=76
mode=1
OnClick=pause
end create
create btBack asQskinBtn
btUp.bmphandle=back1
btDown.bmphandle=back2
top=110
left=108
OnClick=backward
end create
create btFwd asQskinBtn
btUp.bmphandle=fwd1
btDown.bmphandle=fwd2
top=110
left=140
OnClick=foreward
end create
create btPower asQskinBtn
btUp.bmphandle=power1
btDown.bmphandle=power2
top=110
left=300
OnClick=quit
end create
END CREATE

CREATE Form2 ASQFORM
Caption="Volume"
Width=60
Height=190
Center
borderStyle=bsToolWindow
CREATE TbVol ASQTRACKBAR
cursor=crHandPoint
Orientation=tbVertical
Frequency=5
TickMarks=tmBoth
TickStyle=tsAuto
Left=5
Top=5
Max=0
Min=-100
Width=45
Height=150
position=-50
OnChange=SetVolume
END CREATE
END CREATE

CREATE video ASQVideo
Parent=0
volume=50
OnChange=ShowTime
timer.interval=200
BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff)
form.setdeskbar
Form.ShowModal

Sub quit
video.close
form2.close
application.terminate
End Sub

Sub volume
form2.show
End Sub

Sub SetVolume
vu.value=Abs(TbVol.position)
video.volume=Abs(TbVol.position)
End Sub

Sub open
If OpenDialog.Execute Then
video.close
if video.open(OpenDialog.FileName)then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
video.caption=GetFileName(OpenDialog.FileName)
else
showmessage
video.error
end if
end if
End Sub

Sub play
if video.FileOpen=false
then
btPlay.Down=false
else
FlashPause.flash=false
FlashStop.state=false
FlashPlay.state=true
btPause.Down=false
video.play
end if
End Sub

Sub stop
video.stop
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
btPause.Down=false
FlashPause.flash=false
FlashTime.caption=RazClock
End Sub

Function GetMinutes(seconds aslong) asstring
dim min asinteger
dim sec asinteger
dim sMin asstring
dim sSec asstring

min=seconds/60
sec=seconds mod 60
if min<10 then
sMin="0"+str$(min)
else
sMin=str$(min)
end if
if sec<10 then
sSec="0"+str$(sec)
else
sSec=str$(sec)
end if
result=sMin+":"+sSec
End Function

Sub ShowTime(Position aslong,timePos
aslong)
FlashTime.caption=GetMinutes(timePos)
If Video.State=VD_STOP then
btPlay.down=false
FlashPlay.state=false
FlashStop.state=true
end if
End Sub

Sub pause
if video.state=VD_PLAY then
video.pause
btPlay.down=false
FlashPlay.state=false
FlashPause.flash=true
else
if video.FileOpen=false
then
btPause.Down=false
end if
End Sub

Sub foreward
if (video.currentFrame+1)<video.lenght
then
video.currentFrame=video.currentFrame+1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub

Sub backward
if video.currentFrame>0 then
video.currentFrame=video.currentFrame-1
FlashTime.caption=str$(video.currentFrame)
end if
End Sub


Appendix A: QSplash

Documentation component by D.Glodt (c)2003 Appendix A: QSplash

QSplash Component

QSplash is used for showing banner during a time before the opening of application.

A descriptive text of application can be added below the image or on the image.

QSplash Properties
Champs | Type | R/W | Défault
Image | QIMAGE | R/W |
 | Image to show |  |
Text | STRING | R/W |
 | Text about application |  |
TextFont | QFONT | R/W |
TextTransparent | BOOLEAN | R/W | False
 | Display text on image |  |
TextCenter | BOOLEAN | R/W | False
 | Text centered horizontal |  |
TextLeft | SHORT | R/W |
TextTop | SHORT | R/W |
 | Actif if property TextTransparent at True |  |

QSplash Methods
Method | Type | Description | Params
Show | SUB(Time%) | Show banner | 1

QSplash Events
Event | Type | Occurs when... | Params

QSplash Example
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$INCLUDE "Object\QSplash.inc"
DECLARE SUB DisplaySplashForm
$resource banner as "banner.bmp"

Dim splash as QSplash
splash.image.bmphandle=banner
splash.TextCenter=True
splash.TextFont.size=10
splash.Text="Version 1.0 Copyright(c) D.Glodt"

CREATE MainForm AS QFORM
Caption = "MainForm"
Width = 520
Height = 340
Center
OnShow=DisplaySplashForm
END CREATE

SUB DisplaySplashForm
Splash.Show(3)
End Sub
MainForm.ShowModal


CodeBox, KBDiag,QStatusTray, QAutoEdit, QAutoComboBox etc.

 In this distribution I have included some utilities to make coding easier,
and some reeeeeeeeaaaaly coool components that run on windows!

Anyways...
All source codes are FREEWARE and provided as-is
No refund if you your remote loses its controls ;)

[Utilities]
CodeBox:
Compiler utility that uses the command line to compile your code,
with the option of running it in 3 (not 4 -cgi!) different platforms:
GUI (Windows) /CONSOLE (DOS?)/GTK (Linux).
You can include icons, compile in bytecode, and have the option of
running your applications immediately after compiling (this is not the
default).

NOTE:
CodeBox needs to be in the directory of Rapid-Q or else it won't work.

KBDIAG: (Virtual Key Checker)
Check a Virtual Key Value for your application.
Right now, it only supports Key presses, not shift, etc...

[Components]
QStatusTray:
Component that supports images and kinda looks like
a status bar seen in Internet Explorer.

QAutoEdit:
An extension of QEdit with Auto Complete!
It needs shlwapi.dll to run.

QAutoComboBox:
An extension of QComboBox with Auto Complete!
It needs shlwapi.dll to run.

QBlink:
An extension of QForm with a timer that goes off at a specified time!

QRemoteForm:
An extension of QForm that can be controlled by setting certain active
keys to virtual key codes.

In order for you to get some virtual key codes, I suggest using KBDIAG
or keys.inc for their constant values.

QRemoteObject:
An extension of QObject that was originally designed to control any
QObject, but is incompatible with some objects that do not support keys.

QDragObject:
An extension of QForm (the frame part) that can be dragged onto your form at runtime!
It is a stand-alone component and uses the mouse events.
It does not support resizing yet.
Drag and drop objects at runtime, like in Rapid-Q's IDE !

Oh yeah, OCC stands for Object Component Control, my choice of naming extensions for components!

If anyone can get QBlink to work, I would appreciate it :)
Enjoy!

-JoE


Новая страница 1

'Usage:
' first call to Ini.load([Path/FileName.ini]) Function. Parameter optional
' to get Values call to ini.Get(Section, Key, default-value) Fuction
' to write Values call to Ini.Write(Section, Key,Value) Function


RC4crypt.inc

'
' RC4crypt.inc
' (C) 2003-10-04 Martin Wehner
'
' Contact:  mailto:martin.wehner@firemail.de
' Homepage: http://mitglied.lycos.de/maweso/
'
' RC4 is a stream cipher symmetric key algorithm. It was
' developed in 1987 by Ronald Rivest and kept as a trade
' secret by RSA Data Security. On September 9, 1994, the
' RC4 algorithm was anonymously posted on the Internet on
' the Cyperpunks' Anonymous Remailers List.
' RC4 uses a variable length key from 1 to 256 bytes to
' initialize a 256-byte state table. The state table is
' used for subsequent generation of pseudo-random bytes
' and then to generate a pseudo-random stream which is
' XORed with the plaintext to give the ciphertext. Each
' element in the state table is swapped at least once. The
' RC4 key is often limited to 40 bits, because of export
' restrictions but it is sometimes used as a 128 bit key.
' It has the capability of using keys between 1 and 2048
' bits.
' Analysis shows that the period of the cipher is
' overwhelmingly likely to be greater than 10^100. Eight
' to sixteen machine operations are required per output
' byte, and the cipher can be expected to run very quickly
' in software. Independent analysts have scrutinized the
' algorithm and it is considered secure. RC4 is used in
' many commercial software packages.
'
' The type definition below is an adaptation of the RC4
' algorithm to RapidQ Basic. If you want to use this
' component then you must first create an object of type
' QRC4. After that you must call the procedure Init() to
' initialize the object with the key. If you now call the
' function Pipe() with a string then the string is encoded
' and returned by the function.
' If you want to decode then simply execute the same steps
' again but call the function Pipe() with the encoded
' string.
' This component can process data streams. Encode or
' decode data streams by calling the function Pipe() for
' each stream element. You are free with the size of the
' data packets because (Pipe(s) & Pipe(t)) is always equal
' to Pipe(s & t).
'
' Example:
'   $INCLUDE "RC4crypt.inc"
'   DEFSTR k = "1234567890"   ' This is the key
'   DEFSTR s = "abcdefghijklmnopqrstuvwxyz"
'   DEFSTR t = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
'   DIM rc4 AS QRC4
'   rc4.Init(k)   ' Initialize RC4 object with the key
'   s = rc4.Pipe(s)   ' Encode stream element s
'   t = rc4.Pipe(t)   ' Encode stream element t
'   rc4.Init(k)   ' Initialize RC4 object with the key again
'   ShowMessage(rc4.Pipe(s & t))   ' Concatenate and decode
'
' DISCLAIMER: ABSOLUTELY NO WARRANTY IS GIVEN FOR THIS
' COMPONENT! USE THIS TYPE DEFINITION AT YOUR OWN RISK!
'

TYPE QRC4 EXTENDS QOBJECT
  PRIVATE:
    stateTable(256) AS BYTE
    randomIndex AS BYTE
    i AS LONG
    j AS LONG
    k AS LONG
    n AS LONG

  PUBLIC:
    SUB Reset
      FOR QRC4.i = 0 TO 255
        QRC4.stateTable(QRC4.i) = QRC4.i
      NEXT

      QRC4.i = 0
      QRC4.j = 0
    END SUB

    SUB Init (key AS STRING)
      QRC4.Reset

      QRC4.n = LEN(key)
      IF 0 < QRC4.n THEN
        FOR QRC4.i = 0 TO 255
          QRC4.k = (QRC4.i MOD QRC4.n) + 1
          QRC4.j = (QRC4.j + QRC4.stateTable(QRC4.i) + ASC(key[QRC4.k])) AND 255
          SWAP QRC4.stateTable(QRC4.i), QRC4.stateTable(QRC4.j)
        NEXT

        QRC4.i = 0
        QRC4.j = 0
      END IF
    END SUB

    FUNCTION Pipe (str AS STRING) AS STRING
      result = ""

      QRC4.n = LEN(str)
      FOR QRC4.k = 1 TO QRC4.n
        QRC4.i = (QRC4.i + 1) AND 255
        QRC4.j = (QRC4.j + QRC4.stateTable(QRC4.i)) AND 255
        QRC4.randomIndex = (QRC4.stateTable(QRC4.i) + QRC4.stateTable(QRC4.j)) AND 255
        SWAP QRC4.stateTable(QRC4.i), QRC4.stateTable(QRC4.j)

        result = result & CHR$(ASC(str[QRC4.k]) XOR QRC4.stateTable(QRC4.randomIndex))
      NEXT
    END FUNCTION

  CONSTRUCTOR
    Reset
  END CONSTRUCTOR
END TYPE


RQDP - FAQ

RapidQ Documentation Project

Frequently Asked Questions

General questions

  • Virus warning
  • How to minimize an application to the task bar
  • How to put your application icon into the system tray area.
  • I need to get the desktop folder on Win98/2000
  • I would like to know how to put a bitmap in the ClipBoard
  • I was wondering if anyone knows how to find the window/application handle
  • Is there some way in rapidqQ that I could connect to the internet?
  • How to setFocus for rapidq QEdit???
  • Here are two RapidQ applications exchanging data
  • HOWTO Include ASM routines in RapidQ?
  • Could someone send me a working example of how to create a custom event?
  • I'm trying to set a richedit up to delete a line by pressing Ctrl+Y
  • Does anyone know how to create a parent property for a custom component?
  • a custom OnShow event for our component!
  • How to click buttons/icons in other programs
  • About OLE

About RapidQ compatibility with Windows ?
How do I change the Explorer icon for my program?
How do I change the minimised Icon for my program?
Is RapidQ still under development?

Sub not returning value through parameters, as in QuickBasic.

Reserved links

  • bitmap
  • caret
  • clipboard
  • console
  • cursors
  • devices
  • dialogs
  • directories
  • direct3d
  • directx
  • dll
  • editor
  • exit
  • files
  • find
  • focus
  • forms
  • graphics
  • grids
  • html
  • IDE
  • keyboard
  • listbox
  • listview
  • menu
  • mysql
  • ole
  • popup
  • printer
  • registry
  • richedit
  • shell
  • sockets
  • sound
  • strings
  • syntax
  • text


RQDP - Bugs in RapidQ

Bug Reports

  • http://pub35.ezboard.com/frapidqbasicbugreports

QLISTVIEW
1. ColumnsCount INTEGER (Bug - always -1)
OnColumnClick SUB (Column%) Column header was clicked
This sub is bugly! Always return 0 in Column% See example2 to solve this problem

'Could someone explain me this one ?
'---------------------------------------------
dim form as qform
form.center
dim edit(1) as qedit
for i = 0 to 2
edit(i).left = 10
edit(i).parent = form
edit(i).top = (40 * i)
edit(i).text = "Edit_" + str$(i)
next
form.showmodal
'---------------------------------------------
'So, when I say:
'Dim edit(1) as qedit
'I make an array of QEDITs with 2 elements:
'Edit(0)
'Edit(1)

'Isn't it ? But why can I make Edit(2) too ?
'Note: if you write for i = 0 to 3
'you'll get an access violation....
'where's the trick ?!?!?
'Trenchtownman <trenchto...@yahoo.it>

____________________________________
You are very right. I have tried you example with 3, 4, 5 and 6.
Each time, rapidQ creates one more instance than asked (ie it seems
taht when you "dim edit(x)", rapidQ creates instances from 0 to x+1).
Very curious, indeed !?
Pascal Delcombel <pascalde....@yahoo.fr>
_____________________________________

RAPIDQ dont like comments on line containing "\\" or "\", compiler reports
an error and there is none. Juste remove the comment and then it will works.

RAPIDQ BUGS WITH NESTED TYPES

Subs and functions

1. UBOUND/LBOUND not works properly with array passed in function as parameter.
Always return UBOUND/LBOUND of first Dimmed array. (Example 1a)
But in SUB it's all right! (Example 1b)

Example 1a **************************************************

function ArrBug (D!() as single ) as single
    defint MaxE=0,MinE=0, p
    MaxE = UBOUND(D!): print "in function MaxE=" ,MaxE
    MinE = LBOUND(D!):  print "in function MinE=" ,MinE
END function '--- --------------------------------------'

defint MaxEl=0,MinEl=0, p

DefSng dateTime(1 To 5) = { 1, 2, 3, 4, 5}

MaxEl = UBOUND(dateTime): print "MaxEl=" ,MaxEl
MinEl = LBOUND(dateTime): print "MinEl=" ,MinEl
print "  "
FOR p = MinEl TO MaxEl:print "dateTime(",p,")=",dateTime(p)  : NEXT p

print "---"

DefSng dT(4 To 8) = { 11, 12, 13, 14, 15, 12, 31, 41, 51, 21, 23, 24, 25, 22, 32, 42, 52, 32, 33, 44, 45, 42, 43, 46, 56, 27, 73, 74, 75, 72, 83, 84, 85, 82, 83, 84, 85}

MaxEl = UBOUND(dT): print "MaxEl=" ,MaxEl
MinEl = LBOUND(dT): print "MinEl=" ,MinEl
print
FOR p = MinEl TO 12  :print "dT(",p,")=",dT(p)  : NEXT p

DefSng arg23!(0 to 9) ={10, -100, 20, 30, 40, 50, 60, 70, 80, 90}
print "---"

MaxEl = UBOUND(arg23!): print "MaxEl=" ,MaxEl
MinEl = LBOUND(arg23!): print "MinEl=" ,MinEl
print
FOR p = MinEl TO MaxEl:print "arg23!(",p,")=",arg23!(p)  : NEXT p

print
a= ArrBug (dateTime)
call ArrBug arg23!()
call ArrBug (dT )

Example 1b ************************

sub ArrBug (D!() as single )
    defint MaxE=0,MinE=0, p
    MaxE = UBOUND(D!): print "in function MaxE=" ,MaxE
    MinE = LBOUND(D!):  print "in function MinE=" ,MinE
    print
END sub '--- --------------------------------------'

defint MaxEl=0,MinEl=0, p
DefSng dateTime(1 To 5) = { 1, 2, 3, 4, 5}
MaxEl = UBOUND(dateTime): print "MaxEl=" ,MaxEl
MinEl = LBOUND(dateTime): print "MinEl=" ,MinEl
print "---"

DefSng dT(4 To 8) = { 11, 12, 13, 14, 15, 12, 31, 41, 51, 21}
MaxEl = UBOUND(dT): print "MaxEl=" ,MaxEl :
MinEl = LBOUND(dT): print "MinEl=" ,MinEl

DefSng arg23!(0 to 9) ={10, -100, 20, 30, 40, 50, 60, 70, 80, 90}
print "---"
MaxEl = UBOUND(arg23!): print "MaxEl=" ,MaxEl :
MinEl = LBOUND(arg23!): print "MinEl=" ,MinEl

print
call ArrBug dateTime
ArrBug (dT )
ArrBug arg23!()

Array
1. Not testing out of range array Index. (Example 2)

Example 2 ******************************************************

DefSng dateTime1(3)
dateTime1(7000000)=2354
print "dateTime1(7000000)=",dateTime1(7000000)

2. Ubound\Lbound not working properly with array's names ended by %, ! ets.

BUG !!

DIM A%(-50 TO 100) AS INTEGER
L% = UBOUND(A%) '-- Returns 0

'Take a breather. Here's something funny (well, almost).

'Did you know that you can prevent a form from closing when the X button
'is clicked if your form.caption were just 4-5 characters long?

'Strange but true:
DECLARE SUB Strange

CREATE Form AS QFORM
Caption = "12345"
OnClose = Strange
ShowModal
END CREATE


RQDP - Integrated Development Environments

RapidQ Documentation Project

Reviews: Integrated Development Environments (IDE) for RapidQ

Overview
  • RqWork
  • EasyRQ
  • CodeEdit
  • Jens' File Editor
  • RQ Debugger IDE
  • Basic IDE
  • Eduardo
  • RapidQ Basic IDE
  • Hellionor
  • Serban Stanescu IDE
  • RQProject

RqWork

RqWork 4.9.8.100. Jul 2004.
  • Visual form editor
  • Fast syntax hilight
  • Project tree
  • Object inspector

    Nastase Eodor, Galati, A.Saligny 34, 6200, Romania

EasyRQ

http://home.planet.nl/~water793/
A free IDE for the rapidq compiler

Last update August 2004

mailto:byteshaper@hotmail.com
easyrq.zip Size screenshot

Features:
Syntax highlighting
Objecttree & search
Search at remark,object and sub
Some trace obtions
Reverse engeneering of forms using the formeditor
Statusbar with firstvisible line counter
Preserving unknown objects (extended types) during the form editing process.

CodeEdit

CodeEdit

"CodeEdit started out as a semi-visual editor entitled “RapidQWorks” but was changed after downloading the CodeSense.bas program written by Dreadsoft® Corporation dreadsoft@yahoo.it that laid the groundwork for CodeEdit.

In this version you can create RapidQ objects from Forms to Sockets and just about everything else. Many of the methods listed for each object were designed for use in Subs and Functions, but for reasons of clarity were included in the design phase."

Created by Danny Jackson
With special thanks to my good friend: Dreadsoft? Corporation (manco un diritto riservato) dreadsoft@yahoo.it
Without whoose help and friendship this program would not have happened

Jens' File Editor

Jens' File Editor -The Ultimate Editor for programmers
Very much thanks to L. and A. Oppenheim at School of IT, Swinburne University, Australia for the work of translating from German to English.

JFE was always quite usable. Without any documentation however, it was commonly found that it was not possible to make use of the inexhaustible possibilities provided by the editor. Now finally a remedy is at hand. However, only the important things which differentiate this editor from others will be described.

The current version here V 3.81 To Jens' Home page
  • Editing Blocks
  • Colour Management
  • Syntax Highlighting
  • Printing
  • Search Functions
  • Bookmarks
  • Special Settings
  • Tool Menu
  • Autobrowser
  • Special Operations
  • HTML Project file
  • A typical template for an HTML project
  • Work areas (Projects)
  • The Context Menu
  • Macros
  • Function keys
  • Other

RQ Debugger IDE

RQ Debugger IDE v.04b b.178
01.2005 Andrew Shelkovenko
1. It's beta version! No warranties!.. as is .. etc.
2. Debugger not working, Form designer not working.

Main features:
- multiwindow (pseudo ;-).
Open 32 files and switch to one using "Windows" menu item.
- named bookmarks. You can set 32 bookmarks in every window
- Projects
You can save collection of Windows and bookmarks as Project.
- Subs\Function list

BASIC IDE

***********************
* BASIC IDE 0.2.6.8 *
***********************
Contact Information
Taj Morton (programmer): tmorton@linuxmail.org
Webpage: http://basic-ide.sourceforge.net
Sourceforge homepage: http://sourceforge.net/projects/basic-ide
Source code in Pascal is available.

Eduardo

Eduardo is freeware.
Copyright (c) 2004
Achilles B. Mina
Eduardo is a source-code editor written in Rapid-Q, a compiler-interpreter developed by William Yu.

Eduardo was designed specifically for Rapid-Q and HotBasic, the former's super-duper hermano.

RAPID-Q Basic IDE

RAPID-Q Basic IDE version 0.01
Author : Pairat MSU Thailand
This project can.

1. Support files : 100 files
2. Object component
3 Object is born Label , Edit , Button2
4. Object can be move and resize
5. properties not active
6. Maximum form = 100
7. Code generate not active.
8. other ..... Look VIDE source

future................ you should be developed it, and post
Source files: http://groups.yahoo.com/group/rapidq/files/Vide.zip
it is begining to develope. not complete ,but you con modifies and add othores object.
pairat.

Hellionor IDE

Hellionor IDE
http://www.rapidq.it/
Scarica la Hellionor IDE 1.5.0 (ALPHA) - 2.7 Mb
 Not complete. Source code available

Serban Stanescu IDE

Serban Stanescu IDE
Not complete. Source code available 		sserbanro 07/13/2003

RQ Project

RQ Project

RQ Project allows the creation and the compilation of a project.
A project consists of a source program BASIC, of an icone of application, options of compilation, files BASIC included and files resource.
The application compiled can be execute with or without debugage console.


RQDP - Links & Examples

RapidQ Documentation Project

Links & Examples

Official Site

  • Rapid-Q Official Site
    • Files section

Rapid-Q related discussion groups

  • Rapid-Q
  • rapidq_works
  • RapidQProjects
  • QLabs
  • Rq-ide
  • SeriousRapidQ
  • bpp-translator
  • hotbasic
  • codemax
  • Dev-RapidQ
  • envelopbasic
  • realbasichangout
  • ezboard-rapidqbasic

Useful examples

  • RQDP more_examples
  • asm.zip - 260 k
  • aYliteBeta.zip - 23 k
  • bpp.zip - 1000 k
  • Database.zip - 1800 k
  • Internet.zip - 140 k
  • more_examples.zip - 700 k
  • rqdlls.zip - 650 k
  • RQTiny.zip - 45 k
  • Win32API_Rel.zip - 70 k
  • editor.zip - 230 k
  • comport.zip - 60 k
  • media.zip - 115 k
  • ole.zip - 120 k
  • reminder.zip - 62 k

Guidance's Site

  • Guidance Laboratory Inc - (mirror, seems faster)
    • Examples
    • Documentation
    • External Libraries
    • Rapid-Q Introduction
    • Resource & Utility
    • Tutorial

Links from Guidance's Rapid-Q Resource Site (dead links cleaned)
Guidance's Rapid-Q Resource Site:
 g.yi.org or a.2myip.com
g.slyip.com or citymap.126.com Yahoo! Groups RapidQ William Yu's Official RapidQ Page RapidQ Ezboard Discussion Forum RapidQ Reference, Source Code Italian RapidQ Page RapidQ ...Or XBasic?

Other links
 http://home.planet.nl/~water793/
http://j.lypstenger.free.fr/

Examples and snippets

  • basicguru
  • Yahoo rapidQ Files
  • Yahoo rapid-Q Files
  • MoreExamples
  • http://home.planet.nl/~water793/ - more examples


Rapid

Rapid-Q Documentation Project (RQDP) | Release 05/01/2005
Author/Revision/Release | Serban Stanescu (modified by Andrew Shelkovenko)

Rapid-Q Documentation Project (RQDP) |
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | faq001.html/Andreas Fink/Serban S./01

----Preface
a) The Rapid-Q Documentation Project, RQDP
a.1.) The beginning
a.2.) The next step
b) Preface (Original release, by Wiliiam Yu)
c) RQDP Hystory

Preface

This preface consists of three sections:
a) The new section, which is a review of the Rapid-Q Documentation Project (RQDP);
b) The original preface, written by compiler's author, William Yu, as it was last updated, on August 29, 2000.
We think we owe this to the author, no matter what happened since then: he made all this possible. And, (why not?) maybe someday, he will take a look at his "child".
c) The Hystory of the Rapid-Q Documentation Project (RQDP) ;

a) The Rapid-Q Documentation Project (RQDP)
by Stanescu Serban, june, 10, 2001

a.1. The beginning

This Project has been born at the end of April 2001, as a need of my own: when I discovered the Rapid-Q on the NET, obviously, one of the first steps was to read the docs, to see what is all that about.
The original documentation, is a pretty good start -I said- but where is the rest of the stuff? Well, at this point, I came to realise a thing that all the Group knows: no further documentation, no other improvements, no nothing.
When I read a certain mail from Group's archive, I was so disappoited, that I wanted to unsubscribe the Group, and move to something else.
But...
It happened so, that in those days, my mailbox was almost flodded with mails from the Group... After a few days, I came to realise that Rapid-Q is not any more a program, or a compiler, or ... sort of that. No, sir!
Rapid-Q is a spirit!
We belive that the Rapid-Q Spirit, is something which cannot be described (maybe I'm not that good at this point), defined, but makes the things go...
We didn't have all we wanted. We still don't. But here we are! And WE ARE!
We are working, and we like what we do. We all hope this project will grow enough to meet your needs, at least at some certain level. (We can't please everyone. Nobody does, except for God)

Up

a.2. The next step

We are not far from the beginning, still...
There are lots of things to do. We can't cover all of them for now though. This is why the "RapidQProjects" group was founded. One of the main goals of this group, is to gather together all the ideas, all the trouble and all the solutions we found using Rapid-Q.
That is not an easy task, but what a waste would be, if nothing is done.
There are already two1 Rapid-Q Groups:
Rapidq, the original group, founded by William Yu, which is some sort of a Lab, where we do all sort of things: exchange sorce code, ask questions, find answers. Sometimes, we argue, on no matter what. But we're humans afterall, aren't we?
RapidQProjects, a newer group, where we try to join our efforts in projects like this.
The goals of this project - Rapid-Q Documentation Project (RQDP) - , are to build a good documentation, at maximum possible extent:
-a.2.1. Improove the original documentation, with navigation capabilities (working on it!), since it's really a headache if you want to get fast to a certain subject;
-a.2.2. Add new sections, such as:
-new pages with more detailed explanations on various issues, many examples, to help the new ones to build faster small applications and, of course, the more experienced to speed up development of larger projects;
-some sort of a programmer's guide: we'll try to join in this section the experience of all group members, consisting in solutions, sorce code, small applications, step by step apps development ... you name it!
We'll try to follow the "Cut & Paste" philosophy, as much as possible.
Since this project is no older than one month (at 10th June 2001), we haven't covered much of all this. There's a hard working time ahead, but a "Release 1" of the RQDP can be expected this month, maybe next days.
One of the goals we have to reach is the update of the official site,

www.basicguru.com

This hasn't been updated for a (too) long time already, and we aren't dead...
With all this said, one more thing to add: for any requests on "Rapid-Q Documentation Project" , any ideas, contributions, anything valuable for the development of the project, you can mail me at the

RapidQProjects@yahoogroups.com or at

rapidq@yahoogroups.com.

There is no FAQ section yet, but this won't be so for any longer. Waiting for your questions, at the above adresses.

1 Actually, there are three groups: "RAPIDQ" - The Main Group , Andreas Fink's "RapidQ FAQ Project" , and the youngest, "RapidQProjects" - Serban Stanescu's for Rapid-Q Documentation Project. (Sorry for the mistake... :) -Serban S.)

Back to note 1

Up


Appendix A: QREGISTRY

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QREGISTRY

QREGISTRY Component

QRegistry encapsulates functions that operate on the Window's system registry.
(*)  Registry is composed of Keys and SubKeys. Each Key and SubKey
(*)  can containone or more variables named Values. These Values
(*)  have a ValueName and a ValueData.
(*)  Example :
(*)    Key HKEY_CLASSES_ROOT .Bas\Shell\Open\Command
(*)    contains a Default value who's ValueName is "" and whose
(*)    value is "C:\Rapidq\RapidQ.Exe %1"
(*)    ValueName maybe "AnyName". The default ValueName is ""
(*)  The Registry can be edited with Regedit.Exe or regedt32.Exe

QRegistry Properties
Field | Type | R/W | Default
CurrentKey | INTEGER | R
CurrentPath | STRING | R
(*)GetDataSize(ValueName$) | INTEGER | R
(*)GetDataType(ValueName$) | INTEGER | R
HasSubKeys | INTEGER | R
KeyItemCount | INTEGER | R
ValueItemCount | INTEGER | R
RootKey | INTEGER | RW | HKEY_CURRENT_USER

QRegistry Methods
Method | Type | Description | Params
CloseKey | SUB | Closes opened key | 0
CreateKey | FUNCTION (Key$) AS INTEGER | Creates a new key in CurrentPath. | 1
DeleteKey | FUNCTION (Key$) AS INTEGER | Deletes key. | 1
DeleteValue | FUNCTION (ValName$) AS INTEGER | Deletes a value data. | 1
KeyExists | FUNCTION (Key$) AS INTEGER | Returns 0 or 1 if key exists. | 1
KeyItem | FUNCTION (Index%) AS STRING | Retrieve the names of the subkeys | 1
MoveKey | FUNCTION (OldKey$, NewKey$, Delete%) | Moves existing key, subkeys, and data values. | 3
OpenKey | FUNCTION (Key$, CanCreate%) | CanCreate specifies whether to create the specified key if it does not exist. | 2
(*)ReadBinary | (*)FUNCTION (ValueName$, Index%) AS BYTE | Return binary value of specified key(Bug : Index must Start at -1) | 2
(*)ReadFloat | FUNCTION (ValueName$) AS DOUBLE | Return double value of specified key | 1
(*)ReadInteger | FUNCTION (ValueName$) AS INTEGER | Return integer value of specified key | 1
(*)ReadString | FUNCTION (ValueName$) AS STRING | Return string value of specified key | 1
RegistryConnect | FUNCTION (CompName$) AS INTEGER | Establishes connection to another computer's registry. | 1
RenameValue | (*)SUB (OldValueName$, NewValueName$) | Renames existing data value. | 2
ValueExists | FUNCTION (ValueName$) AS INTEGER | Returns 0 or 1 if data value Value$ exists. | 1
ValueItem | FUNCTION (Index%) AS STRING | Retrieve the names of the data values | 1
WriteBinary | (*)SUB (ValueName$, BYTE(), Size%) | Write Array of BYTEs in the specified key | 3
WriteFloat | (*)SUB (ValeName$, ValueData#) | Write double value in the specified key | 2
WriteInteger | (*)SUB (ValueName$, ValueData&) | Write integer value in the specified key | 2
WriteString | (*)SUB (ValueName$, ValueData$) | Write string in the specified key | 2
(*) Notes :
(*)    - READ and WRITE requires the mother KEY to be OPENED first with OpenKey(Key)
(*)    - WRITE subs Create ValueName if it does not exist
(*)    - MOVEKEY sets undefined ValueDatas of String type to "", which can be a problem.
(*)      MOVEKEY with Delete% set to one is like renaming a key.

QRegistry Events
Event Type Occurs when... Params

QRegistry Examples
'  Detect if your computer is connected to the internet

Const HKEY_LOCAL_MACHINE = &H80000002

DIM Registry AS QRegistry

Registry.RootKey = HKEY_LOCAL_MACHINE
Registry.OpenKey("System\CurrentControlSet\Services\RemoteAccess", 0)

'(index was 0 originally, but due to ReadBinary bug it must be -1)
IF Registry.ReadBinary("Remote Connection", -1) = 1 THEN
  ShowMessage("You're connected!")
ELSE
  ShowMessage("You're not connected!")
END IF
Registry.CloseKey '(*)
(*) Lines corrected in april 2004


RQDP-AS Keyword

Rapid-Q Documentation Project (RQDP) | Release 01 AS Keyword
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | askeyword.html/Serban Stanescu/None/01

1. Syntax
2. AS Keyword context usage
3. Examples
AS Keyword

1. Syntax:

[statement],[varname] AS [vartype]

[statement] = any valid statement (see list below);
[varname] = variable name;
[vartype] = any supported variable type;

2. The AS keyword is used in these contexts:

a) Dim Statement
b) Declare Statement
c) Create Statement
d) Sub/Subi Statement
e) Function/Functioni Statement
f) Type Statement

3. Examples:

DIM Form AS QForm

FUNCTION Example AS Integer
END FUNCTION

SUB Example3(var1 AS Long)
END SUB

TYPE
Text AS String
TrackVar AS Variant
END TYPE

DECLARE SUB Test LIB "TEST.DLL" ALIAS "MyFunc" (S AS STRING)

CREATE MyMenu AS QMenuItem
END CREATE

Up

Index Contents Up Next page


RQDP-AS Keyword

Rapid-Q Documentation Project (RQDP) | Release 01 AS Keyword
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | askeyword.html/Serban Stanescu/None/01

1. Syntax
2. AS Keyword context usage
3. Examples
AS Keyword

1. Syntax:

[statement],[varname] AS [vartype]

[statement] = any valid statement (see list below);
[varname] = variable name;
[vartype] = any supported variable type;

2. The AS keyword is used in these contexts:

a) Dim Statement
b) Declare Statement
c) Create Statement
d) Sub/Subi Statement
e) Function/Functioni Statement
f) Type Statement

3. Examples:

DIM Form AS QForm

FUNCTION Example AS Integer
END FUNCTION

SUB Example3(var1 AS Long)
END SUB

TYPE
Text AS String
TrackVar AS Variant
END TYPE

DECLARE SUB Test LIB "TEST.DLL" ALIAS "MyFunc" (S AS STRING)

CREATE MyMenu AS QMenuItem
END CREATE

Up

Index Contents up Next page


RQDP-CHDRIVE

1. Syntax
2. CHDRIVE context usage
3. Examples
CHDRIVE Function

1. Syntax:
Rapid-Q Documentation Project (RQDP) | Release 01 CHDRIVE
Credits & Contributions: Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | chdrive.html/Serban Stanescu/None/01

CHDRIVE [drivepath]

[drivepath] = String. You have to pass the argument to the function. You have to use CHDRIVE function with caution, since certain drives are removable type. Changing the current drive to a device which has no media inserted, will fail into an error.

2. The CHDRIVE function context usage.

The CHDRIVE function is used to change the current drive. Useful mainly in applications where you need file manipulation, data exchange on different drives...
This is supposed to be used with certain precautions, since you may change drive to a removable type, which might not have media inserted. You have to perform the function call, AFTER testing the drive's media. Something like this
        If TestDriveResult("X:")=Failure Then
          TreatErrors TestDriveResult("X:")
        Else
          CHDRIVE "X:"
        End If
In this example, we used "TreatErrors TestDriveResult("X:")" which is a simultaneous call of 2 functions: TestDriveResult("X":) - where "X:" is any removable type drive as assigned by the system, and TreatErrors- the error trapping routine. We use the second to test the drive, and if we succeed, we pass the result to CHDRIVE, else, we pass the result to the Error trapping function. (I didn't say we have those functions! It's just an example!)

3. Examples:

CHDRIVE "C:"

         DIM mypath AS String
         '...............................
         mypath=GetMyDrivesPath(...)
         CHDRIVE mypath

         '...............................

Up

Index Contents Up Next page


Code Contributors

Many thanks to all beta testers and code contributors! Apologies to all contributors who have sent their code to me but doesn't appear on this list. I also maintain the All Basic Code Archives, so sometimes I get my files mixed, and my mailbox is pretty much chaos.

    DVBQPSK.BAS

      DVB QPSK a MPEG QPSK Calculator by E.J. Livaditis

    CLOSEQ.ZIP

      Custom form with flat close button by Jernej Simoncic

    POKRSLOT.ZIP

      Slot Machine Simulator by Steven Edwards

    QARROW.ZIP

      QArrow Button-like component by Peter Scheutz

    COMPUTEROFF.ZIP

      Shutdown timer by Justin Gartin

    AVIPLAYER.ZIP

      An AVI player by Peter Scheutz

    MAILER.BAS

      SMTP Express Mailer by Wolfgang Kempin

    SCREENSAVER.BAS

      Screen Saver Example by Erlend Rovik

    QMANDEL.BAS

      QMandel Component by Erlend Rovik

    QDRIVECOMBO.BAS

      QDriveCombo Component by Erlend Rovik

    MARTIN.BAS

      Martin Fractals by Jernej Simoncic

    QMORP.BAS

      TicTacToe Variant by Sylvain Bizorre

    3DCUBE.BAS

      3D rotating cube by Erlend Rovik

    BIZARRE.INC

      QComponents for Rapid-Q by Erlend Rovik

    RAY1.BAS

      Raycaster (not functional at this point) by Erlend Rovik

    BLOCKS.BAS

      Blocks game by Antoni Gual

    BLOCKS2.BAS

      Blocks game (Linux version) by Antoni Gual

    RAYC.BAS

      Working Raycaster (Win32/Linux version) by Antoni Gual

    RAYCAST.BAS

      Raycaster with DirectX by Antoni Gual

    MONTHDAY.BAS

      Puts month day in statusbar by John Davenport

    WEEKDAY.BAS

      Day of the week by John Davenport

    TIME.BAS

      Using QTimer and QLabel to display time by John Davenport

    CALENDAR.BAS

      Desktop calendar by John Davenport

    DARK.ZIP

      Dark Towers (Puzzle game) by John Davenport

    RQMAKE.ZIP

      Rapid-Q make utility by Louis Pizzuti

    RQLINCLUDES.ZIP

      CGI include files by Nick Ruisi

    WINHILO.BAS

      Windows HI-LO game by Steven Edwards

    SCRSAVER.BAS

      Screen saver example by Steven Edwards

    CGI.INC

      Updated CGI include file by Nick Ruisi

    VECTOR.ZIP

      Vector fonts by Dennis V. Buyan

    QFSPLITTER.BAS

      File splitter program by Mesut Akcan

    FRAMES.ZIP

      Frames and Beats Calculator by Bryn Mosher

    USING.BAS

      PRINT USING$ function by Antoni Gual

    RAPIDQ_BOOSTA.BAS

      Front-end for .BC files by Gerome Guillemin

    QHASH.BAS

      QHash component by Daitau Aaron

    RGBV11.ZIP

      Color palette by AiKi2000

    ANI.ZIP

      Animated cursors by Alejandro Damico

    SBBAS.ZIP

      Sound blaster osciloscope by Rudy Elyn

    QSPINTEXT.BAS

      A Spin Edit control by Mesut Akcan

    QTOOLBAR.ZIP

      QToolBar control by Jordi Ramos

This page maintained by William Yu ©1999-2000


 COMPORT Component
Version 0.9
December 13, 2001
by Pete Kleinschmidt - petek1827@yahoo.com

This COMPORT Component implements some of the functionality of the missing QCOMPORT Component. It uses
the WIN32 API and does not require any additional dlls. Simply add the line
$INCLUDE "COMPORT.CMP"
to the top of your project and go.

Please note that the COMPORT Component was developed for a small in-house application. As
a result it has not been extensively tested. It currently seems to work well on my system (Win98SE)
but I cannot guarantee that it will work for others. Use at your own risk.

There are three files included in this package.

COMPORT.CMP This is the file that implements the COMPORT Component
PORTAPP.BAS This is a small application that demonstrates using the COMPORT Component
README.TXT Your reading it.

Properties
Field | Type | R/W | Default | Description
Handle | LONG | R | - |
Port | STRING | RW | "COM1" |
BaudRate | DWORD | RW | 9600 |
DataBits | BYTE | RW | 8 | number of bits/byte, 4-8
Parity | BYTE | RW | 0(NOPARITY) |
StopBits | BYTE | RW | 1 |
ReadBufSize | DWORD | RW | 1024 |
WriteBufSize | DWORD | RW | 1024 |
BytesNotRead | DWORD | R | 0 | number of bytes received but not yet read
BytesNotWritten | DWORD | R | 0 | number of bytes remaining to be transmitted
Connected | BYTE | R | 0(FALSE) |

Methods

Name | Type | Description
Open | SUB | Opens Communication Port
Close | SUB | Closes Communication Port
WriteString | SUB WriteString(Str$, Wait AS Dword) | Writes a string to a Communications Port Wait time is in milliseconds
ReadString | FUNCTION (dwRdSize AS DWORD, Wait AS Dword) as String dwRdSize AS DWORD | Returns a string representation of data read from a Communications Port Wait time is in milliseconds

Events

Name | Type | Occurs when
OnOpen | SUB | Com Port is successfully opened
OnClose | SUB | Com Port is successfully closed
OnWriteString | SUB | Data successfully written to Com Port
OnReadString | SUB | Data successfully read from Com Port
OnComError | SUB(ErrorMessage AS String) | An error occurs

Before you begin trying to work with this component I recommend that you make sure you can
communicate with your target device using a terminal program. Make sure you understand what
settings your device requires and what commands it expects. There are probably dozens of these
programs at your favorite shareware site.

This component currently does not have the ability change flow control settings (Hardware, Xon/Xoff, etc).
When a port is opened it should default to whatever flow control settings were last used to open
the port or to the default settings. Implementing it should not be difficult if you have a good handle on how
flow control works. It should only involve changing some of the Device Control Block (DCB) settings
the same way I currently change Baud, Parity, etc. Deciding which ones and in what order would be
the tricky part. The following docs may help you out.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/hardware/commun_2pf7.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwbgen/html/msdn_serial.asp

Please Do not email me asking for help on how to use this component. Post your questions
to the discussion board. I really wish I had the time to help you, but I don't. Bug reports
are welcome.


Appendix C: Conditions

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Conditions

Introduction to Condition Statements

Conditional statements offer the ability to execute code for which the condition is satisfied. This is probably one of the first things you learn in programming, besides the usual.

IF .. THEN .. ELSE
There are 2 ways to use IF .. THEN .. ELSE. You can place your statement on one single line like so:
    IF I > 100 THEN PRINT "I is greater than 100"
Or split it up like so:
    IF I > 100 THEN
      PRINT "I is greater than 100"
    END IF
As you can see, I > 100 is a condition, as long as this is satisfied, the code gets executed, if not then that piece of code is skipped. A condition is satisfied whenever the expression evaluates to any non-zero number. Which also means that this is valid:
   I = 100
   IF I THEN
     PRINT "Condition satisfied"
   ELSE
     PRINT "Condition is not satisfied"
   END IF
Use ELSEIF whenever you have multiple conditions that you want satisfied:
   IF I > 10 AND I < 20 THEN
      '' do stuff
   ELSEIF I > 55 THEN
      '' do stuff
   ELSE
      '' do stuff
   END IF
Sometimes it helps to use SELECT CASE instead of all these ELSEIFs, which we'll cover next.

SELECT CASE .. END SELECT
Select cases are usually implemented when you have a lot of conditions that you want to test for. It's really not useful if you only have 2 or 3 conditions, but no one's stopping you from using it. There are no special cases in using SELECT CASEs in Rapid-Q, so everything you learned in QBasic, can be implemented here as well.
    SELECT CASE Expression
      CASE 1
        '' Do stuff
      CASE 5
        '' Do stuff
      CASE ELSE
        '' No conditions satisfied, do stuff
    END SELECT
It probably involves less typing, but there are many other useful purposes, for example, range testing becomes so much easier:

    SELECT CASE Expression
      CASE 1 TO 4, 10 TO 20
        '' Do stuff
      CASE 100 TO 150
        '' Do stuff
      CASE IS > 200
        '' Do stuff
    END SELECT
As you can see, you can have multiple test conditions by separating each with a comma. I think you can figure out how the IS keyword is used.


Appendix C: Console keywords

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix C: Console Keywords

Console Keywords

Please note that it's possible to use some Console statements in Linux/Unix even if you compiled your program as GUI. However, this is not possible under Windows. The console statements allowed in Linux/Unix without having to compile as CONSOLE are: CLS, PRINT, and INPUT. SLEEP can also be used without consequences.

Keyword / Support/ Usage /Description

CLS / Windows/Unix

CLS
Clears console screen
COLOR / Windows Unix

COLOR [Fore%][, Back%]
Sets current color attribute, you can ignore either one of the parameters

CONSOLE.INPUTHANDLE / Windows

hnd = CONSOLE.INPUTHANDLE
Returns the console input handle

CONSOLE.OUTPUTHANDLE / Windows

hnd = CONSOLE.OUTPUTHANDLE
Returns the console output handle

CSRLIN / Windows Unix

CurRow% = CSRLIN
Returns current row of cursor

INKEY$ / Windows Unix

A$ = INKEY$
Returns ASCII/Extended key character typed

INPUT / Windows Unix

INPUT A$
Reads a full line of input from user

LOCATE / Windows Unix

LOCATE [Y%][, X%][, cursor]
Moves cursor to Y%, X% (upper left starts at 1,1). You can ignore either one of the parameters

PCOPY / Windows

PCOPY source, dest
Copy page from source to dest. The visible page is 0. There are 7 off screen pages.

PEEK / Windows
A% = PEEK([#PageNum,] address)
Returns the char/attribute value at address

POKE / Windows

POKE [#PageNum,] address, byte
Poke attribute or char at address

POS(0) / Windows Unix

CurPos% = POS(0)
Returns current position of cursor

PRINT / Windows Unix

PRINT [#PageNum[;|,]][stuff][;|,][...]
Write to standard output (console). To write to the offscreen buffers, use #PageNum. Where PageNum is 1-7. Only works under Windows.

SCREEN / Windows

A% = SCREEN(row, col [, colorflag])
Returns the chararacter or attribute value at (row,col)

SETCONSOLETITLE / Windows

SetConsoleTitle(Title$)
Set console title

SLEEP / Windows Unix

SLEEP n
Delay for n seconds, which can be a fraction


Appendix C: Detailed Console Keywords

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix C: Detailed Console Keywords

Detailed Console Keywords

Most of these have the same functionality as QBasic, so you could just as easily look them up there. Again, when I refer to Unix, I mean Linux & Unix. The following keywords are all encapsulated in the CONSOLE object, so Console.PRINT is the same as PRINT.

CLS CONSOLE Statement Windows/Unix

Clears console screen of all text, and fills the console with the currect background color. CLS also returns the cursor to the home position in the top left corner of the screen.

Syntax: CLS
CLS

Details:
Under Windows, CLS is a CONSOLE statement, under Linux/Unix, CLS is implemented as a system call to clear, so you can safely call CLS without compiling as CONSOLE under Linux/Unix.

COLOR CONSOLE Statement Windows/Unix

Sets the current display colors for the console screen.
  • Foreground is the text color (range = 0-31)
  • Background is the screen color (range = 0-7)
0 = black  4 = red       8 = grey        12 = light red
1 = blue   5 = magenta   9 = light blue  13 = light magenta
2 = green  6 = brown    10 = light green 14 = yellow
3 = cyan   7 = white    11 = light cyan  15 = bright white

Syntax: COLOR [foreground][,background]
COLOR 15
COLOR 10, 3
COLOR ,1
COLOR

CONSOLE.INPUTHANDLE CONSOLE Statement Windows

Returns the console input handle for use in API calls.

Syntax: CONSOLE.INPUTHANDLE
hnd = CONSOLE.INPUTHANDLE

CONSOLE.OUTPUTHANDLE CONSOLE Statement Windows

Returns the console output handle for use in API calls.

Syntax: CONSOLE.OUTPUTHANDLE
hnd = CONSOLE.OUTPUTHANDLE

CSRLIN CONSOLE Function Windows/Unix

Returns the current line (row) position of the cursor.

Syntax: CSRLIN
Row% = CSRLIN

GET$ CONSOLE Function Windows/Unix

This function is mainly used in CGI programs, but can be used as a general purpose read function. It will read the STDIN.

Syntax: GET$(numeric-expression)
A$ = GET$(10)

Details:
GET$ under Linux/Unix is not a console function. To use GET$, compile your application as CONSOLE or CGI under Windows.

INKEY$ CONSOLE Function Windows/Unix

Returns a one- or two-byte string containing a character read from standard input (console). An empty string is returned if no character is waiting there.

Syntax: INKEY$
A$ = INKEY$

Details:
Extended keys start with CHR$(27) and are 2 bytes in length. Extended keys are arrow keys, page up/down, home, end, insert, delete, and F1-F12 keys. You can also trap the shift, ctrl, alt, caps/num/scroll lock keys under Windows.

INPUT CONSOLE Statement Windows/Unix

Reads a whole line of input from the. This statement causes the program to pause and wait for data until a carriage return is pressed.

Syntax: INPUT ["Prompt string"{;|,}] variable
INPUT A$
INPUT "Enter name: "; A$

Details:
INPUT for Rapid-Q is not exactly compatible with QBasic's INPUT. It is more like LINE INPUT. The return variable can be a string or numeric variable. Under Windows, INPUT is implemented as a CONSOLE function. Under Linux/Unix INPUT is not considered a CONSOLE function so there's no need to compile as CONSOLE.

LOCATE CONSOLE Statement Windows/Unix

Moves cursor to specified position.

Syntax: LOCATE [row][,column][,cursor]
LOCATE 10, 1
LOCATE ,10
LOCATE 5
LOCATE 1,,80

Details:
Under Windows you can assume that Row 25 is the last row and Column 80 as the last column. Under Linux/Unix this is dependent on your terminal, but you can use the internal variables Screen.ConsoleX and Screen.ConsoleY to determine the max column and row respectively. The first row and first column always starts at (1,1). The cursor argument is optional, and can take a range of values from 0 to 100 indicating the percentage of the character cell that is filled by the cursor. ie. specifying a value of 0 completely hides the cursor. The default cursor value is 1.

PCOPY CONSOLE Statement Windows

Copies one screen page to another.

Syntax: PCOPY sourcepage, destinationpage
PCOPY 0, 1
PCOPY 1, 5

Details:
The visible (on-screen) page is always 0. There are 7 off-screen pages (1 to 7). You can copy from any page onto any other page.

PEEK CONSOLE Function Windows

Returns the current character/attribute pair stored at a specified location on the console screen.

Syntax: PEEK([#pagenum,] address)
A% = PEEK(2000) '-- Peek location 2000 on current page
A% = PEEK(1, 2000) '-- Peek location 2000 on page 1

Details:
To understand how to compute the address, use this handy function:
   Char$ = CHR$(PEEK((Row%-1)*160+(Col%-1)*2))
   Attr = PEEK((Row%-1)*160+(Col%-1)*2+1)
As you may notice, all the even memory addresses contain the character, and all the odd numbered addresses contain the attribute. The attribute contains information about the foreground and background color.
   ForeGround% = Attr AND &HF
   BackGround% = Attr SHR 4
Why all the trouble? This is implemented for compatibility with QBasic. The only difference is that you don't use DEF SEG under Rapid-Q, and PEEK only works at the console level.

POKE CONSOLE Statement Windows

Writes a byte to the console page.

Syntax: POKE [#pagenum,] address, byte
POKE 2000, ASC("A") '-- Pokes an "A" character at location 2000
POKE 2001, 95 '-- Pokes attribute 95 to location 2000
POKE 1, 2001, 95 '-- Same as above but pokes to page 1

Details:
To understand how to compute the address, use this handy function:
   ChAddress = (Row%-1)*160+(Col%-1)*2
   AttrAddress = (Row%-1)*160+(Col%-1)*2+1
As you may notice, all the even memory addresses contain the character, and all the odd numbered addresses contain the attribute. The attribute contains information about the foreground and background color. To calculate the attribute, try this:
   Attr = (BackGround% SHL 4) OR ForeGround%
Why all the trouble? This is implemented for compatibility with QBasic. The only difference is that you don't use DEF SEG under Rapid-Q, and POKE only works at the console level.

POS CONSOLE Function Windows/Unix

Returns the current horizontal (column) position of the cursor.

Syntax: POS(0)
Column% = POS(0)

Details:
Please note that I did not make this function up (ie. its weird syntax), it's implemented for compatibility with QBasic.

PRINT CONSOLE Statement Windows/Unix

PRINT outputs data to the screen (or standard output).

Syntax: PRINT [#pagenum,][expressions][{;|,}]
PRINT "Number: "; 45
PRINT A$
PRINT #1, "This prints to screen page 1"

Details:
Expressions can be any string, number, or function. You can optionally use ; or , to print out more expressions. Under QBasic, PRINT can format your data if you use the comma, however, under Rapid-Q the comma and semi-colon have the same effect. Again, under Windows, PRINT is implemented as a CONSOLE function. Under Linux/Unix you do not need to compile as CONSOLE.

SCREEN CONSOLE Function Windows

Returns the ASCII character or attribute at (row, col) on the current console screen.

Syntax: SCREEN(row, col [, colorflag])
A% = SCREEN(1, 1) '-- Get character located on the first row and column
A% = SCREEN(5, 3, 1) '-- Get attribute of character located at (5,3)

Details:
The SCREEN function is very similar to the PEEK function, except that it's much easier to use. If you supply the function with a colorflag parameter, the function returns the attribute (ie. color), otherwise it returns the ASCII character. The SCREEN function only works on the current console screen and not on any hidden pages.

SETCONSOLETITLE CONSOLE Statement Windows

SetConsoleTitle is implemented as a WinAPI call to SetConsoleTitle but is called as a statement rather than a function (ie. no return value). If you would like a return value, you'll have to call the API function directly.

Syntax: SETCONSOLETITLE string-expression
SETCONSOLETITLE "Hello World!"

SLEEP CONSOLE Statement Windows/Unix

Suspends execution of the application for a specified amount of time.

Syntax: SLEEP seconds
SLEEP .5 '-- Delay for half a second

Details:
SLEEP requires a parameter, unlike QBasic. SLEEP waits until the number of seconds specified has elasped. You cannot break out of it by pressing a key (unlike QBasic). Under Windows, SLEEP is implemented as a console function. Under Linux/Unix, you do not need to compile as CONSOLE.


conversion.inc

'--------------------------- Custom functions --------------------------

'-- **************************************************************************'
FUNCTION vidnum$ (Num, dig%) as string
'Andrew Shelkovenko dec 2003
'A  function that returns the string representation of  of a rounded numeric expression.
'Syntax: vidnum$ (numeric-expression, dig%)
'Num$ = vidnum$ (999999.2366666666, 4)
'Return  999999.2367
'Num$ = vidnum$ (-0.236, 4)
'Return  -0.236
'Num$ =vidnum$ (-12389.236, -2)
'Return -12400
'Details:
'dig% - number of significant digits

Num$=str$(Num)

pntPos=instr(Num$,".")

if pntPos=0 then
digMax=0
else
digMax=Len(Num$)-pntPos
end if

if dig%>digMax then dig%=digMax

vidnum$ = STR$((  CLNG(  abs(Num) * 10 ^ dig%) / 10 ^ dig%)*sgn(Num))

END FUNCTION
'
'-- **************************************************************************'
function   Hex2Dec (HexStr as string) as string

  DEFdbl numb
  defdbl number
  DEFBYTE x,length, y
    number = 0
    length = LEN(HexStr)
    FOR x = 1 TO length
      y = length - x

      digit$ = UCASE$(MID$(HexStr,x,1))
      SELECT CASE digit$
        CASE "A"
          numb = 10 * 16^y
        CASE "B"
          numb = 11 * 16^y
        CASE "C"
          numb = 12 * 16^y
        CASE "D"
          numb = 13 * 16^y
        CASE "E"
         numb = 14 * 16^y
        CASE "F"
          numb = 15 * 16^y
        CASE ELSE
          numb = VAL(LCASE$(digit$)) * 16^y
      END SELECT
      number = number + numb
    qw:
    NEXT

if number>10^6 then
n1=fix(number/1000000)
n2=(number-n1*1000000)
NumNul=6-len(str$(n2))
TrNul$=string$(NumNul, "0")

Dec$ = STR$(n1)+TrNul$+str$(n2)

else
Dec$ = STR$(number)
end if
Hex2Dec=Dec$

END function

'-- **************************************************************************'
function dectoHex (Dec as string) as string
defdbl ost, ch
defstr HexVal$
HexVal$=""
ost=0: ch=0
Dec#=val(Dec)
sign=sgn(Dec#)
Dec#=abs(Dec#)
WHILE  Dec# >= 16#
ch=FIX(Dec# / 16#)
ost = Dec#-ch*16#

Dec#=ch
select case ost
case is <10
Hexdig$=str$(ost)
case 10
Hexdig$="A"
case 11
Hexdig$="B"
case 12
Hexdig$="C"
case 13
Hexdig$="D"
case 14
Hexdig$="E"
case 15
Hexdig$="F"
case 15
Hexdig$="10"

case else
end select

HexVal$ =Hexdig$  + HexVal$:

wend

select case Dec#

case is <10
Hexdig$=str$(Dec#)
case 10
Hexdig$="A"
case 11
Hexdig$="B"
case 12
Hexdig$="C"
case 13
Hexdig$="D"
case 14
Hexdig$="E"
case 15
Hexdig$="F"
case 15
Hexdig$="10"

case else
end select

HexVal$ =Hexdig$  + HexVal$:
if sign=-1 then signn$="-" else signn$=""
if HexVal$="0" then HexVal$="00"
dectoHex=signn$+ HexVal$
END function

'-- **************************************************************************'
function AddStrBefore(NumStr as string , Dlina as int, AddStr as string) as string
'Andrew Shelkovenko dec 2003
'A function that pre-padd string with 0's to required Length
'print Add0Before("-387.35" , 8)
'-0387.35

diM kolvo as int
kolvo =Dlina-Len(NumStr)
if   kolvo<0 theN Add0Before="String too long"
if   kolvo=0 theN Add0Before=NumStr: exit function

Add0Before	= STRING$(kolvo, "0")+ NumStr

end function

'-- **************************************************************************'
FUNCTION ByteReOrder (ByteStr$,ReOrder$ ) as string
'Andrew Shelkovenko dec 2003
' A function that reorder bytes in string.
'ByteStr$ - Sourse string
'ReOrder$ - new byte order

'ReOrder$="21342"
'old position - 2, new position - 1
'old position - 1, new position - 2
'old position - 3, new position - 3
'old position - 4, new position - 4
'old position - 2, new position - 5

LenB=Len(ByteStr$)
LenR=Len(ReOrder$)

for i=1 to LenB
poz$=ReOrder$[i]
if val(poz$)> LenB then ShowMessage( "ReOrder index outbound input string"):exit FUNCTION
if i<= LenR then
byt$=ByteStr$[val(poz$)]
else
byt$=ByteStr$[i]
end if
tmp$=tmp$+byt$
next
ByteReOrder=tmp$
end FUNCTION

'-- **************************************************************************'
FUNCTION CByteNum (ByteStr$,Num_Type as short ) as variant
'Andrew Shelkovenko dec 2003
'' converts   number of Num_Type type to bytes sequence.
'Num_Type can be next value:
'CONST Num_SHORT = 2
'CONST Num_WORD = 3
'CONST Num_LONG = 4
'CONST Num_DWORD = 5
'CONST Num_SINGLE = 6
'CONST Num_DOUBLE = 8

DIM M AS QMemoryStream
select case Num_Type
case Num_BYTE
ShowMessage "Can't to write BYTE.Wrong parameter type - Num_BYTE": exit funCTION
case  Num_SHORT: M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_SHORT)
case  Num_WORD:  M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_WORD)
case  Num_LONG:  M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_LONG)
case  Num_DWORD: M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_DWORD)
case  Num_SINGLE:M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_SINGLE)
case  Num_DOUBLE:M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_DOUBLE)

case else
M.Write (ByteStr$):m.Position=0:CByteNum=m.ReadNum(Num_DOUBLE)
end select

M.Close

end funCTION

'-- **************************************************************************'
FUNCTION CNumByte (Num, Num_Type as short) as string
'Andrew Shelkovenko dec 2003

'converts bytes sequence to  number of Num_Type type
'Num_Type can be next value:
'CONST Num_SHORT = 2
'CONST Num_WORD = 3
'CONST Num_LONG = 4
'CONST Num_DWORD = 5
'CONST Num_SINGLE = 6
'CONST Num_DOUBLE = 8

DIM M AS QMemoryStream

select case Num_Type
case Num_BYTE
dim N1 as BYTE
ShowMessage "Can't to write BYTE.Wrong parameter type - Num_BYTE": exit funCTION

case  Num_SHORT: DEFSHORT N2:N2=Num:M.Write(N2):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N2))
case  Num_WORD:  DEFWORD  N3:N3=Num:M.Write(N3):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N3))
case  Num_LONG:  DEFLNG   N4:N4=Num:M.Write(N4):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N4))
case  Num_DWORD: DEFDWORD N5:N5=Num:M.Write(N5):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N5))
case  Num_SINGLE:DEFSNG   N6:N6=Num:M.Write(N6):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N6))
case  Num_DOUBLE:DEFDBL   N7:N7=Num:M.Write(N7):M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N7))

case else
dim N8 as DOUBLE:N8=Num:
M.Write(N8):
M.Position=0:CNumByte=M.ReadBinStr(sizeOf(N8)):M.Close
end select
M.Close
end funCTION

'-- **************************************************************************'

' LIKE Function - pattern matching routine for Rapid-Q by William Yu
' This emulates the VB LIKE operator.
' Thanks to Thomas Binder for the original C code
'
' ?   Any single character.
' *   Zero or more characters.
' #   Any single digit (0-9).
' [charlist]  Any single character in charlist.
' [!charlist] Any single character not in charlist.
'
' A group of one or more characters (charlist) enclosed in brackets ([ ])
' can be used to match any single character in string and can include almost
' any character code, including digits.
'
' Note:   To match the special characters left bracket ([), question
' mark (?), number sign (#), and asterisk (*), enclose them in brackets.
' The right bracket (]) can't be used within a group to match itself, but
' it can be used outside a group as an individual character.
'
' By using a hyphen (-) to separate the upper and lower bounds of the range,
' charlist can specify a range of characters. For example, [A-Z] results in
' a match if the corresponding character position in string contains any
' uppercase letters in the range A-Z. Multiple ranges are included within
' the brackets without delimiters.

DECLARE FUNCTION Like(ParseString AS STRING, Pattern AS STRING) AS INTEGER
DECLARE FUNCTION IsDigit(S AS STRING) AS INTEGER

CONST INVERT = "!"       '-- Some like ^ or ~ instead, whatever you want

'-- **************************************************************************'
FUNCTION IsDigit(S AS STRING) AS INTEGER
  IF S >= "0" AND S <= "9" THEN
    IsDigit = 1
  ELSE
    IsDigit = 0
  END IF
END FUNCTION

'-- **************************************************************************'
FUNCTION Like(ParseString AS STRING, Pattern AS STRING) AS INTEGER
  DIM prev AS INTEGER, matched AS INTEGER, reverse AS INTEGER

  WHILE Pattern <> ""
    SELECT CASE MID$(Pattern, 1, 1)
      CASE "?"
        IF ParseString = "" THEN
           Like = 0
           EXIT FUNCTION
        END IF
      CASE "#"
        IF IsDigit(MID$(ParseString, 1, 1)) = 0 THEN
           Like = 0
           EXIT FUNCTION
        END IF
      CASE "*"
        DO
          Pattern = MID$(Pattern, 2, LEN(Pattern)-1)
        LOOP UNTIL MID$(Pattern, 1, 1) <> "*"
        IF Pattern = "" THEN
           Like = 1
           EXIT FUNCTION
        END IF
        WHILE ParseString <> ""
           IF Like(ParseString, Pattern) THEN
              Like = 1
              EXIT FUNCTION
           END IF
           IF ParseString <> "" THEN
              ParseString = MID$(ParseString, 2, LEN(ParseString)-1)
           END IF
        WEND
        Like = 0
        EXIT FUNCTION
      CASE "["
        reverse = (MID$(Pattern, 2, 1) = INVERT)
        IF reverse THEN
           Pattern = MID$(Pattern, 2, LEN(Pattern)-1)
        END IF
        prev = 256: matched = 0
        DO
           Pattern = MID$(Pattern, 2, LEN(Pattern)-1)
           IF (Pattern <> "") AND (esc <> 0 OR MID$(Pattern, 1, 1) <> "]") THEN
              IF MID$(Pattern, 1, 1) = "-" THEN
                 Pattern = MID$(Pattern, 2, LEN(Pattern)-1)
                 IF Pattern = "" THEN
                    Like = 0
                    EXIT FUNCTION
                 END IF
                 matched = matched OR (MID$(ParseString, 1, 1) <= MID$(Pattern, 1, 1) AND ASC(MID$(ParseString, 1, 1)) >= prev)
              ELSE
                 matched = matched OR (MID$(ParseString, 1, 1) = MID$(Pattern, 1, 1))
              END IF
              prev = ASC(MID$(Pattern, 1, 1))
           ELSE
              EXIT DO
           END IF
           esc = 0
        LOOP
        IF (prev = 256 OR MID$(Pattern, 1, 1) <> "]" OR ABS(matched) = ABS(reverse)) THEN
           Like = 0
           EXIT FUNCTION
        END IF
      CASE ELSE
        IF MID$(ParseString, 1, 1) <> MID$(Pattern, 1, 1) THEN
           Like = 0
           EXIT FUNCTION
        END IF
    END SELECT
    ParseString = MID$(ParseString, 2, LEN(ParseString)-1)
    Pattern = MID$(Pattern, 2, LEN(Pattern)-1)
  WEND

  Like = ABS(LEN(ParseString) = 0)
END FUNCTION

'-- Test code

'print "Like('24','##')=", Like("24","##")

'?"Like(aBBBa, a*a)=", Like("aBBBa","a*a")
'?Like("F","[!A-Z]")
'?Like("a2a","a#a")
'?Like("aM5b","a[A-GL-P]#[!c-e]")
'?Like("BAT123khg","B?T*")
'?Like("CAT123khg","B?T*")

'?Like("Combine(10, 20) = 30", "*(*?,*?)*=*#")


RQDP - Custom Components

RapidQ Documentation Project

Custom Components

Common/Extended common components

  • QBevel
  • QBitmapEx
  • QCanvasEx
  • QColorDialog
  • QComPort
  • QDirListView.inc
  • QxEdit.inc
  • QFlatButton
  • QFormEx
  • QFormMDI
  • QImageEx
  • QListviewEx
  • QMAXSPLITTER (QSplitterEx)
  • MDI_API.INC
  • msgdlg.inc
  • QMenu (OwnerDraw)
  • QProgress
  • QPageSetup
  • QPrinterInfo
  • RQDialog
  • QSavePlus
  • Qspintext
  • QStatusBarEx
  • QStringGridEx - see also grids examples
  • QTextBtn
  • QTextEdit
  • QTreeviewEx
  • QTOOLBAR

RichEdit extensions

  • Qredex (QRichEditEx)
  • QTextEdit

Addition components

  • QAbout
  • QAnim
  • QChart
  • QCursor
  • Qcalendar
  • QDigDisplay
  • QDir
  • QDrawFocus
  • QDrawMenu
  • QDrive
  • QDriveCombobox
  • QFlashLabel
  • Qgraph
  • QICON
  • QImageDialog
  • QINI
  • QLine
  • QProcess
  • QResourceStream
  • QRun
  • QSkin
  • QSkinBtn
  • QSplash
  • QAutoComboBox
  • QAutoEdit
  • QBlink
  • QDragObject
  • QRemoteForm
  • QRemoteObject
  • QStatustray
  • QWinIni
  • RC4crypt

Media components

  • QCDAUDIO
  • QMIDI
  • QVIDEO
  • QVuMeter
  • QWAVE

Special components

  • QDEBUG.cmp
  • Qid3Tag Component
  • QLZFileStream
  • evaluate.inc
  • HiLight.inc
  • pdecl.inc
  • objectToolbox.inc
  • RQDxf.inc - CAD format
  • Wad3.inc
  • ACE32.INC-Rapid-Q & Advantage Database Local Server code

Databases

  • DataBase
  • MYSQL.INC
  • ODBC.inc
  • Tsunami Record Manager

Internet components

  • qcgi.inc
  • CGI.INC
  • eMail.Inc
  • obj_http.inc
  • QICMP.INC
  • RSOCKET.INC
  • qdownload.inc
  • QHyperLink
  • QHTML.rqo

Additional INC.

  • Fileops.inc
  • FileUtils.inc
  • ftiQuery.inc - retrieve information on any file extension/type
  • Control.inc - Windows control panel library for Rapid-Q
  • QSHFileOperation - copy, rename, delete and move files and folders

Additional Software

  • CodeSense - CodeSense is a "branch" of the original CodeMax (see CodeMax General FAQ ). It adds word completion and function highlighting support to the CodeMax control. CodeMax is a powerful Win32-based custom control that allows developers to add code editing and syntax highlighting capabilities to their applications quickly and easily.
  • CodeMax API Reference
  • See nice CodeEdit Created by Danny Jackson
  • RQTINYJP allows to generate Tiny executables. Tiny Executables are typically less than 20 KBytes and can be as short as 6 KBytes !


Custom Functions

vidnum$ Convert Function Windows

A function that returns the string representation of of a rounded numeric expression.

Syntax: vidnum$ (numeric-expression, dig%)

Num$ = vidnum$ (999999.2366666666, 4)
Return 999999.2367

Num$ = vidnum$ (-0.236, 4)
Return -0.236

Num$ =vidnum$ (-12389.236, -2)
Return -12400

Details:
dig% - number of significant digits

function Hex2Dec (HexStr as string) as string

A function that returns the decimal (base 10) representation of the hexidecimal (base 16) string expression

function DecToHex (Dec as string) as string
A function that returns the hexidecimal (base 16) representation of the (base 10) string expression

String is not pre-padded with 0's

function Add0Before (NumStr as string , ReqLength as int) as string
A function that pre-padd string with 0's to required Length

print Add0Before("-387.35" , 8)

-0387.35

FUNCTION ByteReOrder (ByteStr$,ReOrder$ ) as string
A function that reorder bytes in string.
Detailes:
ReOrder$ - Defines the order of bytes following in ByteStr$

abcde initial string
2145 output order - i.e.
2 byte to 1 posicion
1 byte to 2 posicion
4 byte to 3 posicion
5 byte to 4 posicion

badee output string

Examples:

number$ =ByteReOrder ("0123","2143" )

Return "1032"
------------------------
inpStr$="1234": print "inpStr$=" ,inpStr$
reOrder$="222143": print "reOrder$=" ,reOrder$
ssd$=ByteReOrder (inpStr$,reOrder$ )
print "ByteReOrder="+ ssd$

Return ByteReOrder=2221
-------------------------
number$ =ByteReOrder ("1234","143" )
Return 1434
-------------------------
ssd$=ByteReOrder ("abcde","2149" )

Error: ShowMessage( "ReOrder index outbound input string"):exit FUNCTION

there are no 9 byte in "abcde" string

FUNCTION CNumByte (Num, Num_Type as short ) as string

FUNCTION CNumByte converts number of Num_Type type to bytes sequence.

Num_Type can be next value:
CONST Num_SHORT = 2
CONST Num_WORD = 3
CONST Num_LONG = 4
CONST Num_DWORD = 5
CONST Num_SINGLE = 6
CONST Num_DOUBLE = 8

FUNCTION CByteNum (ByteStr$,Num_Type as short ) as variant

FUNCTION CByteNum converts bytes sequence to number of Num_Type type

Num_Type can be next value:
CONST Num_SHORT = 2
CONST Num_WORD = 3
CONST Num_LONG = 4
CONST Num_DWORD = 5
CONST Num_SINGLE = 6
CONST Num_DOUBLE = 8

Examples:
iNitNum=1234.56789

SngStr$=CNumByte (iNitNum, Num_siNGLE )

DblStr$=CNumByte (iNitNum, Num_DouBLE )

print "Num_siNGLE=",CByteNum (SngStr$,Num_siNGLE )
print "Num_DouBLE=",CByteNum (DblStr$,Num_DouBLE )

Return
iNitNum=1234.567890000

SngStr$=,R?D
DblStr$=зЖф"EJ"@

Num_siNGLE=1234.567871094
Num_DouBLE=1234.567890000

LIKE Function - pattern matching routine for Rapid-Q by William Yu
This emulates the VB LIKE operator.
Thanks to Thomas Binder for the original C code

? Any single character.
* Zero or more characters.
# Any single digit (0-9).
[charlist] Any single character in charlist.
[!charlist] Any single character not in charlist.

A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in string and can include almost any character code, including digits.

Note: To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets.
The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character.

By using a hyphen (-) to separate the upper and lower bounds of the range, charlist can specify a range of characters. For example, [A-Z] results in a match if the corresponding character position in string contains any uppercase letters in the range A-Z. Multiple ranges are included within the brackets without delimiters.

'-- Test code

print "Like('24','##')=", Like("24","##")

?"Like(aBBBa, a*a)=", Like("aBBBa","a*a")
?Like("F","[!A-Z]")
?Like("a2a","a#a")
?Like("aM5b","a[A-GL-P]#[!c-e]")
?Like("BAT123khg","B?T*")
?Like("CAT123khg","B?T*")

?Like("Combine(10, 20) = 30", "*(*?,*?)*=*#")

return

Like('24','##')=1
Like(aBBBa, a*a)=1
0
1
1
1
0
1

function TimeString (TimSec as integer) as string

TimeString=Hr$+":"+Min$+":"+Sec$+" "

'-- **************************************************************************'
function SecTime (cTime$ as string) as integer
TimeHH=val (field$(cTime$, ":",1))
TimeMM=val (field$(cTime$, ":",2))
TimeSS=val (field$(cTime$, ":",3))
result=TimeHH*3600+TimeMM*60+TimeSS
end function

'-- **************************************************************************'
function DayDate (cDate$ as string) as integer

MM=val (field$(cDate$, "-",1))
Day=val (field$(cDate$, "-",2))
Year=val (field$(cDate$, "-",3))

result=365*(Year)+30*(MM)+(Day)
end function


Appendix C: Rapid-Q Supported Data Types

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Data Types

Introduction to Data Types

A data type is just a definition. It is used to bind a variable to its definition and cannot be changed once bound (except for VARIANT type variables). For example, if a variable is bound to a STRING data type, it cannot change itself to an INTEGER definition. A variable can be assigned any one of these supported data types, BYTE, WORD, DWORD, SHORT, LONG/INTEGER, SINGLE, DOUBLE, STRING, VARIANT, and fixed-length strings. There are also such things as User Defined Data Types, which will be discussed in another section. Some BASIC implementations hold INTEGER as a 16-bit value, while Rapid-Q chooses to go 32-bit. So if you're worried about converting your old code, make sure to replace all occurrences of INTEGER with SHORT.

How to use data types
Since Rapid-Q is a BASIC language, there are 2 ways to define your variables. You can choose to do it explicitly using DIM
    DIM myNum AS LONG
    DIM myStr AS STRING
Similarly, you can attach a suffix symbol which describes the variable type:
    myNum& = 234
    myStr$ = "abc"
Chapter 3 has a list of these suffixes, but are listed here again for your convenience:
    Type       ID  Size  Range
    --------- ---- ---- -------------
    Byte        ?   1   0..255
    Word       ??   2   0..65535
    Dword     ???   4   Only Linux version for now...
    Short       %   2   -32768..32767
    Integer     &   4   -2147483648..2147483647
    Long        &   4   -2147483648..2147483647
    Single      !   4   1.5 x 1045..3.4 x 1038
    Double      #   8   5.0 x 10324..1.7 x 10308
    String      $
A variant data type has no suffix, so you'll have to use DIM instead, or change the default DIM operation.
    $OPTION DIM VARIANT

    myVar = "hello!"
myVar is defined as a VARIANT since we've changed the default data type for DIM. Whenever Rapid-Q comes across an undefined symbol (with no suffix), it will choose the data type according to traditional BASIC. Traditionally, this has been choosen to be either SINGLE or DOUBLE. With Rapid-Q, you can choose any of the existing data types as the default one.

Variant data type
A Variant is a special kind of data type, since a Variant can mutate. Don't be afraid, it won't mutate to a virus or anything like that. It simply changes types on the fly, as needed. Even a simple operation like addition changes when you add 2 variants together. Take this for example:
   DIM V1 AS VARIANT, V2 AS VARIANT

   V1 = 101
   V2 = "99.5"

   PRINT V1+V2  '-- Output is 200.5
As you'll notice V2 is originally assigned a string, but V2 has changed its type to a floating point number when the addition takes place. Note that V2 is still a string, it just mutated itself for that one operation. Similarly,
   DIM V1 AS VARIANT, V2 AS VARIANT

   V1 = "101"
   V2 = 99.5

   PRINT V1+V2  '-- Output is 10199.5
In this case, V2 was originally a floating point number, but changed its type during the addition operation to a string. Notice how the order of operation defines the mutation. In the previous example, V1 was a number, so V1+V2 results in a numeric expression, while the above example produces a string.


Appendix C: Rapid-Q definitions

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Rapid-Q definitions

Internal Definitions

Rapid-Q has these variables already defined:
    $DEFINE WIN32 WIN32
    $DEFINE UNIX  UNIX
    $DEFINE TYPE  STRUCT
WIN32 is defined if you're using the Windows version of Rapid-Q
UNIX is defined if you're using the Linux/Unix version of Rapid-Q
TYPE is defined to replace the old style TYPE

Unhooking definitions
The term "unhooking" just means undefining a definition, ie:
    $UNDEF TYPE
This is the only definition (at this time) that can affect your program when unhooked. See the section on "User Defined Types" for more information.

Using definitions
Chapter 3 lists some examples on using $IFDEF and $IFNDEF:
    $IFDEF WIN32
         PRINT "I'm using the Windows version!"
    $ELSE
         PRINT "I'm using the Linux/Unix version!"
    $ENDIF


FAQ-001

Rapid-Q Documentation Project (RQDP) | Release 01 FAQ - 001
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | faq001.html/Andreas Fink/Serban S./01

-------------------------------------------------------------

Hi all,

   This is my complete RapidQ-List archive. It begins in late
June 2000. In late October 2000 I've decided to unsubscribe
because there wasn't much more than general complaints about
William's choice and discussion of alternatives to RapidQ.
Then I have February 2001 sice the 17th...

Please scan this for good Question & Answer pairs...

FastCow AKA Andreas Fink
-------------------------------------------------------------
From - Wed Jun 21 22:08:46 2000
From: rapidq@egroups.com
Subject: [rapidq] Digest Number 37
------------------------------------------------------------------------
There are 10 messages in this issue.
Topics in this digest:
      1. Re: New Windows version
           From: "Steven Edwards"
      2. Re: New Windows version
           From: Giovanni Salmeri
      3. Re: New Windows version
           From: William Yu
      4. HTML/IE??
           From: "Thomas Simers (\"Echecero\")"
      5. Menu's - Possible bug or 'Feature'
           From: "d turland"
      6. Internet Communications
           From: "Thomas Simers (\"Echecero\")"
      7. Menu?
           From: "Thomas Simers (\"Echecero\")"
      8. Re: Menu's - Possible bug or 'Feature'
           From: William Yu
      9. Re: Internet Communications
           From: William Yu
     10. Re: Menu?
           From: William Yu
________________________________________________________________________
Message: 1
   Date: Tue, 20 Jun 2000 11:20:37 -0500
   From: "Steven Edwards"
Subject: Re: New Windows version

From: William Yu
To:

> What's New for Build 06.19.2000
> -----------------------------------------------------------------
>    - Added SCREEN.CURSORS so you can create your own cursors

Any way to directly write the cursor information into the CURSORS array
without having to load a .CUR file or access a .DLL?

>    - Added generic READ/WRITE methods for QFILESTREAM and
>      QMEMORYSTREAM, just to make life easier.

Any thoughts on removing some of the old read/write methods?
Now that a general purpose READ(variable) and WRITE(variable) exists, do we
still need the old READNUM/WRITENUM or READSTR/WRITESTR?
Others may know of reasons to have them, but it seems like duplications in
functions would lead to confusion for newbies to Rapid-Q.  I know the
argument for compatibility with existing source code files can be used, but
we are talking about a beta product and some rewriting of obsolete code over
the course of development is expected.
...Anyone?
...Anyone?
________________________________________________________________________
Message: 2
   Date: Tue, 20 Jun 2000 19:25:56 +0200
   From: Giovanni Salmeri
Subject: Re: New Windows version

Dear William

thank you very much for your wonderful work!

>    - Added generic READ/WRITE methods for QFILESTREAM and

It would be perfect if the Write method accepted also a literal string,
e.g.

File.Write ("Rapid-Q is wonderful!")
-------------------------
Giovanni Salmeri
Piazza dell'Alberone 2
I-00181 Roma RM
g.salmeri@mclink.it
http://mondodomani.org/
________________________________________________________________________
Message: 3
   Date: Tue, 20 Jun 2000 11:28:55 -0600 (MDT)
   From: William Yu

Subject: Re: New Windows version

On Tue, 20 Jun 2000, Steven Edwards wrote:

> From: William Yu
> To:
>
> > What's New for Build 06.19.2000
> > -----------------------------------------------------------------
> >    - Added SCREEN.CURSORS so you can create your own cursors
>
> Any way to directly write the cursor information into the CURSORS array
> without having to load a .CUR file or access a .DLL?

I guess I could implement them as resources, but there's no way to
directly access the array.

> >    - Added generic READ/WRITE methods for QFILESTREAM and
> >      QMEMORYSTREAM, just to make life easier.
>
> Any thoughts on removing some of the old read/write methods?
> Now that a general purpose READ(variable) and WRITE(variable) exists, do we
> still need the old READNUM/WRITENUM or READSTR/WRITESTR?

Perhaps for convenience sake, but I have no plans to take them out.
What I should do, however, is rewrite these documents...
Just to mention that ReadNum/WriteNum etc. are deprecated but still exist
for convenience.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 4
   Date: Tue, 20 Jun 2000 18:41:16 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: HTML/IE??

    I have noticed that some applications seem to have Internet Explorer
windows "embedded" in them...like the AllAdvantage advertisment bar, and
Juno's HTML e-mail...is there anyway to do that in Rapid-Q?

    Thanks, Thomas.
________________________________________________________________________
Message: 5
   Date: Tue, 20 Jun 2000 22:54:34 -0000
   From: "d turland"
Subject: Menu's - Possible bug or 'Feature'

William,

The following code is building a main menu and a popup menu.  There
is a conflict when a QMenuItem appears in both a QMAINMENU and a
QPOPUPMENU.  Run the code as is and it works. Uncomment the line
highlighted and it will fail.  Rightclick in the tree

Darren
P.S.  Thanks for putting the TreeView in.

==================================================

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"  ' Standard Include

DIM Form AS QForm
DIM DTTree AS QTREEVIEW

DIM MainMenu AS QMAINMENU
DIM DTPopupMenu AS QPopupMenu

DIM MnuDelNode AS QMenuItem
DIM MnuInsNode AS QMenuItem
DIM MnuSepBar AS QMenuItem
DIM MnuxxxNode AS QMenuItem
DIM MnuInsChild AS QMenuitem
DIM MnuInsAfter AS QMenuitem
DIM MnuInsBefore AS QMenuitem
DIM MnuDT AS QMenuItem

  MnuDT.Caption="&GGGGG"
  MnuDelNode.Caption = "&Delete Node"
  MnuDelNode.ShortCut = "Del"
  MnuInsNode.Caption = "&Insert Node"
  MnuInsChild.Caption = "&Child    "
  MnuInsChild.ShortCut = "Ins"

  MnuInsNode.AddItems MnuInsChild

  MainMenu.Parent = Form
  MainMenu.AddItems MnuInsNode, _
                      MnuDelNode

  DTPopupMenu.AddItems MnuDT
 ' DTPopupMenu.Additems MnuInsNode  ' Remove this and it works
  '##########################################################
  ' By removing the above line, the code works.....
  '##########################################################

Form.Height=300
Form.Width=400
Form.AutoScroll=False
Form.Center

DTTree.Left=0
DTTree.Top=0
DTTree.Width=100
DTTree.Parent=Form

With DTTree
  .Align = alLeft
  .AddItems "1","2","3"
  .AddChildItems 0, "Sub 1", "Sub
2asdsasdsadsadsadsadsadsadsdsadsadsadsa", "Sub 3"
  .AddChildItems 4, "Sub 1", "Sub 2", "Sub 3"
  .Popupmenu = DTPopupMenu
  END with

Form.ShowModal

________________________________________________________________________
Message: 6
   Date: Tue, 20 Jun 2000 19:36:34 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Internet Communications

    Is it possible to write a Rapid-Q application capable of sending
messages between computers via the internet, if the IP addresses are known?

    Thomas.
________________________________________________________________________
Message: 7
   Date: Tue, 20 Jun 2000 19:44:55 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Menu?

    I was wanting to make my QStatusBar display varying messages based upon
which item was highlighted in the menu (like many MS programs do), but I
didn't see anyway to do it...is there no OnMouse....? or anything for them,
or did I miss them (didn'thave the newest docs out, haven't downloaded them
yet...)

    Thanks, Thomas.
________________________________________________________________________
Message: 8
   Date: Wed, 21 Jun 2000 01:02:08 -0600 (MDT)
   From: William Yu
Subject: Re: Menu's - Possible bug or 'Feature'

On Tue, 20 Jun 2000, d turland wrote:

> The following code is building a main menu and a popup menu.  There
> is a conflict when a QMenuItem appears in both a QMAINMENU and a
> QPOPUPMENU.  Run the code as is and it works. Uncomment the line
> highlighted and it will fail.  Rightclick in the tree

Unfortunately it's a feature, hopefully it's not too bothersome, at least
there's some work around for it, unlike some other "features" :)

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 9
   Date: Wed, 21 Jun 2000 01:04:18 -0600 (MDT)
   From: William Yu
Subject: Re: Internet Communications

On Tue, 20 Jun 2000, Thomas Simers ("Echecero") wrote:

>     Is it possible to write a Rapid-Q application capable of sending
> messages between computers via the internet, if the IP addresses are known?

Yes, but you also need the correct ports in order to connect.
These should be published/known to all clients.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 10
   Date: Wed, 21 Jun 2000 01:06:41 -0600 (MDT)
   From: William Yu
Subject: Re: Menu?

On Tue, 20 Jun 2000, Thomas Simers ("Echecero") wrote:

>     I was wanting to make my QStatusBar display varying messages based upon
> which item was highlighted in the menu (like many MS programs do), but I
> didn't see anyway to do it...is there no OnMouse....? or anything for them,
> or did I miss them (didn'thave the newest docs out, haven't downloaded them
> yet...)

Unfortunately there's no OnMouse*** for QMenuItem, these "hints" are
provided using some other technique.  I'll work on implementing it, but
can't hold any guarantees.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
From - Fri Jun 23 14:44:27 2000
------------------------------------------------------------------------
There are 25 messages in this issue.
Topics in this digest:
      1. MAPI
           From: "Wilbert Brants"
      2. QForm component
           From: "Steven Edwards"
      3. EAccessViolation Error with ChatServ
           From: "Thomas Simers (\"Echecero\")"
      4. Re: QForm component
           From: "Thomas Simers (\"Echecero\")"
      5. Re: Menu?
           From: William Yu
      6. Re: MAPI
           From: William Yu
      7. Re: EAccessViolation Error with ChatServ
           From: William Yu
      8. Re: QForm component
           From: William Yu
      9. Re: Menu?
           From: "Thomas Simers (\"Echecero\")"
     10. Re: EAccessViolation Error with ChatServ
           From: "Thomas Simers (\"Echecero\")"
     11. Re: EAccessViolation Error with ChatServ
           From: William Yu
     12. Re: EAccessViolation Error with ChatServ
           From: brynm
     13. Re: EAccessViolation Error with ChatServ
           From: "Thomas Simers (\"Echecero\")"
     14. QRichEdit
           From: "Thomas Simers (\"Echecero\")"
     15. Re: QRichEdit
           From: William Yu
     16. Re: QRichEdit
           From: "Thomas Simers (\"Echecero\")"
     17. Re: MAPI
           From: "Wilbert Brants"
     18. WorkArea...
           From: "Thomas Simers (\"Echecero\")"
     19. Colour chooser dialogs...
           From: "Daniel Foote"
     20. QTreeView - unable to xtract item().***
           From: "d turland"
     21. (no subject)
           From: rpgconcep82113@aol.com
     22. Re: Colour chooser dialogs...
           From: "Thomas Simers (\"Echecero\")"
     23. Re: Re: MAPI
           From: William Yu
     24. Re: Colour chooser dialogs...
           From: "Erlend Rovik"
     25. Re: WorkArea...
           From: William Yu
________________________________________________________________________
Message: 1
   Date: Wed, 21 Jun 2000 17:18:11 +0200
   From: "Wilbert Brants"
Subject: MAPI

Is there an easy way to send a message to the out box of the standard mail client ?

Looking on the internet I found a page describing how to do this in Visual Basic but I don't know how to adjust the code or if there is an easier way to do this.
The page is
http://www.imginfo.com/devonly/devnews/summer1995/burns3.htm

Does anyone know how to do this ?

Kind regards, Wilbert
[This message contained attachments]
________________________________________________________________________
Message: 2
   Date: Wed, 21 Jun 2000 11:47:15 -0500
   From: "Steven Edwards"
Subject: QForm component

I'm currently working on a reference page on the QForm component for my
website and I have some questions.

QForm.Cursor
The "rapidq.inc" has some pre-defined settings for the various cursors.  I
realized that the definitions refer to the scheme settings and not to actual
cursor images ( changing the crosshairs cursor in the mouse settings to an
hourglass will cause the crCross definition to display the hourglass ).
What does the setting crSize refer to?  I change QForm.Cursor to crSize
( -5 ) and there is no apparent affect on the mouse cursor.

QForm.FormStyle
Will the pre-defined settings fsMDIChild, fsMDIForm, and fsStayOnTop ever
work?
I know that fsMDIForm changes the form to look like the Multi-Document
container form, but the fsMDIChild will not recognize an active MDI main
form.
That's it for now, I'm sure I'll have other questions later. :)
________________________________________________________________________
Message: 3
   Date: Wed, 21 Jun 2000 14:52:26 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: EAccessViolation Error with ChatServ

    When I try to compile & run ChatServ.BAS, this i the error message I receive....  Any idea how or why?  I was successful in using it & ChatCli before to chat with myself on this same computer, but now I apparently can't...
    Thanks, Thomas.
[This message contained attachments]
________________________________________________________________________
Message: 4
   Date: Wed, 21 Jun 2000 15:14:31 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: QForm component

>QForm.Cursor
>The "rapidq.inc" has some pre-defined settings for the various cursors.  I
>realized that the definitions refer to the scheme settings and not to
actual
>cursor images ( changing the crosshairs cursor in the mouse settings to an
>hourglass will cause the crCross definition to display the hourglass ).

    Well, the user should be aware of their scheme....and this allows them
to see the same cursors when using Rapid-Q as anywhere else in Windows....
You see, if I had a nature them, I might use a branch for a pointer, a tree
instead of an hourglass, etc.  However, it is expected by the user that
these replacements will be made in all applications, including Rapid-Q
ones....so if I use QForm.Cursor to specify the crosshairs, the user gets
what they are used to seeing for those crosshairs...which may well be an
hourglass, if that's what they've set up.

>What does the setting crSize refer to?  I change QForm.Cursor to crSize
>( -5 ) and there is no apparent affect on the mouse cursor.

    I could be mistaken, but it should be a double-pointed arrow, like
sizing a form...?

>QForm.FormStyle
>Will the pre-defined settings fsMDIChild, fsMDIForm, and fsStayOnTop ever
>work?
    StayOnTop used to work...and does to some extent....
    Thomas.
________________________________________________________________________
Message: 5
   Date: Wed, 21 Jun 2000 13:32:08 -0600 (MDT)
   From: William Yu
Subject: Re: Menu?

On Wed, 21 Jun 2000, William Yu wrote:

> On Tue, 20 Jun 2000, Thomas Simers ("Echecero") wrote:
>
> >     I was wanting to make my QStatusBar display varying messages based upon
> > which item was highlighted in the menu (like many MS programs do), but I
> > didn't see anyway to do it...is there no OnMouse....? or anything for them,
> > or did I miss them (didn'thave the newest docs out, haven't downloaded them
> > yet...)
>
> Unfortunately there's no OnMouse*** for QMenuItem, these "hints" are
> provided using some other technique.  I'll work on implementing it, but
> can't hold any guarantees.

Okay, it's possible, I'll implement this in the next release.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 6
   Date: Wed, 21 Jun 2000 13:39:09 -0600 (MDT)
   From: William Yu
Subject: Re: MAPI

On Wed, 21 Jun 2000, Wilbert Brants wrote:

> Is there an easy way to send a message to the out box of the standard
> mail client ?

You can via SMTP, there's an example in the Contrib directory.

> Looking on the internet I found a page describing how to do this in
> Visual Basic but I don't know how to adjust the code or if there is an
> easier way to do this.  The page is
> http://www.imginfo.com/devonly/devnews/summer1995/burns3.htm
>
> Does anyone know how to do this ?

Using MAPI is more difficult, I don't know if Rapid-Q can use it.  If it's
a COM object, then nope.  I would like to implement COM into Rapid-Q, but
I'm still looking for good low-level documentation on it.  There is a
really good doc at about.com but it's a long read.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 7
   Date: Wed, 21 Jun 2000 13:42:55 -0600 (MDT)
   From: William Yu
Subject: Re: EAccessViolation Error with ChatServ

On Wed, 21 Jun 2000, Thomas Simers ("Echecero") wrote:

>    When I try to compile & run ChatServ.BAS, this i the error message I
> receive....  Any idea how or why?  I was successful in using it &
> ChatCli before to chat with myself on this same computer, but now I
> apparently can't.

Does ChatCli run at all?  There's a PRINT statement in ChatServ.BAS, just
remove the $APPTYPE GUI part and see if it runs.
Other than that I don't know what the problem is, could be WinSock 2, but
if you said it ran before then you must have WinSock 2 already...
When was the last time you tested it?  Anyone else have problems?

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 8
   Date: Wed, 21 Jun 2000 13:50:11 -0600 (MDT)
   From: William Yu
Subject: Re: QForm component

On Wed, 21 Jun 2000, Steven Edwards wrote:

> QForm.Cursor
> The "rapidq.inc" has some pre-defined settings for the various cursors.  I
> realized that the definitions refer to the scheme settings and not to actual
> cursor images ( changing the crosshairs cursor in the mouse settings to an
> hourglass will cause the crCross definition to display the hourglass ).
> What does the setting crSize refer to?  I change QForm.Cursor to crSize
> ( -5 ) and there is no apparent affect on the mouse cursor.

crSize doesn't work for me either, in Delphi 3 it does nothing, in Delphi
5 it just hides the mouse pointer :)

> QForm.FormStyle
> Will the pre-defined settings fsMDIChild, fsMDIForm, and fsStayOnTop ever
> work?

Probably not... unfortunately.  I basically given up on these, it's not
worth wasting more time on.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 9
   Date: Wed, 21 Jun 2000 17:41:52 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: Menu?

>>I was wanting to make my QStatusBar display varying messages based upon
>
>Okay, it's possible, I'll implement this in the next release.
    Thank you William!!!  You're wonderful!!!
        [and so is Rapid-Q!]
    Thomas Echecero@Crosswinds.net
________________________________________________________________________
Message: 10
   Date: Wed, 21 Jun 2000 17:47:00 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: EAccessViolation Error with ChatServ

>Does ChatCli run at all?  There's a PRINT statement in ChatServ.BAS, just
>remove the $APPTYPE GUI part and see if it runs.
>Other than that I don't know what the problem is, could be WinSock 2, but
>if you said it ran before then you must have WinSock 2 already...
>When was the last time you tested it?  Anyone else have problems?
    The first time I tested it was when I first got Rapid-Q, before I was
online....  However, I found the problem...I have to open ChatServ when I'm
connected to the internet...then I can disconnect and it will still
work....but I >know< I didn't have to before, with the earliest version I've
used, because I didn't have 'net access...I downloaded Rapid-Q at school,
saved it to floppy and carried it home...
    Anyway, now that I know that, I'm okay.  Yes, ChatCli runs just fine,
something in ChatServ (I figure where it tries to find my computer's
HostName, as best as I can tell) forces it to be connected to the internet.
    Thanks again!
    OH, and you said "Yes, but you also need the correct ports in order to
connect. These should be published/known to all clients."
    How do I know what port(s)?  If I wanted to say, make my computer the
host...? And how bad of a security problem does that present? [I'm new to
the internet, mind you, and even newer to working with its "inner
secrets"...]
    Thomas.
________________________________________________________________________
Message: 11
   Date: Wed, 21 Jun 2000 18:00:11 -0600 (MDT)
   From: William Yu
Subject: Re: EAccessViolation Error with ChatServ

On Wed, 21 Jun 2000, Thomas Simers ("Echecero") wrote:

>     Anyway, now that I know that, I'm okay.  Yes, ChatCli runs just fine,
> something in ChatServ (I figure where it tries to find my computer's
> HostName, as best as I can tell) forces it to be connected to the internet.

You shouldn't have to be connected to the internet for it to work, but I'm
glad you've found a way to make it work, I'm not sure what the problem is.

>     OH, and you said "Yes, but you also need the correct ports in order to
> connect. These should be published/known to all clients."
>
>     How do I know what port(s)?  If I wanted to say, make my computer the
> host...?  and how bad of a security problem does that present? [I'm new to
> the internet, mind you, and even newer to working with its "inner
> secrets"...]

If you're running a service like ICQ or whatever, people need to know what
ports are available (this may actually be hidden by the application, I
haven't used ICQ in 2 years).
http://www.chebucto.ns.ca/~rakerman/port-table.html
Has some published ports listed.  You just decide which ports to open and
clients can connect.  HTTP is usually port 80, FTP port 21 I think.
It's like the chat server/client program, the server decides to open port
5000 to the public, a client from whereever can hook up to your IP on port
5000 and connect.  You can check their peer IP and do security checks like
that, but the internet is wide open.  Try encrypting your strings before
sending them, or however you want to send data.
Try picking ports >1024 since some OSes run services and use ports < 1024.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 12
   Date: Wed, 21 Jun 2000 17:18:50 -0700
   From: brynm
Subject: Re: EAccessViolation Error with ChatServ

Do you have a network card in your machine?  If you don't, that may be why
you have to connect.  What did you have to do to connect to the internet
(like install Dial-Up-Networking)?

Just curious
bm :)-~

----- Original Message -----
From: "William Yu"
Sent: Wednesday, June 21, 2000 5:00 PM
Subject: Re: [rapidq] EAccessViolation Error with ChatServ

> On Wed, 21 Jun 2000, Thomas Simers ("Echecero") wrote:
>
> >     Anyway, now that I know that, I'm okay.  Yes, ChatCli runs just
fine,
> > something in ChatServ (I figure where it tries to find my computer's
> > HostName, as best as I can tell) forces it to be connected to the
internet.
>
> You shouldn't have to be connected to the internet for it to work, but I'm
> glad you've found a way to make it work, I'm not sure what the problem is.
>
> >     OH, and you said "Yes, but you also need the correct ports in order
to
> > connect. These should be published/known to all clients."
> >
> >     How do I know what port(s)?  If I wanted to say, make my computer
the
> > host...?  and how bad of a security problem does that present? [I'm new
to
> > the internet, mind you, and even newer to working with its "inner
> > secrets"...]
>
> If you're running a service like ICQ or whatever, people need to know what
> ports are available (this may actually be hidden by the application, I
> haven't used ICQ in 2 years).
> http://www.chebucto.ns.ca/~rakerman/port-table.html
> Has some published ports listed.  You just decide which ports to open and
> clients can connect.  HTTP is usually port 80, FTP port 21 I think.
> It's like the chat server/client program, the server decides to open port
> 5000 to the public, a client from whereever can hook up to your IP on port
> 5000 and connect.  You can check their peer IP and do security checks like
> that, but the internet is wide open.  Try encrypting your strings before
> sending them, or however you want to send data.
> Try picking ports >1024 since some OSes run services and use ports < 1024.
>
> +--------------------------------+   __
> | E-mail: voxel@edmc.net         |___| \_____________________
> | http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
> +--------------------------------+   +_________________________)
________________________________________________________________________
Message: 13
   Date: Wed, 21 Jun 2000 21:41:08 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: EAccessViolation Error with ChatServ

>Do you have a network card in your machine?  If you don't, that may be why
>you have to connect.  What did you have to do to connect to the internet
>(like install Dial-Up-Networking)?
    I understand your disbelief...I dont' get it either..
    My machine is a network one...it has a card, its installed, I haven't
used it in some time (couple years), though.
    To connect to the internet I just clicked on my connection icon...in
Dial Up Networking...and it dialed the phone...
    Thomas.
________________________________________________________________________
Message: 14
   Date: Thu, 22 Jun 2000 03:29:46 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: QRichEdit

    Is there any way to force a QRichEdit to scroll?  I'm trying to display
text as its created, and it needs to be in a QRichEdit...but I find that I
must scroll the box myself, and I'd rather that the last line of the text
always be the last visible thing in the box....?  Is there a way to do that?
    Thanks, Thomas.
________________________________________________________________________
Message: 15
   Date: Thu, 22 Jun 2000 02:11:30 -0600 (MDT)
   From: William Yu
Subject: Re: QRichEdit

On Thu, 22 Jun 2000, Thomas Simers ("Echecero") wrote:

>     Is there any way to force a QRichEdit to scroll?  I'm trying to
> display text as its created, and it needs to be in a QRichEdit...but I
> find that I must scroll the box myself, and I'd rather that the last
> line of the text always be the last visible thing in the box....?  Is
> there a way to do that?

Hmmm, that's strange, I forgot to implement a Handle for QRichEdit, which
means it's not possible at the moment, but it's quite easy, once I get the
Handle property in.  I must have dreamed that I put it in...

RichEdit.SelStart = LEN(RichEdit.Text)
SendMessage(RichEdit.Handle, &HB7, 0, 0)

&HB7 is EM_SCROLLCARET which basically scrolls your RichEdit until the
caret is in view.  Perhaps save this message for future reference.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 16
   Date: Thu, 22 Jun 2000 04:19:00 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: QRichEdit

>Hmmm, that's strange, I forgot to implement a Handle for QRichEdit, which
>
>&HB7 is EM_SCROLLCARET which basically scrolls your RichEdit until the
>caret is in view.  Perhaps save this message for future reference.

    Thank you!  I found a Message that I was going to try (EM_LINESCROLL),
but then I too noticed the lack of a handle...which also made my SetFocus()
fail...

    Now that I know how, I won't be impatient in awaiting the next version
with QRichEdit.Handle.
    Thanks again!!! Thomas.
________________________________________________________________________
Message: 17
   Date: Thu, 22 Jun 2000 10:39:31 +0200
   From: "Wilbert Brants"
Subject: Re: MAPI

Dear William,
Thanks for your answer but with the file you are referring to I have to know the smtp server and if I would like to give someone else the opportunity to send me a generated message I don't know his smtp sever.
The MAPI way I asked for is as far as I know no COM object. It uses three functions from the MAPI32.DLL library. I found an even better documented one on the basicguru site
http://www.basicguru.com/dickinson/files/pb_map2.bas
But it's in PB and if I try to convert the source I get errors. You see, I don't know that much of RQ and PB and passing information to a DLL is rather complex (for me).
Kind Regards, Wilbert
[This message contained attachments]
________________________________________________________________________
Message: 18
   Date: Thu, 22 Jun 2000 04:58:46 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: WorkArea...
    ...I've been asking a lot of you William...I'm sorry, but I have one
more question before I call it a night...
    <>
    I know that Screen.Width and Screen.Height give a good idea of the area
available, but I think a Workarea.Height and Workarea.Width would be of more
use, so that we can make windows to fill the available space, but not cover
the taskbar(s)...?
    Thomas.
________________________________________________________________________
Message: 19
   Date: Thu, 22 Jun 2000 10:03:57 -0000
   From: "Daniel Foote"
Subject: Colour chooser dialogs...

Hello all!
I need to implement a colour chooser dialog. I have tried the windows
one, as demonstrated in the Knowledge base, however, this sorta mucks
things up (freeze program after clicking "Ok"). Could:
a) somebody explain why things don't work OR
b) we just attribute the problem to windows, call it unfixable, and
instead use something like the RGB.bas to form the basis of a colour
chooser? I would like option b). Of course credit where credit due...
 One thing to note about the Windows colour dialog: the idea is that
you have your main form, and then an options form is brought up. Then
the dialog is evoked when the "Change colour" button is clicked.
Immediately the options form vanishes, and after clicking "ok" on the
dialog, you can not use anything. The only way to quit is to use
ALT+CTRL+Delete and select "End task" (I hate doing this... it stops
my MP3's from playing in the background whilst the ALT+CTRL+Delete
diaog box is up).
I hope somebody can help!
Thankyou, Daniel Foote.
________________________________________________________________________
Message: 20
   Date: Thu, 22 Jun 2000 13:34:20 -0000
   From: "d turland"
Subject: QTreeView - unable to xtract item().***

Cant seem to get anything out of QTreeView.item()   ie

Dim zzz as string
zzz=tree.item(1).Text
showmessage zzz

Just doesnt show anything. Darren
________________________________________________________________________
Message: 21
   Date: Thu, 22 Jun 2000 10:57:55 EDT
   From: rpgconcep82113@aol.com
Subject: (no subject)

 I bet this is probably a stupid question ever.. or what... can i use
DIRECTDRAW in RQ? :-)


FAQ-002

Rapid-Q Documentation Project (RQDP) | Release 01 FAQ - 002
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | faq002.html/Andreas Fink/Serban S./01

-------------------------------------------------------------
Hi all,
   This is my complete RapidQ-List archive. It begins in late
June 2000. In late October 2000 I've decided to unsubscribe
because there wasn't much more than general complaints about
William's choice and discussion of alternatives to RapidQ.
Then I have February 2001 sice the 17th...

Please scan this for good Question & Answer pairs...

FastCow AKA Andreas Fink
-------------------------------------------------------------
________________________________________________________________________
Message: 21
   Date: Thu, 22 Jun 2000 10:57:55 EDT
   From: rpgconcep82113@aol.com
Subject: (no subject)

i bet this is probably a stupid question ever.. or what... can i use
DIRECTDRAW in RQ? :-)
________________________________________________________________________
Message: 22
   Date: Thu, 22 Jun 2000 12:28:44 -0400
   From: "Thomas Simers (\"Echecero\")"
Subject: Re: Colour chooser dialogs...

>b) we just attribute the problem to windows, call it unfixable, and
>instead use something like the RGB.bas to form the basis of a colour
>chooser? I would like option b). Of course credit where credit due...
    I've been using this alteration of RGB.bas.  There may be something
better out there, but I just set the ScrollBars to the last used values for
the color attribute the user is now setting, then call BGForm.Show
    When BGok is pressed, the routine it goes to uses the BGForm.Caption to
determine which attribute (my most recent usage checks to see if
INSTR(BGForm.Caption, "FG")>0 to know its the Foreground Color and "BG" for
background, but it could be anything, of coure.
    I didn't notice the Windows one on the knowledge base page, I'll have to
go look into that. Thomas.

FUNCTION ConvertRGB(R AS INTEGER, G AS INTEGER, B AS INTEGER) AS INTEGER
  ConvertRGB = (B SHL 16) OR (G SHL 8) OR R
END FUNCTION

DIM BGForm AS QForm
  DIM LabelRed AS QLabel
  WITH LabelRed
    .parent=BGForm
    .Left = 10
    .Top = 22
    .Caption = "Red:"
  END WITH
  DIM LabelGreen AS QLabel
  WITH LabelGreen
    .parent=BGForm
    .Left = 5
    .Top = 52
    .Caption = "Green:"
  END WITH
  DIM LabelBlue AS QLabel
  WITH LabelBlue
    .parent=BGForm
    .Left = 10
    .Top = 82
    .Caption = "Blue:"
  END WITH
  DIM LabelNum1 AS QEdit
  WITH LabelNum1
    .parent=BGForm
    .Left = 270
    .Width=75
    .Top = 22
    .Text = "0"
    .OnChange=LChange
  END WITH
  DIM LabelNum2 AS QEdit
  WITH LabelNum2
    .parent=BGForm
    .Left = 270
    .Width=75
    .Top = 52
    .Text = "0"
    .OnChange=LChange
  END WITH
  DIM LabelNum3 AS QEdit
  WITH LabelNum3
    .parent=BGForm
    .Left = 270
    .Width=75
    .Top = 82
    .Text = "0"
    .OnChange=LChange
  END WITH
  DIM ScrollRed AS QScrollBar
  WITH ScrollRed
    .parent=BGForm
    .Left = 50
    .Top = 20
    .Width = 200
    .Height = 20
    .Min = 0
    .Max = 255
    .LargeChange=10
    .ShowHint =  True
    .Hint = "Red Attribute"
    .OnChange = ColorChange
  END WITH
  DIM ScrollGreen AS QScrollBar
  WITH ScrollGreen
    .parent=BGForm
    .Left = 50
    .Top = 50
    .Width = 200
    .Height = 20
    .Min = 0
    .Max = 255
    .LargeChange=10
    .ShowHint =  True
    .Hint = "Green Attribute"
    .OnChange = ColorChange
  END WITH
  DIM ScrollBlue AS QScrollBar
  WITH ScrollBlue
    .parent=BGForm
    .Left = 50
    .Top = 80
    .Width = 200
    .Height = 20
    .Min = 0
    .Max = 255
    .LargeChange=10
    .ShowHint =  True
    .Hint = "Blue Attribute"
    .OnChange = ColorChange
  END WITH
  DIM PaintBox AS QCanvas
  WITH PaintBox
    .parent=BGForm
    .Left = 50
    .Top = 110
    .Height = 90
    .Width = 200
    .OnPaint = Paint
  END WITH
  DIM BGok AS QButton
  WITH BGok
 .parent=BGForm
 .left=255
 .width=90
 .height=20
 .top=180
 .caption="OK"
 .onClick=BGokClick
  END WITH
  WITH BGForm
   .Caption = "Select FG Color"
   .FormStyle=3
   .BorderStyle=4
   .Width=355
   .Height=230
   .Center
  END WITH

SUB ColorChange
 LabelNum1.OnChange=0
 LabelNum2.OnChange=0
 LabelNum3.OnChange=0
  LabelNum1.Text = STR$(ScrollRed.Position)
  LabelNum2.Text = STR$(ScrollGreen.Position)
  LabelNum3.Text = STR$(ScrollBlue.Position)
  Paint
 LabelNum1.OnChange=LChange
 LabelNum2.OnChange=LChange
 LabelNum3.OnChange=LChange
END SUB

SUB Paint
  PaintBox.Paint(0,0,ConvertRGB(ScrollRed.Position, ScrollGreen.Position,
ScrollBlue.Position), _
                     ConvertRGB(ScrollRed.Position, ScrollGreen.Position,
ScrollBlue.Position))
END SUB

SUB LChange
 ScrollRed.OnChange=0
 ScrollGreen.OnChange=0
 ScrollBlue.OnChange=0
 ScrollRed.Position=VAL(LabelNum1.Text)
 ScrollGreen.Position=VAL(LabelNum2.Text)
 ScrollBlue.Position=VAL(LabelNum3.Text)
 Paint
 ScrollRed.OnChange=ColorChange
 ScrollGreen.OnChange=ColorChange
 ScrollBlue.OnChange=ColorChange
END SUB

________________________________________________________________________
Message: 23
   Date: Thu, 22 Jun 2000 13:28:46 -0600 (MDT)
   From: William Yu
Subject: Re: Re: MAPI

On Thu, 22 Jun 2000, Wilbert Brants wrote:
> Thanks for your answer but with the file you are referring to I have to
> know the smtp server and if I would like to give someone else the
> opportunity to send me a generated message I don't know his smtp sever.
> The MAPI way I asked for is as far as I know no COM object. It uses
> three functions from the MAPI32.DLL library. I found an even better
> documented one on the basicguru site
> http://www.basicguru.com/dickinson/files/pb_map2.bas

It looks like it's possible then, just a lot of work in converting it...

> But it's in PB and if I try to convert the source I get errors. You see,
> I don't know that much of RQ and PB and passing information to a DLL is
> rather complex (for me).

There's a lot of conversion that needs to be done, changing all the ASCIIZ
datatypes to LONG in UDTs, changing ASCIIZ to STRING in the DLL
parameters, etc... if I can find the time I'll attempt to convert some of
them.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 24
   Date: Thu, 22 Jun 2000 21:35:23 +0200
   From: "Erlend Rovik"
Subject: Re: Colour chooser dialogs...

Are you using showmodal? I guess you are and this will freeze everything,
don't know why but try this instead:

CREATE form as qform
show ' instead of showmodal
END CREATE
DO
 DoEvents
LOOP UNTIL form.Visible = 0

Works for me...

-----Original Message-----
From: Daniel Foote
To: rapidq@egroups.com
Date: 22. juni 2000 12:04
Subject: [rapidq] Colour chooser dialogs...

>Hello all!
>
>I need to implement a colour chooser dialog. I have tried the windows
>one, as demonstrated in the Knowledge base, however, this sorta mucks
>things up (freeze program after clicking "Ok"). Could:
>a) somebody explain why things don't work OR
>b) we just attribute the problem to windows, call it unfixable, and
>instead use something like the RGB.bas to form the basis of a colour
>chooser? I would like option b). Of course credit where credit due...
>
>One thing to note about the Windows colour dialog: the idea is that
>you have your main form, and then an options form is brought up. Then
>the dialog is evoked when the "Change colour" button is clicked.
>Immediately the options form vanishes, and after clicking "ok" on the
>dialog, you can not use anything. The only way to quit is to use
>ALT+CTRL+Delete and select "End task" (I hate doing this... it stops
>my MP3's from playing in the background whilst the ALT+CTRL+Delete
>diaog box is up).
>I hope somebody can help!
>Thankyou, Daniel Foote.
________________________________________________________________________
Message: 25
   Date: Thu, 22 Jun 2000 13:31:30 -0600 (MDT)
   From: William Yu
Subject: Re: WorkArea...

On Thu, 22 Jun 2000, Thomas Simers ("Echecero") wrote:

>     ...I've been asking a lot of you William...I'm sorry, but I have one
> more question before I call it a night...
>
>     < taskbar. To retrieve the size of the work area, call the
> SystemParametersInfo function with SPI_GETWORKAREA.>>
>
>     I know that Screen.Width and Screen.Height give a good idea of the area
> available, but I think a Workarea.Height and Workarea.Width would be of more
> use, so that we can make windows to fill the available space, but not cover
> the taskbar(s)...?

I guess I could do that, let me know what kind of application you had in
mind that does that.  It doesn't seem that useful, since you can just
maximize your app to fill the workarea.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
From - Fri Jun 23 14:44:38 2000
------------------------------------------------------------------------
There are 4 messages in this issue.
Topics in this digest:
      1. Re: Colour chooser dialogs...
           From: William Yu
      2. Re: QTreeView - unable to xtract item().***
           From: William Yu
      3. Re: (no subject)
           From: William Yu
      4. Re: (no subject)
           From: rpgconcep82113@aol.com
________________________________________________________________________
Message: 1
   Date: Thu, 22 Jun 2000 13:48:06 -0600 (MDT)
   From: William Yu
Subject: Re: Colour chooser dialogs...

On Thu, 22 Jun 2000, Daniel Foote wrote:

> I need to implement a colour chooser dialog. I have tried the windows
> one, as demonstrated in the Knowledge base, however, this sorta mucks
> things up (freeze program after clicking "Ok"). Could:
> a) somebody explain why things don't work OR

Do you have the latest libraries?  I can't imagine what the problem is...
Maybe it's an older version... I recall updating it last week.

BTW, does ReadUDT work for you now?  You mentioned something about the
array of UDT causing problems, and I couldn't reproduce it, is it still
acting up?

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 2
   Date: Thu, 22 Jun 2000 13:50:18 -0600 (MDT)
   From: William Yu
Subject: Re: QTreeView - unable to xtract item().***

On Thu, 22 Jun 2000, d turland wrote:

> Cant seem to get anything out of QTreeView.item()   ie
>
> Dim zzz as string
> zzz=tree.item(1).Text
> showmessage zzz

Oops, thanks for the bug report, I seem to have plugged in an extra line
which shouldn't be there.  Sorry for the inconvenience, it will be fixed
in the next release.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 3
   Date: Thu, 22 Jun 2000 13:55:14 -0600 (MDT)
   From: William Yu
Subject: Re: (no subject)

On Thu, 22 Jun 2000 rpgconcep82113@aol.com wrote:

> i bet this is probably a stupid question ever.. or what... can i use
> DIRECTDRAW in RQ? :-)

Not directly, but it's implemented as QDXSCREEN.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 4
   Date: Thu, 22 Jun 2000 18:23:43 EDT
   From: rpgconcep82113@aol.com
Subject: Re: (no subject)

In a message dated 6/22/00 12:58:55 PM Pacific Daylight Time,
voxel@freenet.edmonton.ab.ca writes:
<< > I bet this is probably a stupid question ever.. or what... can i use
 > DIRECTDRAW in RQ? :-)

 Not directly, but it's implemented as QDXSCREEN.
  >>

ODXSCREEN? what it has do? will you have some of feature with directdraw? :p
----------------------------------------------------------
We are the programmer, so is the God
________________________________________________________________________
From - Fri Jun 23 14:44:40 2000
------------------------------------------------------------------------
There are 8 messages in this issue.
Topics in this digest:
      1. Re: Colour chooser dialogs...
           From: "Daniel Foote"
      2. Re: Re: Colour chooser dialogs...
           From: William Yu
      3. Re: (no subject)
           From: William Yu
      4. The Menu Editor?
           From: chRis=A9
      5. Numbers in scientific notation
           From: "Achilles Mina"
      6. Re: Numbers in scientific notation
           From: William Yu
      7. Re: Numbers in scientific notation
           From: William Yu
      8. Re: Numbers in scientific notation
           From: "wasaywasay"
________________________________________________________________________
Message: 1
   Date: Fri, 23 Jun 2000 00:21:02 -0000
   From: "Daniel Foote"
Subject: Re: Colour chooser dialogs...

Hello all!
Well, yes, I do have the latest libraries (not the small libraries).
By the way, to show the colour dialog ShowModal is not used, but for
the options form it is. Weird. I think it would just be easier to use
something like RGB.bas - but I have only one problem. How do I decode
an integer into three hexidecimal values for colour, in the correct
RapidQ order?
As well as that, yes, the ReadUDT problem is fixed - it reads strings=20
perfectly now. Thankyou very much!!
Thankyou all, Daniel Foote

--- In rapidq@egroups.com, William Yu  wrote:
> On Thu, 22 Jun 2000, Daniel Foote wrote:
>=20
> > I need to implement a colour chooser dialog. I have tried the=20
windows=20
> > one, as demonstrated in the Knowledge base, however, this sorta=20
mucks=20
> > things up (freeze program after clicking "Ok"). Could:
> > a) somebody explain why things don't work OR
>=20
> Do you have the latest libraries?  I can't imagine what the problem=20
is...
> Maybe it's an older version... I recall updating it last week.
>=20
> BTW, does ReadUDT work for you now?  You mentioned something about=20
the
> array of UDT causing problems, and I couldn't reproduce it, is it=20
still
> acting up?
> +--------------------------------+   __
> | E-mail: voxel@e...         |___| \_____________________
> | http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
> +--------------------------------+   +_________________________)
________________________________________________________________________
Message: 2
   Date: Thu, 22 Jun 2000 18:27:23 -0600 (MDT)
   From: William Yu
Subject: Re: Re: Colour chooser dialogs...

On Fri, 23 Jun 2000, Daniel Foote wrote:

> Well, yes, I do have the latest libraries (not the small libraries).=20
> By the way, to show the colour dialog ShowModal is not used, but for=20
> the options form it is. Weird. I think it would just be easier to use=20
> something like RGB.bas - but I have only one problem. How do I decode=20
> an integer into three hexidecimal values for colour, in the correct=20
> RapidQ order?

Do you mean something like this:

Clr =3D 349579345
Blue =3D Clr AND &HFF0000
Green =3D Clr AND &HFF00
Red =3D Clr AND &HFF

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 3
   Date: Thu, 22 Jun 2000 18:30:27 -0600 (MDT)
   From: William Yu
Subject: Re: (no subject)

On Thu, 22 Jun 2000 rpgconcep82113@aol.com wrote:
> In a message dated 6/22/00 12:58:55 PM Pacific Daylight Time,=20
> voxel@freenet.edmonton.ab.ca writes:
>=20
> << > i bet this is probably a stupid question ever.. or what... can i use=
=20
>  > DIRECTDRAW in RQ? :-)
>=20=20
>  Not directly, but it's implemented as QDXSCREEN.
>   >>
>=20
>
> DXSCREEN? what it has do? will you have some of feature with directdraw?
> :p

QDXSCREEN encapsulates some of the features of directdraw, you can see how
this is done with some of the examples listed.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 4
   Date: Thu, 22 Jun 2000 18:23:50 -0700
   From: chRis=A9
Subject: The Menu Editor?
    I know it's easy, but I'm screwing up somewhere on the menu editor. I m=
ake the menu, copy and paste the code. Is there something else I'm supposed=
 to do? -chris
[This message contained attachments]
________________________________________________________________________
Message: 5
   Date: Fri, 23 Jun 2000 07:30:04 -0000
   From: "Achilles Mina"
Subject: Numbers in scientific notation
Hello all,
I would like to know if there's a way to force Rapid-Q's STR$ not to=20
prematurely convert an output to scientific notation. To illustrate:

defdbl b

a =3D 99999
b =3D 1/a
b$ =3D STR$(b)

print b         ' 0.000010000
print
print b$        ' 1.00001E-5

do
loop until inkey$ <> ""

As it stands now, Rapid-Q will give 1.000010000, an incorrect output,
if you do val(b$).
Thanks in advance for your help. Achilles
________________________________________________________________________
Message: 6
   Date: Fri, 23 Jun 2000 01:40:33 -0600 (MDT)
   From: William Yu
Subject: Re: Numbers in scientific notation

On Fri, 23 Jun 2000, Achilles Mina wrote:
> I would like to know if there's a way to force Rapid-Q's STR$ not to=20
> prematurely convert an output to scientific notation. To illustrate:
>=20
> defdbl b
>=20
> a =3D 99999
> b =3D 1/a
> b$ =3D STR$(b)
>=20
> print b         ' 0.000010000
> print
> print b$        ' 1.00001E-5
>=20
> do
> loop until inkey$ <> ""
>=20
> As it stands now, Rapid-Q will give 1.000010000, an incorrect output,=20
> if you do val(b$).

Actually, you've discovered a bug in the VAL function, it wasn't
recognizing 'E' it was only taking 'e' instead.
Problem will be fixed in the next release, for now you can try using STRF$
or FORMAT$ with more precision.

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 7
   Date: Fri, 23 Jun 2000 01:42:33 -0600 (MDT)
   From: William Yu
Subject: Re: Numbers in scientific notation

On Fri, 23 Jun 2000, William Yu wrote:
> On Fri, 23 Jun 2000, Achilles Mina wrote:
>=20
> > I would like to know if there's a way to force Rapid-Q's STR$ not to=20
> > prematurely convert an output to scientific notation. To illustrate:
> >=20
> > defdbl b
> >=20
> > a =3D 99999
> > b =3D 1/a
> > b$ =3D STR$(b)
> >=20
> > print b         ' 0.000010000
> > print
> > print b$        ' 1.00001E-5
> >=20
> > do
> > loop until inkey$ <> ""
> >=20
> > As it stands now, Rapid-Q will give 1.000010000, an incorrect output,=20
> > if you do val(b$).
>=20
> Actually, you've discovered a bug in the VAL function, it wasn't
> recognizing 'E' it was only taking 'e' instead.
> Problem will be fixed in the next release, for now you can try using STRF$
> or FORMAT$ with more precision.

Oh, just another suggestion:  VAL(LCASE$(B$))
Works too...
+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)
________________________________________________________________________
Message: 8
   Date: Fri, 23 Jun 2000 16:02:18 +0800
   From: "wasaywasay"
Subject: Re: Numbers in scientific notation

Righto. Thanks again William.
Achilles
----- Original Message -----
From: William Yu
To:
Sent: Friday, June 23, 2000 3:42 PM
Subject: Re: [rapidq] Numbers in scientific notation

> On Fri, 23 Jun 2000, William Yu wrote:
>
> > On Fri, 23 Jun 2000, Achilles Mina wrote:
> >
> > > I would like to know if there's a way to force Rapid-Q's STR$ not to
> > > prematurely convert an output to scientific notation. To illustrate:
> > >
> > > defdbl b
> > >
> > > a =3D 99999
> > > b =3D 1/a
> > > b$ =3D STR$(b)
> > >
> > > print b         ' 0.000010000
> > > print
> > > print b$        ' 1.00001E-5
> > >
> > > do
> > > loop until inkey$ <> ""
> > >
> > > As it stands now, Rapid-Q will give 1.000010000, an incorrect output,
> > > if you do val(b$).
> >
> > Actually, you've discovered a bug in the VAL function, it wasn't
> > recognizing 'E' it was only taking 'e' instead.
> > Problem will be fixed in the next release, for now you can try using
STRF$
> > or FORMAT$ with more precision.
>
> Oh, just another suggestion:  VAL(LCASE$(B$))
> Works too...
>
> +--------------------------------+   __
> | E-mail: voxel@edmc.net         |___| \_____________________
> | http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
> +--------------------------------+   +_________________________)
________________________________________________________________________
From - Sat Jun 24 10:47:01 2000
------------------------------------------------------------------------
There are 25 messages in this issue.
Topics in this digest:
      1. Re: Colour chooser dialogs...
           From: "Daniel Foote"
      2. Bug? QForm.ShowTitleBar
           From: "Steven Edwards"
      3. Re: Re: Colour chooser dialogs...
           From: "Steven Edwards"
      4. how to write....
           From: rpgconcep82113@aol.com
      5. Non-blocking call for QSocket
           From: "Daitau Aaron"
      6. Re: MAPI
           From: "Wilbert Brants"
      7. Re: Re: Colour chooser dialogs...
           From: William Yu
      8. Re: Bug? QForm.ShowTitleBar
           From: William Yu
      9. Re: how to write....
           From: William Yu
     10. Re: Non-blocking call for QSocket
           From: William Yu
     11. Font setting bug in IDE?
           From: "Daitau Aaron"
     12. Re: Re: MAPI
           From: William Yu
     13. Re: how to write....
           From: rpgconcep82113@aol.com
     14. Creating a Custom Component.Problem
           From: brynm
     15. Re: Creating a Custom Component.Problem
           From: "Erlend Rovik"
     16. Re: Creating a Custom Component.Problem
           From: brynm
     17. Re: Creating a Custom Component.Problem
           From: "Erlend Rovik"
     18. Re: Creating a Custom Component.Problem
           From: brynm
     19. Re: Creating a Custom Component.Problem
           From: "Erlend Rovik"
     20. Re: Creating a Custom Component.Problem
           From: brynm
     21. Re: Creating a Custom Component.Problem
           From: brynm
     22. Re: Creating a Custom Component.Problem
           From: "Erlend Rovik"
     23. Re: Creating a Custom Component.Problem
           From: William Yu
     24. Re: Creating a Custom Component.Problem
           From: brynm
     25. Re: Bug? QForm.ShowTitleBar
           From: "Steven Edwards"
________________________________________________________________________
Message: 1
   Date: Fri, 23 Jun 2000 12:19:20 -0000
   From: "Daniel Foote"
Subject: Re: Colour chooser dialogs...
Hello all!
Ok, I'd like to know if I could include RGB.bas as part of my
program? Is this ok? Don't worry, credit will be given to William for
this portion of the program.
As well as that, I can now make a number into it's component colours,
but how do I do it the other way? The old RGB.bas had a function for
it, but the examples don't include the old RGB.bas anymore - just a
new version which does not include such a function.
Thankyou, Daniel.

--- In rapidq@egroups.com, William Yu  wrote:
> On Fri, 23 Jun 2000, Daniel Foote wrote:
>
> Well, yes, I do have the latest libraries (not the small
>libraries).
> By the way, to show the colour dialog ShowModal is not used, but
>for the options form it is. Weird. I think it would just be easier to
>use something like RGB.bas - but I have only one problem. How do I
>decode an integer into three hexidecimal values for colour, in the
>correct RapidQ order?
>
> Do you mean something like this:
>
> Clr = 349579345
>
> Blue = Clr AND &HFF0000
> Green = Clr AND &HFF00
> Red = Clr AND &HFF
>
> +--------------------------------+   __
> | E-mail: voxel@e...         |___| \_____________________
> | http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
> +--------------------------------+   +_________________________)
________________________________________________________________________
Message: 2
   Date: Fri, 23 Jun 2000 11:18:51 -0500
   From: "Steven Edwards"
Subject: Bug? QForm.ShowTitleBar

In working on the reference for the QForm component ( see, I told you I
would have more questions... ), I have come across what appears to be a bug.
Or is it another "feature"? :)
A QForm.HideTitleBar method call will remove the caption bar AND slide the
remaining client area up so that the top of the client area is now wehre the
top of the caption bar used to be.  The client area is still the same size -
the bottom of the form is pulled upward also.
A following QForm.ShowTitleBar method call willl restore the caption bar,
BUT the outer border remains the same dimensions.  The result is a loss of
about 38 pixels in the height of the client area in the form.
Each Show / Hide reduces the height by another 38 pixels.
I know a reset of the .ClientHeight and .ClientWidth values will restore the
proper dimensions, but this must then be followed by a repaint or the
controls are not redrawn properly.
Here is a code snippet to demonstrate the problem:

create form as qform
  clientheight = 200
  create button as qbutton
    height = 180
  end create
  center
  show
end create

wait = timer
do
loop until timer - wait > 5
form.hidetitlebar
print form.clientheight

wait = timer
do
loop until timer - wait > 5
form.showtitlebar
print form.clientheight
'form.clientheight = 200
'form.repaint

wait = timer
do
loop until timer - wait > 5
form.hidetitlebar
print form.clientheight

wait = timer
do
loop until timer - wait > 5
form.showtitlebar
print form.clientheight
'form.clientheight = 200
'form.repaint

wait = timer
do
loop until timer - wait > 5

________________________________________________________________________
Message: 3
   Date: Fri, 23 Jun 2000 11:22:26 -0500
   From: "Steven Edwards"
Subject: Re: Re: Colour chooser dialogs...

From: Daniel Foote
To:
> As well as that, I can now make a number into it's component colours,
> but how do I do it the other way? The old RGB.bas had a function for
> it, but the examples don't include the old RGB.bas anymore - just a
> new version which does not include such a function.

Here is the function from the old RGB.BAS file:
'' Here's something that will convert your standard RGB to Rapid-Q's BGR.

FUNCTION ConvertRGB(R AS INTEGER, G AS INTEGER, B AS INTEGER) AS INTEGER
  ConvertRGB = (B SHL 16) OR (G SHL 8) OR R
END FUNCTION

________________________________________________________________________
Message: 4
   Date: Fri, 23 Jun 2000 13:30:35 EDT
   From: rpgconcep82113@aol.com
Subject: how to write....

how to write my own custom compnent and compile it? :-)
________________________________________________________________________
Message: 5
   Date: Fri, 23 Jun 2000 18:12:43 GMT
   From: "Daitau Aaron"
Subject: Non-blocking call for QSocket

Hi,
  I noticed in the newer incarnation of the example http.bas there is a way
to make a non-blocking call to QSocket. However the code intertwines with
the UI element, namely a custom formProc needs to be created to intercept
the custom  WM_SOCK message. I wonder if there is any cleaner way to do
that? (I am trying to write some functions so that I could say something
like

  content$=getURL("http://www.yahoo.com:80")

  and I would like the whole thing contained in the getURL function. Any
ideas?
Daitau Aaron
________________________________________________________________________

Message: 6
   Date: Fri, 23 Jun 2000 18:12:34 -0000
   From: "Wilbert Brants"
Subject: Re: MAPI

Dear William,

Thank you for at least considering converting the source. This is
what I have already done. But I keep getting Exception
EAccessViolation errors with the MAPILogon function. Don't know
what's causing that...
Kind Regards, Wilbert
-------

TYPE MAPIRECIP
    iReserved As Long
    iRecipClass As Long
    lpszName As Long
    lpszAddress As Long
    iEIDSize As Long
    lpEntryID As Long
END TYPE

TYPE MAPIFILEDESC
    iReserved As Long
    iFlags As Long
    iPosition As Long
    lpszPathName As Long
    lpszFileName As Long
    lpFileType As Long
END TYPE

TYPE MAPIMESSAGE
    iReserved As Long
    lpszSubject As Long
    lpszNoteText As Long
    lpszMessageType As Long
    lpszDateReceived As Long
    lpszConversationID As Long
    iFlags As Long
    lpOriginator As Long
    iRecipCount As Long
    lpRecips As Long
    iFileCount As Long
    lpFiles As Long
END TYPE

Declare Function MAPILogon Lib "MAPI32.DLL" Alias "MAPILogon" _
        (iParam As Long, zName As String, zPW As String,
iFlags As Long, _
        iReserved As Long, iSession As Long) As Long

Declare Function MAPILogoff Lib "MAPI32.DLL" Alias "MAPILogoff" _
        (iSession As Long, iParam As Long, iFlags As Long, _
        iReserved As Long) As Long

Declare Function MAPISendDocuments Lib "MAPI32.DLL"
Alias "MAPISendDocuments" _
        (iParam As Long, zDelimChar As String, zFilePaths As
String, _
        zFileNames As String, iReserved As Long) As Long

' MapiRtn=MAPISendDocuments (0, "", "c:\netlog.txt", "netlog.txt", 0)
' *** This one sends the c:\netlog.txt document as an attachment and
prompts
' the user for other information ***

Declare Function MAPISendMail Lib "MAPI32.DLL" Alias "MAPISendMail" _
        (iSession As Long, iParam As Long, lpMapiMessage As
Long, _
        iFlags As Long, iReserved As Long) As Long

Dim iSessionID As Long
Dim iMapiRtn As Long
Dim rMessage As MAPIMESSAGE
Dim gRecip As MAPIRECIP

iMapiRtn=MAPILogon(0, "", "", 1, 0, iSessionID)			' ***
MAPI Logon command ***

gRecip.iReserved = 0
gRecip.iRecipClass = 1
Name$="Wilbert Brants"
gRecip.lpszName = VarPtr(Name$)
Address$="wbrants@dds.nl"
gRecip.lpszAddress = VarPtr(Address$)
gRecip.iEIDSize = 0
gRecip.lpEntryID = 0

rMessage.iReserved = 0
Subject$="Test"
rMessage.lpszSubject = VarPtr(Subject$)
NoteText$="This is a test"
rMessage.lpszNoteText = VarPtr(NoteText$)
rMessage.lpszMessageType = 0
DateReceived$="Date$+" "+Time$
rMessage.lpszDateReceived = VarPtr(DateReceived$)
rMessage.lpszConversationID = 0
rMessage.iFlags = 0
rMessage.lpOriginator = 0
rMessage.iRecipCount = 1
rMessage.lpRecips = VarPtr(gRecip)
rMessage.iFileCount = 0
rMessage.lpFiles = 0

iMapiRtn=MAPISendMail (iSessionID, 0, VarPtr(rMessage), 1, 0)
    ' *** MAPI Send mail command ***

iMapiRtn=MAPILogoff (iSessionID, 0, 0, 0)
' *** MAPI Logoff command ***

________________________________________________________________________
Message: 7
   Date: Fri, 23 Jun 2000 12:18:35 -0600 (MDT)
   From: William Yu
Subject: Re: Re: Colour chooser dialogs...

On Fri, 23 Jun 2000, Daniel Foote wrote:

> Ok, I'd like to know if I could include RGB.bas as part of my
> program? Is this ok? Don't worry, credit will be given to William for
> this portion of the program.

I should probably mention this but, all the examples from me are public
domain, the ones without names on them are usually mine, I left them out
for that purpose, samething you'd see in the knowledge base, if no name is
on them, it's public domain.  You can even sell the MSWEEP example if you
wanted ;-)

> As well as that, I can now make a number into it's component colours,
> but how do I do it the other way? The old RGB.bas had a function for
> it, but the examples don't include the old RGB.bas anymore - just a
> new version which does not include such a function.

Because it's redundant, the function was replaced by RGB.  It should
actually be named BGR but $DEFINE BGR RGB solves that :)

+--------------------------------+   __
| E-mail: voxel@edmc.net         |___| \_____________________
| http://www.basicguru.com/abc/  |   |  o o o o o o o o o |__\_
+--------------------------------+   +_________________________)


Rapid-Q Documentation

Rapid-Q Documentation Project (RQDP) | Release 01 FAQ Title page
Current Document/Author/Revision/Release | faqtitle.html/Serban S/Serban S/01


Files.inc

Const FILE_ATTRIBUTE_READONLY = &H1
Const FILE_ATTRIBUTE_HIDDEN = &H2
Const FILE_ATTRIBUTE_SYSTEM = &H4
Const FILE_ATTRIBUTE_DIRECTORY = &H10
Const FILE_ATTRIBUTE_ARCHIVE = &H20
Const FILE_ATTRIBUTE_NORMAL = &H80
Const FILE_ATTRIBUTE_TEMPORARY = &H100
Const FILE_ATTRIBUTE_COMPRESSED = &H800

Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type

Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA"_
 (ByVal lpFileName As String) As Long
Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA"_
 (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long

Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" _
(ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long

'# QUOTE : Returns a quoted string
function Quote (StringToQuote as string) as string
StringToQuote =  chr$(34) + StringToQuote + chr$(34)
result = replacesubstr$(stringtoquote, chr$(34) + chr$(34), chr$(34))
end function

'===============================================================================
'# STRIPPATH : Returns file path (without file name)
Function StripPath (fullname as string) as string
result = left$(fullname, rinstr(fullname, "\"))
end function

'===============================================================================
'# STRIPFILENAME : Returns file name (without path)
Function StripFileName (fullname as string) as string
result = right$(fullname, len(fullname) - rinstr(fullname, "\"))
end function

'===============================================================================
'# STRIPFILEEXT : Returns file extension (like ".exe", ".html" etc.)
Function StripFileExt (fullname as string) as string
result = right$(fullname, len(fullname) - rinstr(fullname, ".") + 1)
end function

'===============================================================================
'# FILENAMENOEXT : Returns file name without extension
function FileNameNoExt(fullname as string) as string
fullname = right$(fullname, len(fullname) - rinstr(fullname, "\"))
result = left$(fullname, rinstr(fullname, ".") - 1)
end function

'===============================================================================
'# FULLPATHNOEXT : Returns full path without file extension
function FullPathNoExt(fullname as string) as string
result = left$(fullname, rinstr(fullname, ".") - 1)
end function

'===============================================================================
'# C_Style : Returns "slashed" path from a "backslashed" one
function C_Style (fullname as string) as string
fullname = replacesubstr$(fullname, "\\", "\")
result = replacesubstr$(fullname, "\", "/")
end function

'===============================================================================
'# SYSDIR : Retrieves windows shell directories

'-------------------------|
' Allowed values for dir  |
'-----------------------------------------------------------------------------|
' Desktop                 | Templates               | AppData                 |
' Start Menu              | Programs                | Startup                 |
' Fonts                   | SendTo                  | Recent                  |
' Favorites               | Cache                   | Cookies                 |
' History                 | NetHood                 | Personal                |
' PrintHood               | Local AppData           | My Pictures             |
' Administrative Tools    |                         |                         |
'-----------------------------------------------------------------------------|

function SysDir (dir as string) as string
DIM fo_reg AS QRegistry
fo_reg.RootKey = &H80000001
fo_reg.openkey ("Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0)
result = fo_reg.readstring(dir) + "\"
end function

'===============================================================================
'# HOMEDIR : The folder where the application is

function homedir() as string
result = left$(command$(0), rinstr(command$(0), "\"))
end function

'===============================================================================
'# BROWSEFORFOLDERS : Returns the selected folder

function BrowseForFolders (initialdir as string, wincapt as string) as string
dim bff_form as qform
with bff_form
.height = 400
.center
.caption = wincapt
.delbordericons 2
end with
dim bff_tree as qdirtree
with bff_tree
.parent = bff_form
.align = 5
end with
if bff_form.caption = "" then bff_form.caption = "Select folder"
if direxists(initialdir) then
bff_tree.directory = initialdir
else
bff_tree.directory = curdir$
end if
bff_form.showmodal
result = bff_tree.directory
end function

'===============================================================================
'# BROWSEFORFILE : Returns the selected folder

Function BrowseForFile (caption as string, filter as string, _
initialdir as string) as string

dim bff_od as qopendialog
with bff_od
.caption = caption
.filter = filter
.initialdir = initialdir

if .execute then
    result = .filename
end if
end with

end function

'_=============================================================================

$ESCAPECHARS ON

'ChangeFileExt:
'Returns: String
'Parameters:
'FileName (String): Name of file with old extention
'NewExt (String): New extention. This must include the leading ".".

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'Changes the extention of FileName to NewExt. For example:
'ChangeFileExt("File.bas", ".inc")
'returns File.inc. This function does not delete the old string,
'instead, it simply returns a new one with the extention.
'You must include the leading "." for it to be added, as it is not
'done by the function.

FUNCTION ChangeFileExt(FileName as String, NewExt as STRING) as STRING
    DIM Returns as STRING
    DIM CurrentExt as String
    DIM CurrentExtLoc as INTEGER
    DIM FileNoExt as STRING

    CurrentExtLoc = RInStr(FileName, ".")
    CurrentExt = MID$(FileName, CurrentExtLoc, LEN(FileName))
    FileNoExt = DELETE$(FileName, CurrentExtLoc, LEN(FileName))

    Result = INSERT$(NewExt, FileNoExt, LEN(FileName))
    ChangeFileExt = Result
END FUNCTION

'ExtractFileName:
'Returns: String
'Parameters:
'FileName (String): File with full path

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ExtractFileName takes a file name with a path and returns only
'the file name. For example:
'ExtractFileName("C:\\Program Files\\AFile.bas")
'returns AFile.bas. You can use either two back-slashes or a single
'forward slash (/) for folder seperators.
'Both forward and back-slashes are supported by Windows.
'The back-slash takes procedure over the forward slash.
'Note that ExtractFileName does _not_ check the validity of the path passed.
'You must check yourself.

FUNCTION ExtractFileName(FileName as STRING) AS STRING
    DIM Length as INTEGER
    DIM Result as STRING

    Length = RInStr(FileName, "\\") OR RInStr(FileName, "/")
    Result = MID$(FileName, Length+1, LEN(FileName) - Length + 1)
    ExtractFileName = Result
END FUNCTION

'ExtractFilePath
'Returns: String
'Parameters:
'FileName (String): File with full path

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ExtractFilePath takes string with full path and returns a string
'with only the path. For example:
'ExtractFilePath("C:\\Program Files\\AProgram.bas")
'returns C:\Program Files (the \\'s are for RQ and back-slashes).
'ExtractFilePath also takes forward-slashes (/). Window's supports
'these as well.
'The back-slash takes procedure over the forward slash.
'Note that ExtractFilePath does _not_ test the validity
'of the passed name. You must check it yourself. Even if the name is
'invalid, the path will be returned. For example, if C:/ProgramErrorFiles/AFile.txt
'is passed, C:/ProgramErrorFiles will be returned.

'-- *****************************************************'
FUNCTION ExtractFilePath(FileName as STRING) AS STRING
    DIM Length as INTEGER
    DIM Result as STRING

    Length = RInStr(FileName, "\\") OR RInStr(FileName, "/")
    Result = MID$(FileName, 0, Length)
    ExtractFilePath = Result
END FUNCTION

'ChangeFileName
'Returns: String
'Parameters:
'FileName (String): File with full path
'NewName (String): Text that will replace old file name

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ChangeFileName takes a file name with full path and file and a new name.
'It replaces the current filename (in FileName) and replaces it with NewName.
'ChangeFileName does not actually change FileName, instead it returns a new
'string which contains the new name.
'Note that ChangeFileName does not check the validity of FileName
'or the new result. You must do it yourself (if you want). ChangeFileName
'takes both the back-slash and forward slash to serperate folder and file names.
'You can use either \\ or /. Both are supported by Windows.
'The back-slash takes procedure over the forward slash.

'-- *****************************************************'
FUNCTION ChangeFileName(FileName as STRING, NewName as STRING) AS STRING
    DIM FileNameLoc as INTEGER
    DIM Result as STRING
    DIM PathNoName AS STRING

    PathNoName = ExtractFilePath(FileName)
    Result = PathNoName+NewName
    ChangeFileName = Result
END FUNCTION

'ChangeFilePath
'Returns: String
'Parameters:
'FileName (String): File with full path
'NewPath (String): New path that will replace the path in FileName

'Information:
'Author: Taj Morton
'Email: tmorton at linuxmail dot org.
'License: Public Domain

'Description:
'ChangeFilePath takes FileName and replaces the path with NewPath.
'It does not change FileName to have the new path, instead, it returns
'a string which has the new path. It's up to you to take the correct
'action. Also, old or new path and names' are not checked for validity,
'you must do it yourself.
'You may use either the \\ or the / to seperate your paths. Windows supports
'both.

'-- *****************************************************'
FUNCTION ChangeFilePath(FileName as STRING, NewPath as STRING) AS STRING
    DIM Result AS STRING
    DIM FileNoPath AS STRING

    FileNoPath = ExtractFileName(FileName)

    Result = NewPath+FileNoPath
    ChangeFilePath = Result
END FUNCTION
$ESCAPECHARS Off

'_==============================================================
'==============================================================
FUNCTION FileSize(FileName as STRING) AS integer
DIM fileStr as QFileStream

if fileexists (FileName)>0 then
fileStr.open (FileName,0)
result=	fileStr.size
fileStr.close
else
result=-1
end if

END FUNCTION
'-- *****************************************************'
FUNCTION SaveString(ss$ as STRING ,FileName as STRING  ) AS integer

if FileName="" then showmessage ("FUNCTION SaveString. Wrong FileName="+FileName)
DIM fileStr as QFileStream
result=0

fileStr.open (FileName,65535 ) 'fmCreate'
result=-1
FileStr.WriteStr(ss$, len(ss$))
FileStr.Close

result=1

END FUNCTION

'-- *****************************************************'
FUNCTION LoadString(FileName as STRING  ) AS string
DIM fileStr as QFileStream
result="0"
'fmOpenRead = 0
if fileStr.open (FileName,0 ) then'fmCreate'
result="-1"
result=FileStr.ReadStr( FileStr.size)
FileStr.Close
'result=1
end if

END FUNCTION

'_==============================================================
'-- *****************************************************'

sub MKSubDir (DirDst$)
'Andrew Shelkovenko dec 2003
'Create DirDst$ directory with full subdir structure
z1=instr(DirDst$,"\")
z2=0
while z1>0
SubDirDst$=left$(DirDst$,z1 )
if DIREXISTS(SubDirDst$)=0 then MKDIR SubDirDst$
'print "SubDirDst$=" ,SubDirDst$
z2=z1+1
z1=instr(z2,DirDst$,"\")

wend
end sub

'-- *****************************************************'
sub SubDirCopy (DirSrc$, DirDst$, mask$) '- -----------------------------------'
'Andrew Shelkovenko dec 2003
'Copy DirSrc$ directory with full subdir structure and files (by mask$) to DirDst$
dim FileSrc as QFileStream
dim FileDst as QFileStream

'Index=0
NumFiles=0
defint nsd1, nsd2
defstr mask
nsd1=0:nsd2=0
NumDir=0
ArrNumDir=500
dim SubDir(500) as string

ArrNumFil=500
dim FileNames (500) as string
mask="*.*"
SubDir(0)=DirSrc$

1
for i=NSD1 to Nsd2 'current level sudirs'
'print "SubDir(",i,")=",SubDir(i)
SubDirname$=dir$(SubDir(i)+mask, faDirectory)

while    SubDirname$ <>""
  if FileRec.Size =0 and SubDirname$<> "." and SubDirname$<> ".." then ''
    inc adddir
    inc NumDir 'add subdir'
if NumDir=ArrNumDir then ArrNumDir=ArrNumDir+300: redim SubDir(ArrNumDir) as string
    SubDir(NumDir)=SubDir(i)+SubDirname$+"\"
''    print "SubDir(", NumDir, ")=",SubDir(NumDir)
else
end if
  SubDirname$=dir$
 doevents:if stops1=1 then stops1=0: exit sub
wend
'search files in current subdirectory
    Fn$=dir$(SubDir(i)+mask$,faAnyFile-faDirectory) ':-)
     while Fn$ <>""
if  Fn$<> "." and Fn$<> ".."  then 'and FileRec.Size <>0'
    inc NumFiles
if NumFiles=ArrNumFil then ArrNumFil=ArrNumFil+300: redim FileNames(ArrNumFil) as string:print "redim FileNames"
 FileNames(NumFiles)=SubDir(i)+Fn$
 print "FileNames(",NumFiles,")=" ,FileNames(NumFiles)

else
end if
    Fn$=dir$
     wend
next i

if adddir>0 then
NSD1=NSD2+1
NSD2=NSD2+adddir
adddir=0
goto 1 'repeat with new sub level
else
end if

' got subdirs list in SubDir(i) array and file list with full path in FileNames(j)
' now create subdirs structure with new path

for i1=0 to i-1
NewSubDir$=SubDir(i1)-DirSrc$
NewSubDir$=DirDst$+NewSubDir$
MKSubDir (NewSubDir$)
next i1

for j=1 to NumFiles
FileSrc.Open(FileNames(j), fmOpenRead)
NewFileName$=FileNames(j)-DirSrc$
NewFileName$=DirDst$+NewFileName$
'print "NewFileName$=" ,NewFileName$
FileDst.Open(NewFileName$, fmCreate)
FileDst.CopyFrom  (FileSrc, 0)''
        FileSrc.close''
        FileDst.close
next j

end sub

'-- *****************************************************'
sub KillSubDir (DirSrc$, mask$) '- -----------------------------------'

'print "-- KillSubDir DirSrc$=",DirSrc$

'Andrew Shelkovenko diakin@narod.ru may 2004
'Kill files by mask$ in all subdirs in DirSrc$ directory and kill all empty subdirs and DirSrc$ (if empty)
'So.. if mask$="*.*" then  kill DirSrc$ with all subdirs and files

dim FileSrc as QFileStream

'Index=0
NumFiles=0
defint nsd1, nsd2
defstr mask
nsd1=0:nsd2=0
NumDir=0
ArrNumDir=500
dim SubDir(500) as string

ArrNumFil=500
dim FileNames (500) as string
mask="*.*"
if right$(DirSrc$,1)<>BkSl then SubDir(0)=DirSrc$+BkSl else SubDir(0)=DirSrc$

'print "BkSl=" ,BkSl

'print "SubDir(0)=" ,SubDir(0)

s1:
for i=NSD1 to Nsd2 'current level sudirs'
    'print "KillSubDir SubDir(",i,")=",SubDir(i)
    SubDirname$=dir$(SubDir(i)+mask, faDirectory)
    'print "-- KillSubDir SubDirname$=",SubDirname$
    while    SubDirname$ <>""
        if FileRec.Size =0 and SubDirname$<> "." and SubDirname$<> ".." then ''
            inc adddir
            inc NumDir 'add subdir'
            if NumDir=ArrNumDir then ArrNumDir=ArrNumDir+300: redim SubDir(ArrNumDir) as string
            subDir(NumDir)=SubDir(i)+SubDirname$+"\"
            'print "--KillSubDir SubDir(", NumDir, ")=",SubDir(NumDir)
        else
        end if
        SubDirname$=dir$
        doevents:if stops1=1 then stops1=0: exit sub
    wend

    'search files in current subdirectory
    Fn$=dir$(SubDir(i)+mask$,faAnyFile-faDirectory) ':-)
    while Fn$ <>""
        if  Fn$<> "." and Fn$<> ".."  then 'and FileRec.Size <>0'
            kill SubDir(i)+Fn$
            'print "-- KillSubDir kill ",SubDir(i)+Fn$
        else
        end if
        Fn$=dir$
    wend
next i

if adddir>0 then
    NSD1=NSD2+1
    NSD2=NSD2+adddir
    adddir=0
    goto s1 'repeat with new sub level
else
end if

for i1=i-1 to 1 step -1
    RMDIR SubDir(i1)
    'print "-- KillSubDir RMDIR SubDir(",i1,")=", SubDir(i1)
next i1

END SUB

sub DirCopy (DirSrc$, DirDst$, mask$) '- -----------------------------------'
'Andrew Shelkovenko dec 2003
'Copy files (by mask$) from DirSrc$ to DirDst$
dim FileSrc as QFileStream
dim FileDst as QFileStream
MKDIR DirDst$

FileName$ = DIR$(DirSrc$+mask$, 0) '-- Get first file

while    FileName$ <>""

FileSrc.Open(DirSrc$+filename$, fmOpenRead)
FileDst.Open(DirDst$ +"\"+filename$, fmCreate)
FileDst.CopyFrom  (FileSrc, 0)
        FileSrc.close
        FileDst.close

FileName$ = DIR$ '-- Get next file

'inc rest
wend
'print "copied= "+str$(rest) +" files

rest=0

end sub

'-- ***********************************************************************'
sub FileCopy (FileSrc$, FileDst$) '- -----------------------------------'
'Andrew Shelkovenko dec 2003
'Copy FileSrc$ to FileDst$
' if path dest is not exist - create it.

dim FileSrc as QFileStream
dim FileDst as QFileStream

dr$=StripPath (FileDst$)
MKDIR dr$ 'StripPath (FileDst$)

if DIREXISTS(dr$ ) =0 then showmessage ("Can't create directory "+dr$ ): exit sub

FileSrc.Open(FileSrc$, fmOpenRead)
FileDst.Open(FileDst$, fmCreate)

FileDst.CopyFrom  (FileSrc, 0)
        FileSrc.close
        FileDst.close

end sub

'-- ***********************************************************************'
sub KillFiles (FileName$)
'Andrew Shelkovenko  diakin@narod.ru  apr 2004
'Kill files in FileName$
' for example KillFiles "C:\BAS\RAPIDQ\tmp\*.tmp"

FName$ = DIR$(FileName$, 0) '-- Get first file
while FName$ <>""
kill FName$
'if fileexists (FName$)>0 then print "Can't kill file "+FName$
FName$ = DIR$ '-- Get next file
wend
end sub

'-- ***********************************************************************'
SUB io2Rnd (fsrc$, fdst$)
'--------------------------------
'convert text file with single value strings to binary
' for example

'17.78091
'16.64166
'19.87037
'21.29429
'15.64965

'fsrc$ - source file  fdst$ - dest. file
'data type - single

'CONST fmCreate = 65535
'CONST fmOpenRead = 0
'CONST fmOpenWrite = 1
'CONST fmOpenReadWrite = 2

dim FileSourse as QFileStream
dim FileDest as QFileStream
defsng ValSrc

FileSourse.Open (fsrc$, 2 )'fmOpenReadWrite'
FileDest.Open   (fdst$, 65535 )  'fmOpenReadWrite'

WHILE NOT FileSourse.EOF
ValSrc$=FileSourse.ReadLine : 'print "ValSrc$=" ,ValSrc$
ValSrc=val(ValSrc$) :         'print "ValSrc=" ,ValSrc
FileDest.Write (ValSrc)
wend

FileSourse.CLOSE
FileDest.CLOSE

END SUB

'-- ***********************************************************************'
SUB Rnd2io (fsrc$, fdst$)
'--------------------------------
'convert  binary file with single type value data to  text file with single type value strings
' for example

'17.78091
'16.64166
'19.87037
'21.29429
'15.64965

'CONST fmCreate = 65535
'CONST fmOpenRead = 0
'CONST fmOpenWrite = 1
'CONST fmOpenReadWrite = 2

'CONST Num_BYTE = 1
'CONST Num_SHORT = 2
'CONST Num_WORD = 3
'CONST Num_LONG = 4
'CONST Num_DWORD = 5
'CONST Num_SINGLE = 6
'CONST Num_DOUBLE = 8

dim FileSourse as QFileStream
dim FileDest as QFileStream

defsng ValSrc

FileSourse.Open (fsrc$, 2 )        'fmOpenReadWrite'
FileDest.Open   (fdst$, 65535 )    'fmOpenCreate'

ie = FileSourse.size/4: 'print "ie=" ,ie

for i=0 to ie-1
ValSrc=FileSourse.ReadNum(6) :'print "ValSrc=" ,ValSrc
ValSrc$=str$(ValSrc):			'print "ValSrc$=" ,ValSrc$
FileDest.WriteLine (ValSrc$)
next i

FileSourse.CLOSE
FileDest.CLOSE

END SUB


File Times & Dates

File Times
A file time represents the specific date and time at which a given file was created, last accessed, or last written to. Windows records file times whenever applications create, access, and write to files. Windows records the times using a 64-bit value specifying the number of 100-nanosecond intervals that have elapsed since 12:00 A.M. January 1, 1601 (UTC). Writing to a file changes the last write time; writing to or reading from the file (including running an executable file) changes the last access time.

Note Not all file systems can record creation and last access time. In particular, the file allocation table (FAT) file system records only last-write times.

You can retrieve the file times for a given file by using the GetFileTime function. GetFileTime copies the creation, last access, and last write times to individual FILETIME structures. Each structure consists of two 32-bit values that combine to form the single 64-bit value. You can also retrieve the file times by using the FindFirstFile and FindNextFile functions. These functions copy the times to FILETIME structures in a WIN32_FIND_DATA structure.

You can set the file times for a file by using the SetFileTime function. This function lets you modify creation, last access, and last write times without changing the content of the file. You can compare the times of different files by using the CompareFileTime function. The function compares two file times and returns a value indicating which time is greater or returns zero if the times are equal.
To make a file time more meaningful to a user, you can extract the month, day, year, and time of day from a file time by using the FileTimeToSystemTime function. FileTimeToSystemTime converts the file time and copies the individual values for date and time of day to a SYSTEMTIME structure.

Windows records all file times in UTC-based times, but you can convert a file time to the local time for your time zone by using the FileTimeToLocalFileTime function. Before displaying a file time to a user, applications typically convert the file time to local time, then extract the month, day, year and time of day using FileTimeToSystemTime.
If you plan to modify file times for given files, you can convert a date and time of day to a file time by using the SystemTimeToFileTime function. You can also obtain the system time FILETIME structure by calling the GetSystemTimeAsFileTime function.

If the original date and time of day are given in the local time for your time zone, you can convert the resulting file time to UTC by using the LocalFileTimeToFileTime function. Always make sure the file times you set using SetFileTime are valid UTC-based times.

The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified.

BOOL GetFileTime(

HANDLE hFile, // identifies the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);

Parameters

hFile

Identifies the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file.

lpCreationTime

Points to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information.

lpLastAccessTime

Points to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.

lpLastWriteTime

Points to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The FAT and New Technology file systems support the file creation, last access, and last write time values.
Windows 95: The precision of the time for a file in a FAT file system is 2 seconds. The time precision for files in other file systems, such as those connected through a network depends on the file system but may also be limited by the remote device.

See Also

FILETIME, GetFileSize, GetFileType, SetFileTime

The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.

typedef struct _FILETIME { // ft
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;

Members

dwLowDateTime - Specifies the low-order 32 bits of the file time.

dwHighDateTime - Specifies the high-order 32 bits of the file time.

Remarks

It is not recommended that you add and subtract values from the FILETIME structure to obtain relative times. Instead, you should

· Copy the resulting FILETIME structure to a LARGE_INTEGER structure.
· Use normal 64-bit arithmetic on the LARGE_INTEGER value.

See Also

CompareFileTime, GetFileTime, LARGE_INTEGER

The WIN32_FIND_DATA structure describes a file found by the FindFirstFile or FindNextFile function.

typedef struct _WIN32_FIND_DATA { // wfd
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA;

Members

dwFileAttributes - Specifies the file attributes of the file found. This member can be one or more of the following values:

Value Meaning
FILE_ATTRIBUTE_ARCHIVE - The file is an archive file. Applications use this value to mark files for backup or removal.

FILE_ATTRIBUTE_COMPRESSED - The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.

FILE_ATTRIBUTE_DIRECTORY - The file is a directory.

FILE_ATTRIBUTE_HIDDEN - The file is hidden. It is not included in an ordinary directory listing.

FILE_ATTRIBUTE_NORMAL - The file has no other attributes set. This value is valid only if used alone.

FILE_ATTRIBUTE_OFFLINE - The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.

FILE_ATTRIBUTE_READONLY - The file is read-only. Applications can read the file but cannot write to it or delete it.

FILE_ATTRIBUTE_SYSTEM - The file is part of the operating system or is used exclusively by it.

FILE_ATTRIBUTE_TEMPORARY - The file is being used for temporary storage. Applications should write to the file only if absolutely necessary. Most of the file's data remains in memory without being flushed to the media because the file will soon be deleted.

ftCreationTime

Specifies a FILETIME structure containing the time the file was created. FindFirstFile and FindNextFile report file times in Coordinated Universal Time (UTC) format. These functions set the FILETIME members to zero if the file system containing the file does not support this time member. You can use the FileTimeToLocalFileTime function to convert from UTC to local time, and then use the FileTimeToSystemTime function to convert the local time to a SYSTEMTIME structure containing individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

ftLastAccessTime

Specifies a FILETIME structure containing the time that the file was last accessed. The time is in UTC format; the FILETIME members are zero if the file system does not support this time member.

ftLastWriteTime

Specifies a FILETIME structure containing the time that the file was last written to. The time is in UTC format; the FILETIME members are zero if the file system does not support this time member.

nFileSizeHigh

Specifies the high-order DWORD value of the file size, in bytes. This value is zero unless the file size is greater than MAXDWORD. The size of the file is equal to (nFileSizeHigh * MAXDWORD) + nFileSizeLow.

nFileSizeLow

Specifies the low-order DWORD value of the file size, in bytes.

dwReserved0

Reserved for future use.

dwReserved1

Reserved for future use.

cFileName

A null-terminated string that is the name of the file.

cAlternateFileName

A null-terminated string that is an alternative name for the file. This name is in the classic 8.3 (filename.ext) filename format.

Remarks

If a file has a long filename, the complete name appears in the cFileName field, and the 8.3 format truncated version of the name appears in the cAlternateFileName field. Otherwise, cAlternateFileName is empty. As an alternative, you can use the GetShortPathName function to find the 8.3 format version of a filename.

See Also

FindFirstFile, FindNextFile, FILETIME, FileTimeToLocalFileTime, FileTimeToSystemTime, GetShortPathName

The SetFileTime function sets the date and time that a file was created, last accessed, or last modified.

SetFileTime
Windows NT Yes
Win95 Yes
Win32s Yes
Import Library kernel32.lib
Header File winbase.h
Unicode No
Platform Notes None

BOOL SetFileTime(

HANDLE hFile, // identifies the file
CONST FILETIME *lpCreationTime, // time the file was created
CONST FILETIME *lpLastAccessTime, // time the file was last accessed
CONST FILETIME *lpLastWriteTime // time the file was last written
);

Parameters

hFile

Identifies the file for which to set the dates and times. The file handle must have been created with GENERIC_WRITE access to the file.

lpCreationTime

Points to a FILETIME structure that contains the date and time the file was created. This parameter can be NULL if the application does not need to set this information.

lpLastAccessTime

Points to a FILETIME structure that contains the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or (in the case of executable files) run. This parameter can be NULL if the application does not need to set this information.

lpLastWriteTime

Points to a FILETIME structure that contains the date and time the file was last written to. This parameter can be NULL if the application does not want to set this information.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The FAT and New Technology file systems support the file creation, last access, and last write time values.

See Also

FILETIME, GetFileSize, GetFileTime, GetFileType

The CompareFileTime function compares two 64-bit file times.

LONG CompareFileTime(

CONST FILETIME *lpFileTime1, // pointer to first file time
CONST FILETIME *lpFileTime2 // pointer to second file time
);

Parameters

lpFileTime1

Points to a FILETIME structure that specifies the first 64-bit file time.

lpFileTime2

Points to a FILETIME structure that specifies the second 64-bit file time.

Return Values

If the function succeeds, the return value is one of the following values:

Value Meaning
-1 First file time is less than second file time.
0 First file time is equal to second file time.
+1 First file time is greater than second file time.

See Also

GetFileTime, FILETIME

The FileTimeToSystemTime function converts a 64-bit file time to system time format.

BOOL FileTimeToSystemTime(

CONST FILETIME *lpFileTime, // pointer to file time to convert
LPSYSTEMTIME lpSystemTime // pointer to structure to receive system time
);

Parameters

lpFileTime

Pointer to a FILETIME structure containing the file time to convert to system date and time format.
The FileTimeToSystemTime function only works with FILETIME values that are less than 0x8000000000000000. The function fails with values equal to or greater than that.

lpSystemTime

Pointer to a SYSTEMTIME structure to receive the converted file time.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

As noted above, the function fails for FILETIME values that are equal to or greater than 0x8000000000000000.

See Also

DosDateTimeToFileTime, FILETIME, FileTimeToDosDateTime, SYSTEMTIME, SystemTimeToFileTime

The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

typedef struct _SYSTEMTIME { // st
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;

Members

wYear - Specifies the current year.

wMonth - Specifies the current month; January = 1, February = 2, and so on.

wDayOfWeek - Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.

wDay - Specifies the current day of the month.

wHour - Specifies the current hour.

wMinute - Specifies the current minute.

wSecond - Specifies the current second.

wMilliseconds - Specifies the current millisecond.

Remarks

It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should

· Convert the SYSTEMTIME structure to a FILETIME structure.
· Copy the resulting FILETIME structure to a LARGE_INTEGER structure.
· Use normal 64-bit arithmetic on the LARGE_INTEGER value.

See Also

FILETIME, GetSystemTime, LARGE_INTEGER, SetSystemTime

The FileTimeToLocalFileTime function converts a file time based on the Coordinated Universal Time (UTC) to a local file time.

BOOL FileTimeToLocalFileTime(

CONST FILETIME *lpFileTime, // pointer to UTC file time to convert
LPFILETIME lpLocalFileTime // pointer to converted file time
);

Parameters

lpFileTime

Points to a FILETIME structure containing the UTC-based file time to be converted into a local file time.

lpLocalFileTime

Points to a FILETIME structure to receive the converted local file time. This parameter cannot be the same as the lpFileTime parameter.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

See Also

FILETIME, LocalFileTimeToFileTime

The SystemTimeToFileTime function converts a system time to a file time.

BOOL SystemTimeToFileTime(

CONST SYSTEMTIME *lpSystemTime, // address of system time to convert
LPFILETIME lpFileTime // address of buffer for converted file time
);

Parameters

lpSystemTime

Points to a SYSTEMTIME structure that contains the time to be converted.
The wDayOfWeek member of the SYSTEMTIME structure is ignored.

lpFileTime

Points to a FILETIME structure to receive the converted system time.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

See Also

DosDateTimeToFileTime, FILETIME, FileTimeToDosDateTime, FileTimeToSystemTime, SYSTEMTIME

The GetSystemTimeAsFileTime function obtains the current system date and time. The information is in Coordinated Universal Time (UTC) format.

VOID GetSystemTimeAsFileTime(

LPFILETIME lpSystemTimeAsFileTime // pointer to a file time structure
);

Parameters

lpSystemTimeAsFileTime - Pointer to a FILETIME structure to receive the current system date and time in UTC format.

Return Values - This function does not return a value.

Remarks

The GetSystemTimeAsFileTime function is equivalent to the following code sequence:

FILETIME ft;
SYSTEMTIME st;

GetSystemTime(&st);
SystemTimeToFileTime(&st,&ft);

See Also

FILETIME, GetSystemTime, SYSTEMTIME, SystemTimeToFileTime

The LocalFileTimeToFileTime function converts a local file time to a file time based on the Coordinated Universal Time (UTC).

BOOL LocalFileTimeToFileTime(

CONST FILETIME *lpLocalFileTime, // address of local file time to convert
LPFILETIME lpFileTime // address of converted file time
);

Parameters

lpLocalFileTime

Points to a FILETIME structure that specifies the local file time to be converted into a UTC-based file time.

lpFileTime

Points to a FILETIME structure to receive the converted UTC-based file time. This parameter cannot be the same as the lpLocalFileTime parameter.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, use the GetLastError function.

See Also

FILETIME, FileTimeToLocalFileTime


func_array.inc

'-- **************************************************************************'
function ARRAverage (Dat!() as single, MinEl  as integer, MaxEl as integer) as single
' calculate average value from function Dat1!()
defint  p
defsng ARMid!=0

FOR p = MinEl TO MaxEl-1:
ARMid! = ARMid! + Dat!(p):
NEXT p

average! = ARMid! / (MaxEl-MinEl+1)

result=average!
END function
'-- **************************************************************************'
sub ARRAverageSubtract (Dat!() as single)
' calculate and subtract average value from function Dat1!()
defint  p, Lmin1, Lmax1
Lmin1 = LBOUND(Dat!):Lmax1 = UBOUND(Dat!)
print "Lmax1=" ,Lmax1
print "Lmin1=" ,Lmin1
defsng ARMid!=0
defsng average!=0

ARMid!=0
FOR p = Lmin1 TO Lmax1:
ARMid! = ARMid! + Dat!(p):
'print "ARMid=" ,ARMid!
NEXT p

average! = ARMid! / (Lmax1-LMin1+1)
print "average=" ,average!

ARMid!=0
FOR p = LMin1 TO Lmax1: Dat!(p) = Dat!(p) - average!: NEXT p

END sub

'-- **************************************************************************'
FUNCTION ARRMax (Dat!() as single, MinEl  as integer, MaxEl as integer) as single
'find max element of array
defint  p

defsng ARMax!=Dat!(MinEl)

FOR p = MinEl TO MaxEl:
IF Dat!(p) > ARMax! THEN ARMax! = Dat!(p):
NEXT p

result = ARMax!

END FUNCTION
'-- **************************************************************************'

FUNCTION ARRMin (Dat!() as single, MinEl  as integer, MaxEl as integer) as single
'find min element of array
defint p

defsng ARMin!=Dat!(MinEl)

FOR p = MinEl TO MaxEl:
IF Dat!(p) < ARMin! THEN ARMin! = Dat!(p):
NEXT p

result = ARMin!
END FUNCTION
'-- **************************************************************************'
FUNCTIONI FindMax (...) AS DOUBLE

     DIM Largest AS DOUBLE
     DIM I AS BYTE

     Largest = ParamVal(1)

     FOR I = 1 TO ParamValCount
       IF ParamVal(I) > Largest THEN
          Largest = ParamVal(I)
       END IF
     NEXT

     FindMax = Largest         ' or Result = Largest
   END FUNCTIONI

'-- **************************************************************************'
sub ArrExtr (Dat!() as single, byref DatMin!, byref DatMax!) '' as single
defint  p
defint MaxEl,MinEl

MinEl=lbound(Dat!)
MaxEl=ubound(Dat!)

defsng ARMax!=Dat!(MinEl)
defsng ARMin!=Dat!(MinEl)

FOR p = MinEl TO MaxEl:
IF Dat!(p) > ARMax! THEN ARMax! = Dat!(p):
IF Dat!(p) < ARMin! THEN ARMin! = Dat!(p):

NEXT p
DatMax!=ARMax!
'print "DatMax=" ,DatMax!
DatMin!=ARMin!
'print "DatMin=" ,DatMin!

END SUB
'**********************************************************************
sub ArrAbsExtr (Dat22!() as single, byref a_AbsDatMax!)
defint  p
defint MaxEl,MinEl

MinEl=lbound(Dat22!)
'print "sub MinEl=" ,MinEl
MaxEl=ubound(Dat22!)
'print "sub MaxEl=" ,MaxEl

'defsng ARMax!=abs(Dat!(MinEl))
'defsng ARMin!=abs(Dat!(MinEl))
a_AbsDatMax!=0
a_AbsDatMax!=abs(Dat22!(MinEl))'ARMax!

'print "sub1 _AbsDatMax=" ,a_AbsDatMax!

FOR p = MinEl TO MaxEl-1:
IF abs(Dat22!(p)) >  a_AbsDatMax! THEN  a_AbsDatMax! = abs(Dat22!(p)) :'print "abs(Dat22(", p, "))=" ,abs(Dat22!(p))
NEXT p
'print "sub2 _AbsDatMax!=" ,a_AbsDatMax!

END SUB

'-- **********************************************************************
Sub ArrRaznost (Dat1!() as single , Dat2!() as single, Raznost!() as single) '' as single'' MinEl??, MaxEl??)
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)
'print "ArrRaznost Lmax1=" ,Lmax1
'print "ArrRaznost Lmin1=" ,Lmin1

Lmin2 = LBOUND(Dat2!) : Lmax2 = UBOUND(Dat2!)
'print "ArrRaznost Lmax2=" ,Lmax2
'print "ArrRaznost Lmin2=" ,Lmin2

if Lmin2 <> Lmin1 or Lmax1 <> Lmax2 then showMessage ( "sub ArrRaznost. Arrays size mismatch" ): exit sub

REDIM Raznost!(Lmin1 to Lmax1)

FOR i = Lmin1 TO Lmax1:
Raznost!(i) = Dat1!(i) - Dat2!(i):
'print "Raznost!(",i, ") =" ,Raznost!(i)
NEXT i

END SUB
'-- **********************************************************************
Sub ArrRaznostR (Dat1!() as single , Dat2!() as single) '' as single'' MinEl??, MaxEl??)
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)
'print "Lmax1=" ,Lmax1
'print "Lmin1=" ,Lmin1
Lmin2 = LBOUND(Dat2!) : Lmax2 = UBOUND(Dat2!)
'print "Lmax2=" ,Lmax2
'print "Lmin2=" ,Lmin2

if Lmin2 <> Lmin1 or Lmax1 <> Lmax2 then showMessage ( "sub ArrRaznostR. Arrays size mismatch." ): exit sub
FOR i = Lmin1 TO Lmax1:
Dat1!(i) = Dat1!(i) - Dat2!(i):
'print "Raznost!(",i, ") =" ,Raznost!(i)
NEXT i

END SUB
'**********************************************************************
Sub ArrSum (Dat1!() as single , Dat2!() as single, SumA!() as single)
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)
Lmin2 = LBOUND(Dat2!) : Lmax2 = UBOUND(Dat2!)
if Lmin2 <> Lmin1 or Lmax1 <> Lmax2 then showMessage ( "Sub ArrSum. Arrays size mismatch" ): exit sub

REDIM SumA!(Lmin1 to Lmax1)
FOR i = Lmin1 TO Lmax1: SumA!(i) = Dat1!(i) + Dat2!(i): NEXT i
END SUB
'**********************************************************************

'**********************************************************************
Sub ArrSumR (Dat1!() as single , Dat2!() as single)
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)
Lmin2 = LBOUND(Dat2!) : Lmax2 = UBOUND(Dat2!)
if Lmin2 <> Lmin1 or Lmax1 <> Lmax2 then showMessage ( "Sub ArrSumR. Arrays size mismatch" ): exit sub

FOR i = Lmin1 TO Lmax1: Dat1!(i) = Dat1!(i) + Dat2!(i): NEXT i
END SUB
'**********************************************************************

'-- **********************************************************************
SUB kTArray (Dat1!() as single, kt! as single, Dat2!() as single)
'multiply array to const and save rusult in new array
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)

REDIM Dat2!(Lmin1 to Lmax1)
FOR i = Lmin1 to Lmax1: Dat2!(i) = Dat1!(i) * kt!: NEXT i
END SUB

'-- **********************************************************************
SUB kTArrayR (Dat1!() as single, kt! as single)
'multiply array to const
Lmin1 = LBOUND(Dat1!):Lmax1 = UBOUND(Dat1!)
FOR i = Lmin1 to Lmax1: Dat1!(i) = Dat1!(i) * kt!: NEXT i
END SUB

'-- **********************************************************************
SUB Nakopl (F!() as single, Nakop!() as single, period as Word)
'-----------------------------
'Calculate average on moving window (interval) of function
''F() - function array
'Nakop!() - moving average
'period - number of moving window points - (max 65535) must be odd number!
'-----------------------------
Lmin1 = LBOUND(F!): ' for example =0
print "Nakopl Lmin1=" ,Lmin1
Lmax1 = UBOUND(F!)  ' for example =56
print "Nakopl Lmax1=" ,Lmax1
REDIM Nakop!(0 to period-1) '!!! from 0  !!!'
defsng Summ!
defword ibeg,iend, NumPnt

'0  0  0   1         2         3         4         5  5  5
'012345678901234567890123456789012345678901234567890123456
'|||||||||||||||||||||||||||||||||||||||||||||||||||||||||    -numbers of function points     F!()
'|||||||                                           |||||||    - moving window  period points
'   ^ibeg=3                                           ^iend=53
'000+++++++++++++++++++++++++++++++++++++++++++++++++++000    - averaged function  Nakop!()
'|||^|||
'calculate average on 7 points  Nakop!(3)= ( f(0)+f(1)+...f(6) )/7 =f(0)/7+f(1)/7+ ...f(6)/7
' |||^|||
'  |||^|||
'   |||^|||
'then first point f(0)/7  deleted, next f(7)/7 point added. Nakop!(4)=Nakop!(3)- f(0)/7 + f(7)/7

NumPnt=Lmax1-Lmin1+1  '57 elements in array (0 to 56)
NumInterval=NumPnt-1  '56 intevals
ibeg = (period-1) / 2 'starting point of moving window on F!()
iend = NumInterval - ibeg  'end point point of moving window on F!()
Summ! = 0:

'calculate average in starting point
FOR j = Lmin1 TO Lmin1+(period-1):     Summ! = Summ! + F!(j): NEXT j 'cumulative value'
Nakop!(ibeg) = Summ! / period:  'average in starting point

Summ! = 0:

''calculate average in end point
FOR j = Lmin1+NumPnt - period  TO Lmin1+NumPnt-1: Summ! = Summ! + F!(j): NEXT j
Nakop!(iend) = Summ! / period: 'âû÷èñëåíèå ñðåäíåãî

FOR i = Lmin1+ibeg + 1 TO Lmin1+iend - 1
Nakop!(i) = Nakop!(i-1) + (    F!(i+Lmin1+ibeg)  -  F!(Lmin1+i-ibeg-1)   ) / period
'                              ^  4  3           4  3
NEXT i

END SUB
'-- **********************************************************************
sub ARRAddConst (Dat!() as single, const! as single)
defint  p, Lmin1, Lmax1
Lmin1 = LBOUND(Dat!):Lmax1 = UBOUND(Dat!)

FOR p = Lmin1 TO Lmax1:
Dat!(p) = const! + Dat!(p):
NEXT p
END SUB

'-- **********************************************************************
SUB ArrReSample (Dat1() AS SINGLE, Dat2() AS SINGLE, npt)
'------------------
'resample data series Dat1() to  Dat2!() with new points number npt, using linear interpolation

Lmin1 = LBOUND(Dat1): Lmax1 = UBOUND(Dat1)
print "ArrReSample Lmax1=" ,Lmax1
print "ArrReSample Lmin1=" ,Lmin1
Lmin2 = LBOUND(Dat2): Lmax2 = UBOUND(Dat2)

ipt = Lmax1 - Lmin1+1 '--- 11-0+1=12
kti = npt / ipt       '--- 36/12=3
print "ArrReSample kti=" ,kti
j1 = 0  'current new point
j1old = 0 'previous new points

Dat2(Lmin2) = Dat1(Lmin1) '--- â íà÷àëüíûõ òî÷êàõ çíà÷åíèÿ ôóíêöèé ñîâïàäàþò

FOR i = 1 TO ipt-1 '--- ïåðåáèðàåì ïî îñòàâøèìñÿ 11 òî÷êàì ñ 1 ... 11
deltaD1 = (Dat1(i) - Dat1(i - 1)) / kti   '--- increment of a function in the new current interval for linear interpolation
ostFunc=Dat1(i-1)-deltaD1*drob-Dat2(j1old)

jz = i * kti '--- =3
j=FIX(jz) '--- absolute new point number'
drob=jz-j '--- fraction
j1 = j - j1old '--- new points number in current interval
  FOR k = 1 TO j1
    Dat2(j1old + k) = deltaD1 * k +Dat2(j1old) +ostFunc
'	print "ArrReSample Dat2(",j1old + k,") =" ,ArrReSample Dat2(j1old + k)

  NEXT k
j1old = j1 + j1old
NEXT i

  END SUB

'--****************************************************************************************
SUB OgibF (Dat1() AS SINGLE, OgibUp() AS SINGLE, OgibDn() AS SINGLE)
'build envelope - up and down
Lmin1 = LBOUND(Dat1): Lmax1 = UBOUND(Dat1)
print "Lmax1=" ,Lmax1: print "Lmin1=" ,Lmin1

OgibUp(Lmin1)=Dat1(Lmin1)
OgibDn(Lmin1)=Dat1(Lmin1)
ku=Lmin1
kd=Lmin1 '0'

' search max and min
FOR i = Lmin1+1 TO Lmax1 - 1

IF Dat1(i) > Dat1(i - 1) AND Dat1(i) >= Dat1(i + 1) THEN
OgibUp(i)=Dat1(i)
'- intrerpolation'
kti=( OgibUp(i)-OgibUp(ku) )/(i-ku)
     for ik=ku+1 to i-1
     OgibUp(ik)=kti*(ik-ku)+OgibUp(ku)
     next ik
ku=i
ELSEif Dat1(i) < Dat1(i - 1) AND Dat1(i) <= Dat1(i + 1) then
OgibDn(i)=Dat1(i)
'- intrerpolation'
kti=( OgibDn(i)-OgibDn(kd) )/(i-kd)
     for ik=kd+1 to i-1
     OgibDn(ik)=kti*(ik-kd)+OgibDn(kd)
     next ik
kd=i
END IF

NEXT i

END SUB


rq_math.inc

'------------------------------------------------------------------
'>>>>>>   rq-math.inc   Version 1.1 (09-2000)<<<<<<<<<<<<<<<<<<<<
'------------------------------------------------------------------
'                Rapid-Q Mathematics $Includes
'   written by Bruno Schäfer <bup.schaefer@planet-interkom.de>
'------------------------------------------------------------------
'  !!!!    All angles are in radiant !!!   ... but not in function DEG2RAD  :-)
' If an ERROR occurs in some functions there will be a Messagebox
' and the returned value is ZERO !!!!!
'
' Rapid-Q - http://www.basicguru.com/abc/rapidq/
'           http://www.egroups.com/group/rapidq
' This .inc.-file  contains additional commonly used mathematical functions
' and utilities (in addition to the standard mathematical functions
' supported in William Yu's Rapid-Q)
' This is a work in progress, so don't expect too much.
' Many thanks for ideas and remarks:
' send an e-mail to (bup.schaefer@planet-interkom.de) or the egroup.
' planned functions in next versions:
' better trapping of ERRORs and of undefined values  ...and more functions:
' different round methods,' vectoroperations, derivation, integral-functions,
' more natural constants,scientific function,' arithmetical and statistical
' functions (perhaps in own $includes ???)...
'==============================================================================
CONST rqPI = 3.141592654 '(This is PI)
CONST rqE = 2.718281828  '(This is e)
CONST rqh = 6.62620 * 10 ^ (-34)   '(J*S: Planck const.)
CONST rqc = 2.997925 * 10 ^ 8      '(m/s: velocity of light in vacuum)
'-------------------------------------------------------------------------------
'   ACOSH() returns the hyperbolic areacosine of x
'-------------------------------------------------------------------------------
Function ACOSH(value AS DOUBLE) AS DOUBLE
  SELECT CASE value
   CASE IS < 1
    MessageBox("Invalid Argument !!!", "ACOSH - Error", 0)
   CASE IS >= 1
    ACOSH =  ( LOG (value + SQR( value ^ 2 - 1 )))
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOT() returns the arccotangent of x
'-------------------------------------------------------------------------------
Function ACOT(value AS DOUBLE) AS DOUBLE
 ACOT = ((rqPI / 2) - ATAN (value))
End Function
'-------------------------------------------------------------------------------
'   ACOTH() returns the hyperbolic areacotangent of x
'-------------------------------------------------------------------------------
Function ACOTH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS > 1
   ACOTH =  (LOG((value + 1) / (value - 1)) * 0.5)
  CASE ELSE
   MessageBox("ERROR: Invalid Argument !!!", "ACOTH - Error", 0)
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOSEC() returns the arccosecans of x
'-------------------------------------------------------------------------------
Function ACOSEC(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS < 1
   MessageBox("Invalid Argument !!!", "ACOSEC - Error", 0)
  CASE ELSE
   ACOSEC =  (ASIN(1/value))
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOSECH() returns the hyperbolic arccosecans of x
'-------------------------------------------------------------------------------
Function ACOSECH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS(value)
  CASE = 0
   MessageBox("Invalid Argument !!!", "ACOSECH - Error", 0)
  CASE ELSE
   ACOSECH =  (ASINH(1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ADDZ() returns the sum of two complex numbers
'-------------------------------------------------------------------------------
Function ADDZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 + re2
    Z(1) = im1 + im2
    Z(2) = 0
    Z(3) = 0
    ADDZ = Z()
End Function
'-------------------------------------------------------------------------------
'   ASINH() returns the hyperbolic areasine of x
'-------------------------------------------------------------------------------
Function ASINH(value AS DOUBLE) AS DOUBLE
 ASINH = LOG (value + (SQR(value * value + 1)))
End Function
'-------------------------------------------------------------------------------
'   ASEC() returns the arccosecans of x
'-------------------------------------------------------------------------------
Function ASEC(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS < 1
    MessageBox("ERROR:Invalid Argument !!!", "ASEC - Error", 0)
  CASE ELSE
   ASEC =  (rqPI / 2 - ASIN( 1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ASECH() returns the hyperbolic arccosecans of x
'-------------------------------------------------------------------------------
Function ASECH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS > 1
   MessageBox("ERROR:Invalid Argument !!!", "ASECH - Error", 0)
  CASE IS <= 0
   MessageBox("ERROR:Invalid Argument !!!", "ASECH - Error", 0)
  CASE ELSE
   ASECH = (ACOSH(1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ATANH() returns the hyperbolic areatangent of x
'-------------------------------------------------------------------------------
Function ATANH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS(value)
  CASE IS < 1
   ATANH = (LOG((1 + value) / (1 - value)) * 0.5)
  CASE 0
   ATANH = 1
  CASE ELSE
   MessageBox("ERROR:Invalid Argument !!!", "ATANH - Error", 0)
 END SELECT
End Function
'--------------------------------------------------------------------------------
'   CONJZ() returns the conjugated complex number of a complex number
'--------------------------------------------------------------------------------
Function CONJZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(1) = im * (-1)
    CONJZ = Z()
End Function
'-------------------------------------------------------------------------------
'   COSEC() returns the cosecans of x
'-------------------------------------------------------------------------------
Function COSEC(value AS DOUBLE) AS DOUBLE
 COSEC = 1 / SIN(value)
End Function
'-------------------------------------------------------------------------------
'   COSECH() returns the hyperbolic cosecans of x
'-------------------------------------------------------------------------------
Function COSECH(value AS DOUBLE) AS DOUBLE
 COSECH = (2 / (EXP(value) - EXP(value * -1)))
End Function
'-------------------------------------------------------------------------------
'   COSH() returns the hyperbolic cosine of x
'-------------------------------------------------------------------------------
Function COSH(value AS DOUBLE) AS DOUBLE
 COSH = (0.5 * (EXP(value) + EXP(value * -1)))
 IF value = 0 THEN COSH = 1
End Function
'--------------------------------------------------------------------------------
'   COSZ() returns the cosine of a complex number
'--------------------------------------------------------------------------------
Function COSZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = COS(re) * COSH(im)
    Z(1) = SIN(re) * SINH(im)
    COSZ = Z()
End Function
'--------------------------------------------------------------------------------
'   COSHZ() sine of a complex number
'--------------------------------------------------------------------------------
Function COSHZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = COSH(re) * COS(im)
    Z(1) = SINH(re) * SIN(im)
    COSHZ = Z()
End Function
'-------------------------------------------------------------------------------
'   COT() returns the cotangent of x
'-------------------------------------------------------------------------------
Function COT(value AS DOUBLE) AS DOUBLE
 COT = 1 / TAN(value)
End Function
'-------------------------------------------------------------------------------
'   COTH() returns the hyperbolic cotangent of x
'-------------------------------------------------------------------------------
Function COTH(value AS DOUBLE) AS DOUBLE
 SELECT CASE value
  CASE 0
   MessageBox("ERROR: Invalid Argument !!!", "COTH - Error", 0)
  CASE ELSE
   COTH = COSH(value) / SINH(value)
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   DEG2RAD() returns radians instead of degrees
'-------------------------------------------------------------------------------
Function DEG2RAD(value AS DOUBLE) AS DOUBLE
 DEG2RAD = value * 0.017453
End Function
'--------------------------------------------------------------------------------
'   DIVZ() returns the quotient of two complex numbers
'--------------------------------------------------------------------------------
'   DIVZ() = Z1 / Z2
Function DIVZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = (req * re2 + im1 * im2) / (re2*re2 + im2*im2)
    Z(1) = (-re1 * im2 + re2 * im1) / (re2 * re2 + im2 * im2)
    Z(2) = 0
    Z(3) = 0
    DIVZ = Z()
End Function
'--------------------------------------------------------------------------------
'   EVEN() returns "1" (= true) if a number is even, else "0"
'--------------------------------------------------------------------------------
Function EVEN(value AS INTEGER ) AS INTEGER
   IF FRAC(value / 2) = 0 THEN
    EVEN = 1
   ELSE
    EVEN = 0
   END IF
End Function
'--------------------------------------------------------------------------------
'    EXPZ() returns the exponential value of a complex number (= e^z)
'--------------------------------------------------------------------------------
Function EXPZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : a = Z(3)
    Z(0) = EXP(re) * COS (im)
    Z(1) = EXP(re) * SIN (im)
    EXPZ = Z()
End Function
'-------------------------------------------------------------------------------
'   FAC() returns the factorial of the integer x
'-------------------------------------------------------------------------------
Function FAC(value AS LONG) AS LONG
 SELECT CASE value
  CASE IS < 13
   N = value
   value = 1
    For I = 1 to N
     value = value * I
    NEXT I
   FAC = value
  CASE IS > 12
   MessageBox("ERROR: Invalid Argument !!! Argument must <= 12!", "FAC - Error", 0)
 END SELECT
End Function
'--------------------------------------------------------------------------------
'   FIX() truncates the argument to closest integer value towards zero
'--------------------------------------------------------------------------------

'-------------------------------------------------------------------------------
'   GCD() returns the greatest common denominator of two integers
'   based on the Euclidean algorithm
'-------------------------------------------------------------------------------
Function GCD(value1 AS DOUBLE, value2 AS DOUBLE ) AS LONG
  ERROR% = 0
  SELECT CASE value1
   CASE IS <> INT(value1) 'Integer check
    ERROR% = 1
   CASE 0                 'ZERO check
    ERROR% = 2
  END SELECT
  SELECT CASE value2
   CASE IS <> INT(value2) 'Integer check
    ERROR% = 1
   CASE 0                 'ZERO Check
    ERROR% = 2
  END SELECT
  SELECT CASE ERROR%
   CASE 0
    value1 = ABS(value1) : value2 = ABS(value2)    'Euclidean algorithm
     DO
      Res = value1 - value2 * INT(value1/value2)
      IF Res = 0 THEN GCD = value2
      value1 = value2
      value2 = Res
     LOOP UNTIL Res = 0
   CASE 1
     GCD = 0
     MessageBox("Invalid Argument (no INTEGER)!!!", "GCD - Error", 0)
   CASE 2
     GCD = 0
     MessageBox("Invalid Argument (ZERO)!!!", "GCD - Error", 0)
  END SELECT
End Function
'--------------------------------------------------------------------------------
'   INVZ() returns the reciprocal value of a complex number
'--------------------------------------------------------------------------------
' INVZ(Z) = 1/Z
Function INVZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  re / ( re * re + im * im)
    Z(1) =  im / ( re * re + im * im)
    INVZ = Z()
End Function
'--------------------------------------------------------------------------------
'     LOGZ() returns the natural logarithm of a complex number
'--------------------------------------------------------------------------------
Function LOGZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  LOG (re / ( re * re + im * im))
    Z(1) =  im / ( re * re + im * im)
    LOGZ = Z()
End Function
'--------------------------------------------------------------------------------
'    LOG10() returns the base 10 log of x
'--------------------------------------------------------------------------------
 Function LOG10(value AS DOUBLE) AS DOUBLE
  LOG10 = (LOG (value) * LOG(10 * rqE))
 End Function
'--------------------------------------------------------------------------------
'     LOG10Z() returns the 10-th logarithm of z (base is 10)
'--------------------------------------------------------------------------------
Function LOG10Z(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  LOG (re / ( re * re + im * im))/ LOG (10)
    Z(1) =  im / ( re * re + im * im) / LOG (10)
    LOG10Z = Z()
End Function
'--------------------------------------------------------------------------------
'     LOGAZ() returns the a-th logarithm of z (base is a)
'--------------------------------------------------------------------------------
Function LOGAZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : a = Z(3)
    Z(0) =  LOG (re / ( re * re + im * im))/ LOG (a)
    Z(1) =  im / ( re * re + im * im) / LOG (a)
    LOGAZ = Z()
End Function
'--------------------------------------------------------------------------------
'    MAGZ() returns the absolute value of a complex number
'--------------------------------------------------------------------------------
Function MAGZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im)   '= |Z|
    Z(1) = 0
    MAGZ = Z()
End Function
'--------------------------------------------------------------------------------
'    MULZ() returns the product of two complex numbers
'--------------------------------------------------------------------------------
Function MULZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 * re2 - im1 * im2
    Z(1) = re1 * im2 + re2 * im1
    Z(2) = 0
    Z(3) = 0
    MULZ = Z()
End Function
'--------------------------------------------------------------------------------
'    NORZ() returns the normal form of a complex value
'--------------------------------------------------------------------------------
' Z = x + iy = re + i*im   =   r*e^i*theta
Function NORZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im)    ' = r = value
    Z(1) = ATAN (im / re)             ' = theta = argument
    NORZ = Z()                        'Z() = (r,theta)
End Function
'--------------------------------------------------------------------------------
'   ODD() returns "1" (=true) if a number(INTEGER) is odd
'--------------------------------------------------------------------------------
Function ODD(value AS INTEGER ) AS INTEGER
   IF FRAC( value / 2 ) <> 0 THEN
      ODD = 1
    ELSE
      ODD = 0
   END IF
End Function
'--------------------------------------------------------------------------------
'   POLZ() returns Z IN the polar coordinate system
'--------------------------------------------------------------------------------
' Transformation from    z = x + iy     to     z = r*cos((phi) + r*i*sin(phi)
Function POLZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im) * COS(ATAN (im / re))
    Z(1) = SQR( re * re + im * im) * SIN(ATAN (im / re))
    POLZ = Z()
End Function
'--------------------------------------------------------------------------------
'    POWZ() returns the power n  of a complex number = (x+iy)^n = z^n
'--------------------------------------------------------------------------------
 Function POWZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : expo = Z(2)
     Z(0) =(SQR( re * re + im * im)) ^ expo * COS(expo * ATAN (im / re) )
     Z(1) =(SQR( re * re + im * im)) ^ expo * SIN(expo * ATAN (im / re) )
     Z(2) = 0
    POWZ = Z()
End Function
'--------------------------------------------------------------------------------
'   RAD2DEG() returns degrees instead of radians
'--------------------------------------------------------------------------------
Function RAD2DEG(value AS DOUBLE) AS DOUBLE
 RAD2DEG = value / 0.017453
End Function
'--------------------------------------------------------------------------------
'   SEC() returns the secans of x
'--------------------------------------------------------------------------------
Function SEC(value AS DOUBLE) AS DOUBLE
 SEC = 1 / COS(value)
End Function
'--------------------------------------------------------------------------------
'   SECH() returns the hyperbolic secans of x
'--------------------------------------------------------------------------------
Function SECH(value AS DOUBLE) AS DOUBLE
 SECH = (2 / (EXP(value) + EXP(value * -1)))
' SECH = 1/ COSH (value)
End Function
'--------------------------------------------------------------------------------
'   SINH() returns the hyperbolic sine of x
'--------------------------------------------------------------------------------
Function SINH(value AS DOUBLE) AS DOUBLE
 SINH = (0.5 * (EXP(value) - EXP(value * -1)))
  IF value = 0 THEN SINH = 0
End Function
'--------------------------------------------------------------------------------
'   SINZ() sine of a complex number
'--------------------------------------------------------------------------------
Function SINZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SIN(re) * COSH(im)
    Z(1) = COS(re) * SINH(im)
    SINZ = Z()
End Function
'--------------------------------------------------------------------------------
'   SINHZ() sine of a complex number
'--------------------------------------------------------------------------------
Function SINHZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SINH(re) * COS(im)
    Z(1) = COSH(re) * SIN(im)
    SINHZ = Z()
End Function
'--------------------------------------------------------------------------------
'   SQRZ() returns the square root of acomplex number
'--------------------------------------------------------------------------------
Function SQRZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = ((re + SQR(re * re + im * im)) * 0.5) ^ 0.5
    Z(1) = (((re * -1) + SQR(re * re + im * im)) * 0.5) ^ 0.5
    SQRZ = Z()
End Function
'-------------------------------------------------------------------------------
'   SUBZ() returns the difference of two complex numbers
'-------------------------------------------------------------------------------
Function SUBZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 - re2
    Z(1) = im1 - im2
    Z(2) = 0
    Z(3) = 0
    SUBZ = Z()
End Function
'--------------------------------------------------------------------------------
'   TANH() returns the hyperbolic tangent of x
'--------------------------------------------------------------------------------
Function TANH(value AS DOUBLE) AS DOUBLE
    TANH = SINH(value) / COSH(value)
    IF value = 0 THEN TANH = 0
End Function
'--------------------------------------------------------------------------------
'   TANZ() returns the tangent of a complex number
'--------------------------------------------------------------------------------
Function TANZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1)
    Z(0) =  SIN(2 * re) / (COS(2 * re) + COSH(2 * im))
    Z(1) =  SINH(2 * im) / (COS(2 * re) + COSH(2 * im))
    TANZ = Z()
End Function

'=====================================================================================
'      >>>>> reserved words  <<<<<<
'=====================================================================================
'ACOSH, ACOT, ACOSEC, ACOSECH, ADDZ*, ASEC, ASECH, ATANH,CONJZ*, COSEC, COSECH, COSH,
'COSZ*, COSHZ*, COT, COTH, DEG2RAD, DIVZ*,EVEN*,EXPZ*, FAC, GCD*, INVZ*  LOG10,LOG10Z*,
'LOGAZ*, LOGZ*, MAGZ*, MULZ*, NORZ*,ODD*, POLZ*, POWZ*, RAD2DEG, RQE, RQPI, SEC, SECH,
'SINH, SINZ*,SINHZ*, SQRZ*, SUBZ*,TANH, TANZ*
'*: new functions in this version

'-- **************************************************************************'
FUNCTIONI FindMax (...) AS DOUBLE

     DIM Largest AS DOUBLE
     DIM I AS BYTE

     Largest = ParamVal(1)

     FOR I = 1 TO ParamValCount
       IF ParamVal(I) > Largest THEN
          Largest = ParamVal(I)
       END IF
     NEXT

     FindMax = Largest         ' or Result = Largest
   END FUNCTIONI


Appendix C: Branching with GOTO and GOSUB

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Branching

Introduction to Branching

Branching seems to be very popular in BASIC, mainly because in the old days, BASIC was very unstructured and didn't carry with it the concepts we now see today. Sure, some say it's still unstructured, but so is a lot of other languages depending on your coding style. Branching is just the mechanism of skipping (or jumping) instructions, either forward or backward. It's much like writing SUBs and FUNCTIONs, just a bit more unstructured as you'll see.

What are labels?
Before talking about GOTOs and GOSUBs, you'll need to understand what labels are. You can think of them as bookmarks, they don't actually do anything, but you can use labels as a guide. The following are valid labels:
    Label1:
    100
    10.5
A label always appears as the first statement and can be any number or a named label. A named label must end with a colon : symbol. After any label, you can write your code as before.
    Label1:
       PRINT "some code..."
    100 PRINT "more code"
    10.5
       PRINT "yet more code"
The formatting above is just an example, it doesn't mean that a named label can't have code on the same line.

Branching with GOTO
Perhaps the most shunned upon keyword in BASIC is the GOTO statement. Obviously if you programmed in BASIC before, GOTO was used almost everywhere. This is because GOTO was so easy to understand, and when we first jump into programming, we don't usually pick up what subroutines and functions are. Rapid-Q still supports GOTO, but we definitely don't encourage its use, at all. In fact, if you find yourself using it now, you'll probably wonder why in a few years/months as you become more experienced. Here's an example of using GOTO:
    IF I = 100 THEN GOTO 10 ELSE GOTO 20

    10 PRINT "I = 100"
       END

    20 PRINT "I is not 100"
       END
If it's so terrible, are there any penalties in its use? No. In fact, it's probably the purest command you'll find. All it does is skip instructions, so in the above example, if I = 200, then the lines
    10 PRINT "I = 100"
       END
are skipped. GOTO requires no stack or memory consumption, unlike GOSUB and SUBs or FUNCTIONs. If you want to think about assembly, that's basically all you do, branch here and there, but since BASIC is a high level language, we usually don't like to think that way, so we avoid using GOTO if possible.

Branching with GOSUB .. RETURN
Using GOSUB is actually more useful than using GOTO, but still not recommended. It is in essence, calling a SUB without parameters. What it provides is a quick "hack" without creating SUBs. It is often used in loops, as you may see here:
    DO
      DO
        A$ = INKEY$
      LOOP UNTIL LEN(A$)

      IF A$ = "A" THEN
          GOSUB 100
      ELSEIF A$ = "B" THEN
          GOSUB 110
      ELSEIF A$ = "C" THEN
          GOSUB 110
      END IF
    LOOP

    END

    100 PRINT "A pressed"
        RETURN
    110 PRINT "B pressed"
        RETURN
    120 PRINT "C pressed"
        RETURN

The RETURN statement is used to jump back to the previous call of GOSUB. You can think of GOSUB as a GOTO statement with a marker, and the RETURN statement as another GOTO statement that returns to that marker.


IDE

Hello,
I am sorry to bother you, but I need help with using COM controls.
My problem is not really with using QOLEOBJECT and QOLECONTAINER, I
understand fairly well how to use these. What I do not understand is how I
can find the properties, methods, and events of a particular control. For
example:

Dim Object as QOLEOBJECT
Object.CreateObject("Word.Basic")

How did you know to use "Word.Basic"?

Or another example:

Dim msHTML as QOLECONTAINER
msHTML.CreateObject("Shell.Explorer.1")

How did you know to use "Shell.Explorer"?

Using the program Dependency Walker to view msHTML.dll, I see nothing that
says "Shell.Explorer", so I assume that what I'm looking for is found
somewhere else.

I apologize for the dumb question, but it's been bugging for awhile now and
I still can't figure it out, so of coarse, all information will be GREATLY
appreciated.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

I just found out that I have a COM viewer included with VC++.

It can also be downloaded here
http://www.microsoft.com/com/resources/oleview.asp

It doesn't seem to have any documentation for the objects, but at
least it tells you what's there.

See
http://download.microsoft.com/download/ole/ole2v/3.5/W351/EN-US/Ole2v.exe

I'd like to know how to access and read Outlook Address Book
using qoleobject and qolecontainer from my little program.
I've tried with:

$apptype console
DIM Object AS QOLEOBJECT
Dim ot As QOLEOBJECT
Dim mapi As QOLEOBJECT
Dim x As QOLEOBJECT

Print "outlook..."
Print Object.Create("Outlook.Application")
Print Object.getIDOfName("GetNameSpace")
Sleep 2
Print "invoke"
Print Object.invoke("GetNameSpace","MAPI",mapi)
Print mapi.getIDOfName("AddressLists.Count")

Print "NameSpace..."
Print mapi.Invoke("AddressLists.Count")

SLEEP 5
Print "Stop"
Input asfdsadf
End

I'll like any suggestion. Thanks

Hi,

I use the code and of course, it works. (Thanks for the tip).

Now im trying to change one variable of the Flash Movie.
Taking an example from JavaScript i can do it.
Works a little strange, because it behavior different of the
original JS idea.
Now i want to know how could i know whats thinks can be done in a
similar way, im talking about getting acceso to the 'object'
properties, actions,etc. Just like "SetVariable'.

The NEW code is:

CREATE Form AS QFORM
Caption = "Swf"
Center
Visible = 1
CREATE swf AS QOLECONTAINER
CreateObject("ShockwaveFlash.ShockwaveFlash.5")
movie= "c:\windows\escritorio\p1.swf"
setvariable ("t","texto")
height =200
width = 200
END CREATE
Visible = 0
END CREATE

Form.ShowModal

swf.Free

You need to have an edit in the Flash Movie with a variable
named 'texto' (dynamic).

Hi,

For the Object "Explorer" you have these

PROPRETIES
----------
help
attach
busy
fullname
locationname
locationurl
name
offline
path
readystate
registerasbrowser
registerasdroptarget
silent
theatermode
toplevelcontainer
type
wherelc

METHODS
-------
Exec
GoBack
GoForward
GoHome
GoHome
Navigate
QueryStatusWB
Refresh

CREATE msHTML AS QOLECONTAINER
Align = 5
createObject("Shell.Explorer.1")
END CREATE

This Works
----------
msHTML.LocationURL returns the ... LocationURL
msHTML.Refresh Refreshes the viewed page
msHTML.Navigate ("www.google.com") view google page

It's posible too to INVOKE
msHTML.Invoke ("locationURL") ' never tried ???

I've never been able to use Exec to SaveThe File
------------------------------------------------
msHTML.Exec 4, 2, "c:\\Tampon\\RQGoogle.Htm", 0 ' or msHTML.ExecWB ...

Nor CUT AND PASTE
msHtml.Invoke ("ExecCommand", 17, 0, 0, 0) ' 17 = CUT
msHtml.Invoke ("ExecCommand", 12, 0, 0, 0) ' 12 = paste

You MUST find a documentation on the ShockWavaFlash !

-------------------------------------------------------------------------

And BTW, I am calm :)

Jacques

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

You should be able to use QOleObject. See the docs for an example.
You should be able to call its properties and methods much like you
do in VB. However events I don't think are supported.

MSXML is a COM based dll. The only functions it exports mostly
relate to registering the dll.

--- In rapidq@y..., Leo Dicaprio <Nadesom@y...> wrote:
>
> Under VB, after msxml.dll is included in the project,
> i can use it by
> Dim xml As New MSXML.DOMDocument
> and:
> xml.Load ("test.xml")
>
> Any idea under RQ?
> I cann't found the DLL's Export Table using Quick
> View.

Thanks.

I should read Yu' Doc ch.15. COM Programming.

Here is a code.

Another question now is how can we use xml under linux
with RQ.

DIM Obj AS QOLEOBJECT

Obj.CreateObject("Microsoft.XMLDOM")
Obj.load("car.xml")

print Obj.xml

showmessage "ok"

----- Original Message -----
From: "petek1827" <petek1827@yahoo.com>
To: <rapidq@yahoogroups.com>
Sent: Monday, February 25, 2002 3:21 PM
Subject: [rapidq] Re: use msxml.dll under rapidq

> You should be able to use QOleObject. See the docs
for an example.
> You should be able to call its properties and
methods much like you
> do in VB. However events I don't think are
supported.
>

Great!

Also i foud, that its possible to use CreateObject, which working
much faster and warantied, that it will supported by remote server.

Guys, look at this short example:

$APPTYPE CGI
$INCLUDE "INCLUDES/CGI.INC"

DIM ADODB AS QOLEOBJECT
DIM ConnString AS STRING
DIM strSQL AS STRING

ADODB.CREATEOBJECT("ADODB.Connection")

ConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=db1.mdb;"
ADODB.Open ConnString

RSF = ADODB.EXECUTE("SELECT * FROM SiteAdmin")
' -----------------------------------------------------------
' Next part not working:
DO
RSF.MOVENEXT
RESPONSEWRITE "<a href='?option=someaction'>" & RSF("DDD") & "</a>"
LOOP WHILE NOT RSF.EOF

So, im getting conecction to database (any DSN or DSN-less), im
allowed to execute SQL Queryes, but how to use Recordsets here?

Is any ideas about it?

--- In rapidq@y..., "edamian919" <edamian919@y...> wrote:
> hello, yes there's one way, you have to use the odbc driver for
> msaccess,
> On the weekend i'll send you an example
>
> bye
> --- In rapidq@y..., "bol_spider" <bol_spider@y...> wrote:
> > Hello, people!
> >
> > IS ANY WAY to use MS Access MDB bases?

' Declaring Application type
$APPTYPE CGI
' Including Web.Objects
$INCLUDE "OBJ_HTTP.INC"
' Including Rapid-Q Constants
$INCLUDE "RAPIDQ.INC"

' This line will break execution if file requested not by browser
IF REQUEST.HTTP_USER_AGENT ="" THEN END

' If requested by browser, generate response
' with proper status code.
' for IE you can generate always "200 OK" status, because IE
' don't see any difference in response codes.
RESPONSE.STATUS "200 OK"
' Declaring content type
RESPONSE.CONTENTTYPE "text/html"
' Also you can add/declare DocType when you using XML, WML and etc...
' And now send this generated header.
' Without sending header u will get CGI Error
RESPONSE.SENDHEADER

DIM USERNAME AS STRING
DIM PASSWORD AS STRING
' Here we looking for some values posted from browser
USERNAME = HTTP.GETVALUE("username")
PASSWORD = HTTP.GETVALUE("password")

DIM BUF AS STRING
' Now loading some page, which contains "keywords"
' We using keyword on page for automate content management process
' In this case we will nee to design only one page, which will be
' as basement for whole web site.
BUF = FSO.FILETOBUFFER("templates/t_index.htm")
' So, page loaded to buffer and now we processing keywords
BUF = REPLACESUBSTR$(BUF,"{@footer}","Copyright © 2002")
' and now checking for user settings
' if we have a "guest", show him a login form, which also prepared
' as "template"
IF USERNAME="" AND PASSWORD ="" THEN
DIM LOGINFORMCONTENT AS STRING
LOGINFORMCONTENT = FSO.FILETOBUFFER
("templates/t_loginform.htm")
BUF = REPLACESUBSTR$(BUF,"{@header}","Please enter
your account details:")
BUF =
REPLACESUBSTR$(BUF,"{@menucontent}",LoginFormContent)
END IF
' Now we displaying generated HTML content to user and he will
' see it as normal web page.
RESPONSE.WRITE BUF
' Here small example of using "Response" object
RESPONSE.WRITE "<HR NOSHADE SIZE=1 COLOR=RED>"
RESPONSE.WRITE "REFERER: " & REQUEST.HTTP_REFERER & "<BR>"
RESPONSE.WRITE "PATH_TRANSLATED:" & REQUEST.PATH_TRANSLATED
& "<BR>"
RESPONSE.WRITE "REQUEST_METHOD: " & REQUEST.REQUEST_METHOD
& "<BR>"
RESPONSE.WRITE "QUERY_STRING: " & REQUEST.QUERY_STRING
& "<BR>"
RESPONSE.WRITE "DECODED STRING: " & HTTP.HTMLDECODE
(REQUEST.QUERY_STRING) & "<BR>"

Try VBS first to verify your COM installation:

DIM INETCONTROL
set INETCONTROL=wscript.CREATEOBJECT("InetCtlsObjects.Inet")

VBS has the best compatibility for MS COM. I ever found an object works fine with VBS but failed in PHP script. Maybe RQ also.

Guidance

Exception EOleSysError in module fsodemo.exe at 0007E571.
Invalid class string.

DIM INETCONTROL AS QOLEOBJECT
INETCONTROL.CREATEOBJECT("InetCtlsObjects.Inet")

compiling fine, but execution faulted. is any ideas why?

Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com


RQDP - FAQ - 2

RapidQ Documentation Project

Frequently Asked Questions

Q. A little bit of a catastrophe has occurred. I've now had the report of a second iteration of the outbreak of a Trojan virus called backdoor.raid :-((( as a result of downloading and installing a Rapid-Q program I've written.

A1. Update Norton please or try another detector on your computer FIRST! The UPX homepages say the the UPX file compressor will set off some virus dectection software.. http://upx.tsx.org/

A2. Unpack your programm before distribution.

Q. ***I'm running on a Windows XP system**** when I load RQ, I get a error right after that pops up saying:
Cannot focus a disabled or invisable window

A. Just click OK and ignore it. (Or simply put "riched32.dll" in the same folder as "rapidq.exe")

Q. How to minimize an application to the task bar

A. These commands minimize an application to the task bar:

$INCLUDE "RAPIDQ.INC"
CONST GWL_HWNDPARENT = (-8)
DECLARE FUNCTION SetWindowLongAPI LIB "user32" ALIAS _
"SetWindowLongA" (ByVal hWnd AS LONG, ByVal nIndex AS LONG, _
ByVal dwNewLong AS LONG) AS LONG
Dim Form AS QFORM
WITH Form
SetWindowLongAPI(.Handle, GWL_HWNDPARENT, 0)
SetWindowLongAPI(Application.Handle, GWL_HWNDPARENT, .Handle)
.WindowState = wsMinimized
.ShowModal
END WITH

But if you search for a tray application then you can find a very simple one in the files section of this group:
http://groups.yahoo.com/group/rapidq/files/Scheduler.bas
This application also shows how to manage a tray popup menu. The application terminates automaticly if your windows session ends.

Regards
Martin

Q. How to put your application icon into the system tray area.

A.

' How to put your application icon into the system tray area.
' Double click your icon to "re-display" the application.
' Written in Rapid-Q by William Yu

$TYPECHECK ON

TYPE TNOTIFYICONDATA
    cbSize AS DWORD
    hWnd AS LONG
    uID AS LONG
    uFlags AS LONG
    uCallbackMessage AS LONG
    hIcon AS LONG
    szTip AS STRING*64
END TYPE

DECLARE SUB Shell_NotifyIcon LIB "SHELL32" ALIAS "Shell_NotifyIconA" _
                 (dwMessage AS LONG, NIDATA AS TNOTIFYICONDATA)

CONST FALSE = 0
CONST TRUE = 1

CONST NIM_ADD = 0
CONST NIM_MODIFY = 1
CONST NIM_DELETE = 2

CONST NIM_MESSAGE = 1
CONST NIM_ICON = 2
CONST NIM_TIP = 4

CONST WM_USER = &H400
CONST WM_TRAYICON = WM_USER + 400

CONST WM_COMMAND = &H111
CONST WM_SYSCOMMAND = &H112

CONST WM_LBUTTONDOWN = &H201
CONST WM_LBUTTONDBLCLK = &H203
CONST WM_RBUTTONDOWN = &H204
CONST WM_RBUTTONDBLCLK = &H206

CONST SC_MINIMIZE = 61472
CONST SC_CLOSE = 61536

DIM Form AS QForm
DIM Button AS QButton
DIM NI AS TNotifyIconData
DIM AlreadyTrayed AS INTEGER
    AlreadyTrayed = FALSE

SUB FormClose
  IF AlreadyTrayed THEN
     Shell_NotifyIcon(NIM_DELETE, NI)   '-- Remove our tray icon
  END IF
  Application.Terminate
END SUB

SUB ButtonClick
  IF NOT AlreadyTrayed THEN
    NI.cbSize = SIZEOF(NI)
    NI.hWnd = Form.Handle
    NI.uID = Application.hInstance
    NI.uFlags = NIM_ICON OR NIM_MESSAGE OR NIM_TIP
    NI.hIcon = Application.Icon
    NI.uCallBackMessage = WM_TRAYICON
    NI.szTip = "Rapid-Q Tray Example"+CHR$(0)
    Shell_NotifyIcon(NIM_ADD, NI)
    AlreadyTrayed = TRUE
  END IF
  Form.Visible = FALSE
END SUB

SUB FormWndProc (Handle AS INTEGER, uMsg AS DWORD, wParam AS LONG, lParam AS LONG)
  IF uMsg = WM_SYSCOMMAND THEN
    IF wParam = SC_MINIMIZE THEN
       '-- Minimize to system tray
       ButtonClick
    END IF
  ELSEIF uMsg = WM_TRAYICON THEN
     IF (lParam AND &HFFFF) = WM_LBUTTONDBLCLK THEN   '-- Respond on double click
        Form.Caption = "I'm back!"
        Form.Visible = TRUE                           '-- Bring back our form
        Form.WindowState = 0
     END IF
  END IF
END SUB

Button.Parent = Form
Button.Caption = "Tray me"
Button.OnClick = ButtonClick

Form.Caption = "Tray Example"
Form.Center
Form.OnClose = FormClose
Form.WndProc = FormWndProc
Form.ShowModal

Q. I need to get the desktop folder on Win98/2000

A.

CONST CSIDL_DESKTOP = &H0
CONST MAX_PATH = 260
CONST NULL = CHR$(0)

DECLARE FUNCTION SHGetSpecialFolderLocationAPI LIB "shell32" _
  ALIAS "SHGetSpecialFolderLocation" (ByVal hwndOwner AS LONG, _
  ByVal nFolder AS LONG, ByVal pidl AS LONG) AS LONG
DECLARE FUNCTION SHGetPathFromIDListAPI LIB "shell32" ALIAS _
  "SHGetPathFromIDListA" (ByVal pidl AS LONG, _
  ByVal pszPath AS LONG) AS LONG

TYPE ITEMIDLIST
  mkid AS LONG
END TYPE

FUNCTION GetSpecialFolder (csidl AS LONG) AS STRING
  DIM idl AS ITEMIDLIST
  DIM str AS STRING

  result = ""

  IF SHGetSpecialFolderLocationAPI(Application.Handle, csidl, idl) = 0 THEN
    str = SPACE$(MAX_PATH)
    IF SHGetPathFromIDListAPI(idl.mkid, VARPTR(str)) <> 0 THEN
      result = LEFT$(str, INSTR(str, NULL) - 1) + "\"
    END IF
  END IF
END FUNCTION

Showmessage(GetSpecialFolder(CSIDL_DESKTOP))

Regards
Martin

Q. I would like to know how to put a bitmap in the ClipBoard

A. Hopefully this will work for you.

$INCLUDE "RAPIDQ.INC"
Const LR_LOADFROMFILE = &H10
Const IMAGE_BITMAP = 0
Const IMAGE_ICON = 1
Const IMAGE_CURSOR = 2
Const IMAGE_ENHMETAFILE = 3
Const CF_BITMAP = 2
Const WM_PASTE As Long = &H302
Declare Function SetFocus Lib "user32.dll" Alias "SetFocus" (ByVal hwnd As Long) As Long
Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long
Declare Function CloseClipboard Lib "user32" Alias "CloseClipboard" () As Long
Declare Function OpenClipboard Lib "user32" Alias "OpenClipboard" (ByVal hwnd As Long) As Long
Declare Function EmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long
Declare Function SetClipboardData Lib "user32" Alias "SetClipboardData" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Declare Function IsClipboardFormatAvailable Lib "user32" Alias "IsClipboardFormatAvailable" (ByVal wFormat As Long) As Long
Declare Function GetClipboardData Lib "user32" Alias "GetClipboardData" (ByVal wFormat As Long) As Long

DIM OD AS QOPENDIALOG

DECLARE SUB GetPicture

Dim hDC As Long, hBitmap As Long
OD.Filter = "Bitmap Files (*.bmp)|*.bmp"
IF OD.Execute Then
hBitmap = LoadImage(Canvas1.Handle, OD.Filename, IMAGE_BITMAP, 320, 200, LR_LOADFROMFILE)
IF hBitmap = 0 Then
ShowMessage "There was an error while loading the bitmap"
EXIT SUB
END IF
OpenClipboard Canvas1.Handle
EmptyClipboard
SetClipboardData CF_BITMAP, hBitmap
IF IsClipboardFormatAvailable(CF_BITMAP) = 0 Then
ShowMessage "There was an error while pasting the bitmap to the clipboard!"
END IF
'Close the clipboard
CloseClipboard
END IF
END SUB

'----------- Danny Jackson

Q. I was wondering if anyone knows how to find the window/application handle

A. Here are 2 examples of using FindWindow():

Example 1:

DECLARE FUNCTION FindWindowAPI LIB "user32" ALIAS "FindWindowA" _
(ByVal lpClassName AS LONG, ByVal lpWindowName AS STRING) AS LONG
DECLARE SUB GetHandle
CREATE Form AS QFORM
Caption = "Test"
CREATE Button AS QBUTTON
Caption = "Get Handle"
OnClick = GetHandle
END CREATE
END CREATE
SUB GetHandle
DIM str AS STRING
str = STR$(Form.Handle) + "=" + STR$(FindWindowAPI(0, "Test"))
ShowMessage(str)
END SUB
Form.ShowModal

Example 2:

DECLARE FUNCTION FindWindowAPI LIB "user32" ALIAS "FindWindowA" _
(ByVal lpClassName AS LONG, ByVal lpWindowName AS STRING) AS LONG
pid = Shell("calc.exe")
DIM n AS SINGLE
n = TIMER
WHILE ABS(TIMER - n) < 2
DoEvents
WEND
ShowMessage(STR$(FindWindowAPI(0, "Calculator")))
' The second param must be the window title of calc.exe
' Note: The window title is often language dependent!

'Regards
'Martin

A2
1) One solution is use FindWindow like this previnst.bas example:
http://citymap.dnsart.com/_scripts/file.php?f=1490&r=2330
or
http://citymap.getmyip.com/_scripts/file.php?f=1490&r=2330
or
http://g.slyip.com/_scripts/file.php?f=1490&r=2330

Q. Is there some way in rapidqQ that I could connect to the internet?

A. Socket examples:

http://citymap.dnsart.com/_scripts/file.php?f=1050&r=2330
or
 http://citymap.getmyip.com/_scripts/file.php?f=1050&r=2330

Guidance

Q. How to setFocus for rapidq QEdit???

A.

DECLARE SUB EnterJump(key AS BYTE)
DECLARE FUNCTION GetFocus Lib "user32" Alias "GetFocus"() AS LONG
DECLARE FUNCTION Setfocus Lib "user32" Alias "SetFocus"(hwnd As Long) AS LONG

CREATE Form AS QFORM
    Caption = "Jump Enter"
    Width = 170
    Height = 170
    Center
    CREATE Edit1 AS QEDIT
        Text = "Edit1"
        Left = 20
        Top = 20
        OnKeyPress = EnterJump
    END CREATE
    CREATE Edit2 AS QEDIT
        Text = "Edit2"
        Left = 20
        Top = 60
        OnKeyPress = EnterJump
    END CREATE
    CREATE Edit3 AS QEDIT
        Text = "Edit3"
        Left = 20
        Top = 100
        OnKeyPress = EnterJump
    END CREATE
END CREATE

SUB EnterJump(key AS BYTE)
  IF key <> 13 THEN EXIT SUB
  Handle = GetFocus()
  SELECT CASE Handle
    CASE Edit1.Handle
      SetFocus(Edit2.Handle)
    CASE Edit2.Handle
      SetFocus(Edit3.Handle)
    CASE Edit3.Handle
      SetFocus(Edit1.Handle)
   END SELECT
END SUB

Form.ShowModal

'Jacques Philippe

Q Here are two RapidQ applications exchanging data

A

=================program #1========================

' name this ap_a.rqb and compile
' Bill K 12-2002
$APPTYPE GUI
$TYPECHECK ON
$OPTIMIZE ON
CONST CRLF=CHR$(13) & CHR$(10)
CONST WM_COPYDATA = &H4A
TYPE COPYDATASTRUCT
dwData AS LONG
cbData AS LONG
lpData AS LONG
END TYPE
DIM DataStruct AS COPYDATASTRUCT
DEFSTR strSend, strRecv
'
DECLARE SUB SendData
DECLARE SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&)
DECLARE FUNCTION FindWindow LIB "user32" ALIAS _
"FindWindowA" (ByVal lpClassName AS String, _
ByVal lpWindowName AS String) AS LONG
'
CREATE FORM AS QFORM
' title the other application will search for:
CAPTION="Application A"
left=100
top=100
CREATE sendbtn AS QBUTTON
WIDTH=75
TOP=form.clientheight-33
LEFT=(form.clientwidth-sendbtn.width)/4-15
CAPTION="SEND"
ONCLICK=senddata
END CREATE
CREATE sendlbl AS QLABEL
caption="Send:"
top=3
left=10
END CREATE 'sendlbl
CREATE recvlbl AS QLABEL
caption="Receive:"
top=3
left=form.clientwidth/2+15
END CREATE 'recvlbl
CREATE redit1 AS QRICHEDIT
hideselection=0
scrollbars=3
top=18
left=5
width=form.clientwidth/2-10
height=form.clientheight-60
END CREATE ' redit
CREATE Redit2 AS QRICHEDIT
hideselection=0
scrollbars=3
top=18
left=redit1.LEFT + redit1.width +10
width=form.clientwidth/2-10
height=form.clientheight-60
END CREATE ' Redit2
END CREATE ' FORM
'
SUB SendData
DEFLNG wndhnd
wndhnd=Findwindow("TForm","Application B")
IF wndhnd=0 THEN
SHOWMESSAGE "Could not find Application B"
EXIT SUB
END IF
strSend=redit1.text
DataStruct.lpData = VARPTR(strSend)
DataStruct.cbData = LEN(strSend)
SENDMESSAGE wndhnd, WM_COPYDATA, 0, DataStruct
END SUB
'
SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&)
IF uMsg& = WM_COPYDATA THEN
DIM MStream AS QMEMORYSTREAM
MStream.MemCopyFrom(lParam&, 12)
MStream.Position = 0
MStream.ReadUDT(DataStruct)
MStream.Close
strRecv = VARPTR$(DataStruct.lpData)
Redit2.addstrings strRecv
END IF
END SUB
'
REDIT1.ADDSTRINGS "This is sample data text" + _
crlf + "from Application A"
Form.WndProc = FormWndProc' best if this is
' just before showmodal
Form.showmodal

'========end of ap_a.rqb

=================program #2========================

' name this ap_b.rqb and compile
' Bill K 12-2002
$APPTYPE GUI
$TYPECHECK ON
$OPTIMIZE ON
CONST CRLF=CHR$(13) & CHR$(10)
CONST WM_COPYDATA = &H4A
TYPE COPYDATASTRUCT
dwData AS LONG
cbData AS LONG
lpData AS LONG
END TYPE
DIM DataStruct AS COPYDATASTRUCT
DEFSTR strSend, strRecv
'
DECLARE SUB SendData
DECLARE SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&)
DECLARE FUNCTION FindWindow LIB "user32" ALIAS _
"FindWindowA" (ByVal lpClassName AS String, _
ByVal lpWindowName AS String) AS LONG
'
CREATE FORM AS QFORM
' title the other application will search for:
CAPTION="Application B"
left=500
top=100
CREATE sendbtn AS QBUTTON
WIDTH=75
TOP=form.clientheight-33
LEFT=(form.clientwidth-sendbtn.width)/4-15
CAPTION="SEND"
ONCLICK=senddata
END CREATE
CREATE sendlbl AS QLABEL
caption="Send:"
top=3
left=10
END CREATE 'sendlbl
CREATE recvlbl AS QLABEL
caption="Receive:"
top=3
left=form.clientwidth/2+15
END CREATE 'recvlbl
CREATE redit1 AS QRICHEDIT
hideselection=0
scrollbars=3
top=18
left=5
width=form.clientwidth/2-10
height=form.clientheight-60
END CREATE ' redit
CREATE Redit2 AS QRICHEDIT
hideselection=0
scrollbars=3
top=18
left=redit1.LEFT + redit1.width +10
width=form.clientwidth/2-10
height=form.clientheight-60
END CREATE ' Redit2
END CREATE ' FORM
'
SUB SendData
DEFLNG wndhnd
wndhnd=Findwindow("TForm","Application A")
IF wndhnd=0 THEN
SHOWMESSAGE "Could not find Application A"
EXIT SUB
END IF
strSend=redit1.text
DataStruct.lpData = VARPTR(strSend)
DataStruct.cbData = LEN(strSend)
SENDMESSAGE wndhnd, WM_COPYDATA, 0, DataStruct
END SUB
'
SUB FormWndProc (Hwnd&, uMsg&, wParam&, lParam&)
IF uMsg& = WM_COPYDATA THEN
DIM MStream AS QMEMORYSTREAM
MStream.MemCopyFrom(lParam&, 12)
MStream.Position = 0
MStream.ReadUDT(DataStruct)
MStream.Close
strRecv = VARPTR$(DataStruct.lpData)
Redit2.addstrings strRecv
END IF
END SUB
'
REDIT1.ADDSTRINGS "This is sample data text" + _
crlf + "from Application B"
Form.WndProc = FormWndProc' best if this is
' just before showmodal
form.showmodal

'=== end ap_b.rqb

Q. How to Include ASM routines in RapidQ

A.

---------------------------------------------------------------------------
Jacques Philippe April 2002

HOWTO Include ASM routines in RapidQ using NASM and API CallWindowProc
---------------------------------------------------------------------------

First of all, a special thank to Pavel Minayev -aka evilone666- who opened
this road with Vector.Asm and Crc32.Asm. See Crc32.Zip and Rqasm.Zip in
RapidQ YahooGroups files section

INTRODUCTION
------------
- All the examples are ready for a NASM installation in c:\Nasm,
otherwise, you'll have to modify some directories.

- All the executable files are "TINY", to run them, you must copy your
RAPIDQCC.DLL and RAPIDQ32.DLL in your Windows directory (c:\Windows\)

- NASM, the 32 bits ASM compiler, is free. It's syntaxe is slightly
different from other Assemblers ; this can be confusing.

- Related Sites (I am new to NASM, so there may be better sites)
?official site? http://nasm.octium.net/
download http://www.web-sites.co.uk/nasm/where.html
GUI http://www.phoenix.gb.net/x86/

- Pavel's method loads a proc.bin as a resource at compile time and at
run time moves that resource to a QMemoryStream then uses the property
QMemoryStream.Pointer to point the procedure in API CallWindowProc.

- it's possible to directly load the proc.bin in a String or an Array and
use the VarPtr(String) or VarPtr(Array(0)) to point the procedure in
API CallWindowProc. The softwares BinToInc and BinToInc_Plus in
/Bin_To_Inc/ do that (the name BinTonInc was choosen for Binary to
RapidQ Include file). So, a single and simple file Included in the
RapidQ code will give access to ASM procedures.

NASM_SHELL_0, NASM_SHELL_1, NASM_SHELL_2 in dir \NASM_Shell\
----------------------------------------
Are NASM Shells to write Assembler routines called by Api
CallWindowProc in RapidQ

- use NASM_SHELL_2
- see NASM_SHELL_0 and NASM_SHELL_1 for a very basic tutorial

COMPILETOBIN.BAT in Directory \NASM_Compile\
----------------
Compiles a NASM source to a BIN file
- the line "set fich=GetByteAt" must be adapted to the filename of the
NASM source you want to compile
- the path to Nasmw.exe, the NASM compiler, must be adapted to your
directories
- CompileToBin.Bat must be in the directory of the NASM source code
file you want to compile
- the compiled .BIN file will be created in the same directory as
CompileToBin.Bat

BINTOINC.EXE in direcrtory \Bin_To_Inc\
------------
Creates a RapidQ code file containing the BIN file in an Array.
The name of the .BIN file is used to create a function and a pointer
to that array.

Just run BinToInc.Exe, then use menu File/Open to select a .Bin file.
As Soon as a .Bin file is selected, a RapidQ code is generated on the
screen ; save that code in an .Inc file using menu File/Save.
The Option menu allows you to Include the "CallAsmProc API" declaration
to the RapidQ code or not ; it's usefull if you include many asm .Inc
files in you software...

Demo :
Run BinToInc.Exe in \Bin_To_Inc\, then File/Open
\Bin_To_Inc\Demo\ReverseString.Bin,
once selected, the screen fills with A RapidQ Code. Save It as
\Bin_To_Inc\Demo\ReverseString.Inc

Now, you should be able to RQ Compile
\Bin_To_Inc\Demo\ReverseStringDemo_2.Bas

Here is the kind of file created by BinToInc.Exe with an ASM .Bin file

' Begin of File ReverseString.Inc cut and pasted
'
DECLARE FUNCTION CallAsmProc LIB "user32" ALIAS "CallWindowProcA" _
(Proc AS LONG, A1 AS LONG, A2 AS LONG, A3 AS LONG, _
A4 AS LONG) AS LONG
'
' ============================================================
' ----- START ASM ReverseString -----
DefByte ReverseStringArray (0 To 60) = _
{ _
&HC8, &H00, &H00, &H00, &H51, &H56, &H57, &H8B, &H7D, &H0C, _
&H8B, &H75, &H08, &HB8, &H00, &H00, &H00, &H00, &HB9, &H00, _
&H01, &H00, &H00, &HFC, &HA4, &H40, &H80, &H3E, &H00, &H0F, _
&H84, &H02, &H00, &H00, &H00, &HE0, &HF2, &H8B, &H75, &H0C, _
&H01, &HC6, &H4E, &H8B, &H7D, &H08, &H89, &HC1, &HFC, &HA4, _
&H4E, &H4E, &HE0, &HFA, &H5F, &H5E, &H59, &HC9, &HC2, &H10, _
&H00 _
}
' ----- END ASM ReverseString -----
'
' ----- POINTER to use In CallAsmProc -----
' A Bit Faster than Calling ReverseString
DefInt ptrReverseString
ptrReverseString = VarPtr (ReverseStringArray(0))
'
' ----- RQ CALL ReverseString -----
Function ReverseString (Arg1 As Long, Arg2 As Long, Arg3 As Long, _
Arg4 As Long) as Long
Result = CallAsmProc (ptrReverseString, Arg1, Arg2, Arg3, Arg4)
End Function
'
' ============================================================
' End of File ReverseString.Inc cut and pasted

RapidQ source BinToInc.Bas is available in \Bin_To_Inc\RQ_Source ;
these sources require QRedEx.Inc and QIni_JP.Inc to compile.

BINTOINC_PLUS.BAS
-----------------
Does the same as BINTOINC.BAS, but with all the .BIN files present in
the selected directory. Try in \Bin_To_Inc\Demo_Plus\

RQASMTOINC.BAS RqAsm editor 'Compiling' directly Bin To an RQ .Inc file
--------------
RqAsm Adds the Nasm Header and Footer, creates the arguments macro to
call them by their names in the Nasm code.

_ RqAsm knows four words if most left on a line and followed by a space
function
end function
sub
end sub
- the first word following 'function' or 'sub' is the name of the
function used in the creation of the RQ code. That 'name' will be
used to
- create the 'name.Asm' file
- compile the 'name.Bin' file
- name the RQ 'nameArray'
- create the RQ 'ptrName' to nameArray(0)
- create the RQ function or sub 'name'
- the words following the function or sub name are the arguments names
they will be used to define NASM macros, allowing easier access to
'pushed' arguments,
- separator between names and arguments is a single space = " "
- all lines out of function/end function or sub/end sub are ignored
- all other lines will simply be copied in the name.Asm file, such as
asm code lines, commented lines, ...

Here is An RqAsm Example :

--- RqASm Code Start --------------
; FUNCTION GET BYTE AT
; --------------------
; address is a pointer
;
function GetByteAt address
push edx
mov eax, address
mov edx, 0
mov dl, [eax]
mov eax, edx
pop edx
end function
--- RqAsm Code End ----------------

RqAsmToInc will create a NASM code GetByteAt.Asm file :

--- NASM Code Start ---------------
; PROC NAME : GETBYTEAT
;
; NASM CODE Generated by rqAsmToBin on 04-14-2002 at 14:07:54
;
bits 32
;
%define address [ebp+08]
;
segment .text
start:
enter 0, 0
;
; End Of RqAsm Automated Header
; User's Code Begins Here
;
push edx
mov eax, address
mov edx, 0
mov dl, [eax]
mov eax, edx
pop edx
;
; End of User's Code
; Automated RqAsm Footer
leave
ret 16
;
; End of NASM Code
--- NASM Code End -------------------

RqAsmToInc will compile it in GetByteAt.Bin file

And Finnally RqAsmToInc will create a GetByteAt.Inc file

'
' ============================================================
' ----- START ASM GetByteAt -----
DefByte GetByteAtArray (0 To 21) = _
{ _
&HC8, &H00, &H00, &H00, &H52, &H8B, &H45, &H08, &HBA, &H00, _
&H00, &H00, &H00, &H8A, &H10, &H89, &HD0, &H5A, &HC9, &HC2, _
&H10, &H00 _
}
' ----- END ASM GetByteAt -----
'
' ----- POINTER to use In CallAsmProc -----
' A Bit Faster than Calling GetByteAt
DefInt ptrGetByteAt
ptrGetByteAt = VarPtr (GetByteAtArray(0))
'
' ----- RQ CALL GetByteAt -----
Function GetByteAt (Arg1 As Long) As Long
Result = CallAsmProc (ptrGetByteAt, Arg1, 0, 0, 0)
End Function
'
' ============================================================
'
that can be included in your RApidQ code. And simply called in RQ by
GetByteAt(address)

...more

- Sub, Function and End Sub and End Function are delimiter. Same
reserved word as in RapidQ
- functionName, subName, arg_1, arg_2, arg_3, arg_4 must br any
'valid' NASM names
- the function/sub elements are separated by one single space
- arg_1, arg_2, arg_3, arg_4 are always Longs. Long can be a
pointer to anything : string, array, structure, CodePtr, ...
- functions returns always a Long (register eax is the returned value).
- Sub and Function cannot be nested
- Nearly all NASM procedure in the world can be 'ported' to RQ.
There even is a GUI 'set' written NASM available named 'gaz'.

Files and Directories
---------------------
- The RqAsm file is saved in the RqAsm directory (choosen by user)
All the intermediary files, .ASM files and .BIN files, are stored
in that directory too.
- The final .INC file is saved in the INC directory (choosen by the
user) IE, in the RapidQ current project directory
- These two directories are choosen by the user on "Open RqAsm" or
"New RqAsm"
- The last directories and filename used are saved in an INI file
on RqAsmToInc Exit and reloaded on start.

RAPIDQ_TEST RQ ASM SPEED TESTS in directory \RapidQ_Test\
-----------
- ConAsmTest.Exe source : ConAsmTest.Bas
- GuiAsmTest.Exe source : GuiAsmTest.Bas
These will show you that CallWindowProc put a terrible time burden
on your fast ASM procedures...

RqAsmToInc in an usefull but unfinished thing... it could
- include the RQ Call Function
- have a better file saving system
- ...

April 14th, 2002

Jacques

Q.Could someone send me a working example of how to create a custom event?

A. ============= Pavel Minayev 27 Mar 2001 =======

' A short example demonstrating custom events
' QCircle is a simple control that looks a circle, and it
' provides OnHitCircle event, which is called each time the
' user clicks inside of the circle. It also passes one argument
' which is the distance from the center of the circle to
' the point clicked.

$INCLUDE "rapidq.inc"

' This declaration is used as a template for event handlers
' for OnHitCircle event
DECLARE SUB HitCircleEvent(d AS SINGLE)
' At least one parameter requared!
' Without parameters is not working!

TYPE QCircle EXTENDS QCanvas
' Declare an event based on previously declared handler template
OnHitCircle AS EVENT(HitCircleEvent)

EVENT OnPaint
WITH QCircle
.Circle(0, 0, .Width, .Height, clWindowText, clBtnFace)
END WITH
END EVENT

EVENT OnMouseDown(Button AS LONG, x AS LONG, y AS LONG, Shift AS LONG)
WITH QCircle
d = SQR((x - .Width / 2) ^ 2 + (y - .Height / 2) ^ 2)
' If cursor was inside of the circle, fire the event
IF d <= .Width / 2 THEN CALLFUNC(.OnHitCircle, d)
END WITH
END EVENT

CONSTRUCTOR
Width = 100
Height = 100
END CONSTRUCTOR
END TYPE

' Test code

SUB Circle1_HitCircle(d AS SINGLE)
SHOWMESSAGE "Distance from center: " + STR$(d)
END SUB

CREATE Form AS QForm
Width = 300
Height = 300
CREATE Circle1 AS QCircle
OnHitCircle = Circle1_HitCircle
END CREATE
Center
ShowModal
END CREATE

Q. I'm trying to set a richedit up to delete a line by pressing Ctrl+Y

A. Try something like this... (Achilles B. Mina)

DECLARE SUB keybd_event Lib "user32.dll" Alias "keybd_event"_
(bVk As Byte,bScan As Byte,dwFlags As Long,dwExtraInfo As Long)
DECLARE FUNCTION Setfocus Lib "user32" _
Alias "SetFocus"(hwnd As Long) As Long
DECLARE SUB DelLine

CREATE Form AS QFORM
    Center
    CREATE Rich AS QRICHEDIT
        Align = 1
        AddString "RichEdit1"
    END CREATE
    CREATE Button AS QBUTTON
        Caption = "Delete"
        Left = 115
        Top = 118
        OnClick = DelLine
    END CREATE
END CREATE

SUB DelLine
  Rich.Line(Rich.WhereY) = ""
  keybd_event(8,0,0,0)
  SetFocus(Rich.Handle)
END SUB

Form.ShowModal

About RapidQ compatibility with Windows ? RapidQ is compatible with Win95, Win98 and Win ME without limitations. On Win 2000 and Win XP, 3D objects and Sound keyword don't work, and an error popup appears when launching the IDE. RapidQ doesn't work on Win 3.x | Jean CARTIER
How do I change the Explorer icon for my program? Use the button next to "Code it!" in the RapidQ IDE. The icon must be 766 bytes. | T Strong
How do I change the minimised Icon for my program? Use application.icon method in your program. For more information click <a href="http://www.basicguru.com/rapidq/faqs.html#5"> here </a> | T Strong
Is RapidQ still under development? Nope. The author left for RealBASIC. It's cool, but a bit bloated and of course expensive. | W

Q. I Know that there can be arrays of UDT's but why can't they be nested like so ???

A. Because it's not implemented in RapidQ :(

Q. Sub not returning value through parameters, as in QuickBasic.

A. Pass parameters "byref"

defsng Lmin, Lmax
'**********************************************************************
sub DatExtr (Dat!() as single, byref DatMin!, byref DatMax!) '' as single
defint  p,  MaxEl,MinEl

MinEl=DatMin! : MaxEl=DatMax!

defsng ARMax!=Dat!(MinEl)
defsng ARMin!=Dat!(MinEl)

FOR p = MinEl TO MaxEl:
    IF Dat!(p) > ARMax! THEN ARMax! = Dat!(p):
    IF Dat!(p) < ARMin! THEN ARMin! = Dat!(p):
NEXT p
DatMax!=ARMax!: print "DatMax=" ,DatMax!
DatMin!=ARMin!: print "DatMin=" ,DatMin!

END SUB
'**********************************************************************

DefSng arg!( 9) ={1, 12, 12, 13, 14, 14, 15, 16, 17, 18}

for i=0 to 9:print "arg!(",i,")=",arg!(i)  :next i

Lmax=Ubound(arg!):Lmin=Lbound(arg!)
print "Lmin=" ,Lmin '=0
print "Lmax=" ,Lmax '=9

call DatExtr (arg!, Lmin, Lmax)

print "Lmin=" ,Lmin '=1
print "Lmax=" ,Lmax '=18

Q. Does anyone know how to create a parent property for a custom component?

I'm trying to make a toolbar component, using commctl32. But when I create the toolbar in code:

CREATE Form AS QFORM
     CREATE ToolBar AS QTOOLBAR
 ...
  I get "Parent not part of class QTOOLBAR"
 so I do this:
 TYPE QTOOLBAR EXTEND QOBJECT
     parent as QFORM
...

I get "Component assignment not yet supported"

Does anyone know how to assign a parent to QOBJECT?
Also how to use an Align property without knowing what other
components exist on the parent form?

A. ( b_j0 25 feb 2002 16:34 )

Yep! Try implementing the Parent property by creating a QForm
Property Set and setting the Parent property of the main object to
the property set, like this:

' This is my style of coding :)
' Oh, don't use hParent.Handle; it won't work :p
Parent as QForm Property Set SetParent
Property Set SetParent(hParent as QForm)
This.MainObject.Parent=hParent ' Yes, you can assign the Parent
                                 ' property of your main object to
                                 ' any visual QObject datatype, but
                                 ' only if that object supports the
                                 ' Parent property.
                                 '
                                 ' BTW, this is an undocumented
                                 ' feature :)
 End Property

See ya! Hope this is what you needed :)

Q. Custom OnShow event for our component!

A. "psyclops420"

Here's how it works:

(BTW, if you haven't already, read the docs, Chapter 10, "Creating Custom components", it'll help you understand
what I'm talking about here)
Lines 1 + 2 are the API's required to subclass a component. "Subclassing" means we are changing how, and where,
Windows processes messages for the component.
In this case, we just want to know what messages the component is getting.
Lines 3, 4, + 5 are declares for our new custom events. You won't actually be using these sub names, they just
tell the compiler to bind the parameters.
Now we create our new component, extending the old QEDIT.
We give it a timer, a long(to store the address of the original window procedure), and our new event names,
binding them to those previously declared subs.
Now time for the new window procedure.
First we check for the proper handle( if there is more than one QEDIT, this procedure gets assigned to all of them,
so this assures we process messages only for the QEDIT that the user is currently working with).
Next we let Windows process the message by calling the old window procedure with the message parameters:
"Result = CallWindowProc(..."
This way Windows takes care of all the drawing and stuff. At this point, Windows is satisfied, because it has
processed the message itself.
Now we ask, "What was the message?"
If it was WM_SETFOCUS(&H7) then we call our OnGetFocus event using CALLFUNC. We pass, as a parameter, the QEDIT that is being focused.
Or if the message was WM_KILLFOCUS(&H8) we call OnLostFocus the same way.
Either way, we send the whole message to our WndProc event, doing anything we want to in response to the message.
Now for the magic! What's the timer for, you say...
This is my own little trick. Somewhere in the docs it says "A QTIMER will not be active unless a form is visible."
So we create a timer with an interval of one. As soon as the form is drawn, the timer starts and immediately fires it's OnTimer event, subclassing our window: ".OldWndProc = SetWindowLong(..."
Then the timer shuts itself off. So, in theory, we have created a custom OnShow event for our component!
Thats pretty much it. If you have any more questions, don't hesitate to ask.
Psyclops ?

Q. How to click buttons/icons in other programs

A.

'***Sample ButtonClick Routines****   CONST VK_SPACE = &H20
CONST WM_CHAR = &H102
CONST WM_KEYUP = &H101
CONST WM_LBUTTONDOWN = &H201
CONST WM_LBUTTONUP = &H202
  Declare Function SendMessageWord Lib "user32" Alias "SendMessageA" (hwnd As Long, wMsg As Long, wParam As Long, lParam As STRING) As Long
Declare Function SendMessageBtn Lib "user32" Alias "SendMessageA" (hwnd As Long, wMsg As Long, wParam As Long, lParam As LONG) As Long
  '***Clicks an icon once you have it's window handle   SendMessageBtn(icon&, WM_LBUTTONDOWN, 0, 0)
SendMessageBtn(icon&, WM_KEYUP, VK_SPACE, 0)   '***In some isolated cases, you might need to do this instead:   SendMessageBtn(icon&, WM_LBUTTONDOWN, 0, 0)
SendMessageBtn(icon&, WM_LBUTTONUP, 0, 0)   '***On Window Class #32770 (Windows Dialog Boxes), you can send text to the edit field and click those buttons too. Once again, you will need to find the Window handle to the button you wish to click:   SendMessageWord(edit&, WM_SETTEXT, 0, Text$) 'Puts text in the edit field   '***This clicks the "OK" button, but can easily be changed to click "Cancel":   SendMessageBtn(OKbtn&, WM_LBUTTONDOWN, 0, 0)
SendMessageBtn(OKbtn&, WM_LBUTTONUP, 0, 0)   '***Ceratin Icons will let you do this also:   SendMessageWord(icon&, WM_CHAR, 13, 0)   I have found this to be nothing more than "Find what works & use it" :)   I hope this helps at least someone out there... -Ron


Rapid-Q Documentation by William Yu

  • Rapid-Q is a multi-platform, multi-purpose BASIC compiler/interpreter.
  • Rapid-Q is created by William Yu
  • Rapid-Q is free for commercial or non-commercial use.
  • Rapid-Q comes with no warranties, or guarantees.
  • Rapid-Q is currently in a beta stage, but is fully functional.

Contents Up Next page


Alphabetic Index

RapidQ Documentation Project

The Alphabetic Index

Back to Contents

A | B | C | D | E | F | G | H | I | J | K | L | M
N | O | P | Q | R | S | T | U | V | W | X | Y | Z

A

 ABS - Returns absolute value of number
 ACOS - Returns arccosine
ALIAS - How to call a DLL
 ADDRESS
APPLICATION - Component
 AND - Conjunction
 ARRAY
AS
ASC - Returns the ASCII key value
Assembler
ASIN - Returns arcsine
ATAN
ATN
@ -pass a variable by reference
 Up

B

 BIND -will bind a variable as a function pointer
 BIND [3]
 BIN$ - convert INTEGER to binary
 BYREF
BYTE -Variable Type
 Up

C

 CALL - call sub
 CALLBACK - return the absolute address of a SUB or FUNCTION
 CALLFUNC - execute the function pointer
 CALLFUNC [3]
 CASE - SELECT CASE ..
 CEIL -rounds a numeric expression up toward positive infinity
 CHDIR - change the current directory
 CHDRIVE
CHR$
CINT
CLIPBOARD
CLNG
CLS
CODEPTR - return the absolute address of a SUB or FUNCTION
 COLOR
COLOR
COLOR [3]
 COLOR [4]
 COMMANDCOUNT -Number of command line parameters received
 COMMAND$
Console
CONSOLE.INPUTHANDLE - console input handle
 CONSOLE.OUTPUTHANDLE
CONST
CONSTRUCTOR -object creation
 CONSTRUCTOR... END CONSTRUCTOR
CONVBASE$
COS
CREATE, Similar to DIM
CREATE... END CREATE
CREATE... END CREATE
CREATE... END CREATE [3]
 CSRLIN
CURDIR$ - Returns the current working directory of your application
 Up

D

 DATE$
DEC -Decrements numeric variable
 DEF...
DECLARE
DEFBYTE
DEFDBL
DEFDWORD
DEFINT
DEFLNG
DEFSHORT
DEFSNG
DEFSTR
DEFWORD
DELETE$
Device
DIM
Directories
DIREXISTS
DIR$
DLL
DO .. LOOP
DOEVENTS
DOUBLE
DWORD
Up

E

ELSEIF
END
ENVIRON
ENVIRON$
EVENT
EXECUTE
EXIT
EXIT
EXP
EXTRACTRESOURCE - A statement that extracts a resource, from the current program, to a file
 EXTENDS -object creation
 Up

F

 FIELD$ - A function that returns a field (or token) separated by deliminators
 FILEEXISTS
FindMax
FIX - A function that removes the fractional part of a number
 FLOOR - A math function that rounds a numeric expression down toward negative infinity
 FOR .. NEXT
FORMAT$ - function that returns a formatted string
 FRAC - A function that returns the fractional part of a number
 FUNCTION... END FUNCTION
FUNCTIONI... END FUNCTIONI - SUB/FUNCTIONs with variable parameters

Function
  • MATH
  • ADDRESS
  • String
  • CONVERSION
  • POINTER
  • SYSTEM
  • input/output
Up

G

 GET$ - general purpose read function
 GOTO
GOSUB

Up

H

 HEX$
Up

I

 IF .. THEN .. ELSE
IIF - immediate IF function
 INC
INFIX - INFIX/POSTFIX notation
 INITARRAY
INP - A device I/O function
 INPUT - CONSOLE Statement
 INPW - A device I/O function
 INTEGER
INKEY$
INPUT$
INSERT$
INSTR
IS - SELECT CASE
INT
INV - Inverse Modulus
 Up

J

 Up

K

 KILL - removes a disk file.
 KILLMESSAGE - removes a message from the queue
 Up

L

 LBOUND
LCASE$
LEFT$
LEN
LFLUSH - begin a print job
 LIB
LIBRARYINST - Returns the handle to the DLL module
 LIKE - pattern matching routine
 LOCATE
LOG - natural logarithm
 LONG
LOOP
LPRINT
LTRIM$
Up

M

 MEMCMP - compares 2 memory addresses
 MEMCPY - copies n bytes of memory
 MEMSET - initializes a memory blocks
 MESSAGEBOX - simple message box
 MESSAGEDLG - message box with an icon
 MID$
MKDIR
MOD - Modulus/Remainder
 MOUSEX, MOUSEY
Up

N

 NEXT
NOT
Up

O

OPERATORS: +, -, *, /
OPERATORS:
integer division \
OPERATORS:
relational =, >, <, <>, <=, >=
OPERATORS:
Power rising -exponentiation ( ^ )
 OR
OUT
OUTW
Up

P

 PARAMSTRCOUNT - Number of string parameters passed
 PARAMVAL - Array of numeric parameters
 PARAMVALCOUNT - Number of numeric parameters passed
 PARAMSTR$ - Array of string parameters
 PCOPY - Copies one screen page to another
 PEEK - CONSOLE Function
 PLAYWAV - Plays a .WAV file
 POKE
POS
POSTMESSAGE - WinAPI call to PostMessage
 PRINT - outputs data to the screen
 PRINTER - PRINTER Component
 PROPERTY SET... - custom events
 Up

Q
See also Custom components
QAbout -dialog box "About" showing the name,version,author of an application,email link and web link
 QAnim -animation inherited from QImage
QBevel - Qbevel implements a generic container for your components
 QBITMAP
QBitmapEx - Additional methods
____________________________
 QBUTTON
also
 QFlatButton - An Internet Explorer style flat button for Windows users
 QCOOLBTN
QOVALBTN
QTextBtn
QSkinBtn
QColorButton.inc
_____________________________
Qcalendar
QCANVAS
QCanvasEx - Additional methods
 QCDAUDIO
QChart -a set of 2-D charting routines
 QCHECKBOX
QColorDialog
QCOMBOBOX
QCOMPORT
QComPort - implements some of the functionality of the missing QCOMPORT Component
 QCOOLBTN
Qcrypt use RC4 stream cipher symmetric key algorithm
QCursor -load cursor from resource or file
 QDataBase -create and manipulate data base files.
 QDEBUG
QDialog -Displays Window&aposs Open and Save Dialogs
 QDigDisplay -simulates a seven segment LED display
 QDir -QDIR is a analog of "DOS" DIR and DIR /S command (old ver)
 QDIR - new version
 QDirListView - like QFileListBox, but is a bit more "pretty"...
QDIRTREE
QDockForm
QDownload
QDrawFocus -a focus to use as selection in graphic components
 QDrawMenu -draw bitmap in an item of menu.(See also QMenuOwnerDraw )
 QDrive - is a component no visible of infos drivers.
 QDriveCombobox -QCombobox with filling of present drivers
 QEDIT
QxEdit - New QEDIT component, two new events, OnGetFocus and OnLoseFocus, plus implemented WndProc
QFILEDIALOG
QFILELISTBOX
QFileListView
QFILESTREAM
QFlashLabel
QFlatButton - An Internet Explorer style flat button for Windows users
 QFONT
QFONTDIALOG
QFORM
QFormMDI - for WinXP/2000/NT only
 QFtpClient
QMDI_API - for Win9x
 QGAUGE
QGLASSFRAME
Qgraph
QGROUPBOX
QHEADER
QICON -no visible with icons extraction from exe,dll,icl,ico files or associated files and save file to icon format
 Qid3Tag -read / write id3 tags ver 1.x
 QIMAGE
QImageEx
QImageBox
QImageDialog -dialog box selection of files with visualization of the graphic types
 QIMAGELIST
QINI -no visible to read and write init files for application
 QLABEL
QLine -a line for separator of toolbar.
 QLISTBOX
QLISTVIEW
QListviewEx
QLZFileStream
QMAINMENU
QMEMORYSTREAM
QMENUITEM
QMenuOwnerDraw - Ownerdrawn MenuItems
 QMIDI
Qmsgdlg- Shows standard Message Dialog, with buttons in local language
QMYSQL
QNOTIFYICONDATA
QOPENDIALOG
QOLECONTAINER
QOBJECT
QOLEOBJECT
QOUTLINE
QOVALBTN
QPageSetup -a printer dialog box
 QPANEL
QPOPUPMENU
QPrinterInfo -information about défault printer
 QProgress -progress bar
 QRADIOBUTTON
QRECT
QREGISTRY
QResourceStream
QRICHEDIT
QRichEdit Ex
 QRun -no visible to éxecute applications or associated files
 QSAVEDIALOG
QSaveDialogEx -extends QSaveDialog
 QSkin -inherited from QForm used to have the shapes and skins of file bitmap
 QSkinBtn
QSCROLLBAR
QSCROLLBOX
QSOCKET
Qspintext -
 QSplash -showing banner during a time before the opening of application
 QSPLITTER
QSPLITTER Ex
 QSTATUSBAR
QStatusBarEx
QSTRINGGRID
QStringGridEx
QSTRINGLIST
QTABCONTROL
QTabControlEx
QTButton
QTextBtn -button component of text type
 QTIMER
QTRACKBAR
QTREEVIEW
QTreeviewEx
QDXIMAGELIST
QDXSCREEN
QDXSOUND
QDXTIMER
QD3DANIMATION
QD3DANIMATIONSET
 QD3DFace
QD3DFRAME
QD3DLight
QD3DMesh
QD3DMeshBuilder
QD3DTexture
QD3DVector
QD3DVisual
QD3DWrap
QUICKSORT
QVIDEO
QVuMeter
QWAVE
Up

R

 RANDOMIZE
READ
REDIM
REM
RENAME
REPLACE$
REPLACESUBSTR$
RESULT
RESTORE
RESOURCE
RESOURCECOUNT
RETURN
REVERSE$
RGB
Rich Edit Controls
RIGHT$
RINSTR
RMDIR
RND
ROUND
RTRIM$
RUN
Up

S

 SCREEN
SELECT CASE
SENDMESSAGE
SETCONSOLETITLE
SGN
SHELL
SHL
SHR
SHORT
SHOWMESSAGE
SIN
SINGLE
SIZEOF
SLEEP
SOUND
SPACE$
SQR
SUB... END SUB
SUBI... END SUBI
SUBI... END SUBI
STACK.INT
STACK.STR$
STATIC
STEP
STRING
STRUCT - see TYPE
 STRING$
STR$
STRF$
SUPER
SWAP
$APPTYPE
$DEFINE
$ELSE
$ENDIF
$ESCAPECHARS
$IFDEF
$IFNDEF
$INCLUDE
$MACRO
$OPTIMIZE
$OPTION
$RESOURCE
$TYPECHECK
$UNDEF
Up

T

 TALLY
TAN
TIMER
TIME$
TO
TYPE
Up

U

 UBOUND
UCASE$
UNLOADLIBRARY
UNIX
UNTIL
Up

V

 VAL
VARIANT
VARPTR
VARPTR$
VARTYPE
Up

W

 WHILE .. WEND
WITH
WITH... END WITH
WIN32
WORD
Up

X

 XOR
XREPLACE$
 Up

Y

 Up

Z

 Up

Rapid-Q Index
© Stanescu Serban, 2001


Appendix C: Internal Variables

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix C: Internal Variables

Internal Variables

Internal Variables are Read-Only (except SCREEN.CURSOR and SCREEN.CURSORS). When I refer to Unix, I mean Linux & Unix.

Variable | Support | Type | Description
CommandCount | Windows Unix | INTEGER | Number of command line parameters received.
Command$() | Windows Unix | ARRAY | Array of commands received (commands are separated by spaces), first element starting at 1. The zero'th element is your application path/name.
CurDir$ | Windows Unix | STRING | Returns the current working directory of your application
IsConsole | Windows Unix | INTEGER | Returns a non-zero number if application is a console, 0 otherwise.
MouseX | Windows | INTEGER | Returns X Coordinate of Mouse Pointer relative to your active Form. This function is being deprecated.
MouseY | Windows | INTEGER | Returns Y Coordinate of Mouse Pointer relative to your active Form. This function is being deprecated.
ParamStrCount | Windows Unix | INTEGER | Returns number of String parameters received. This variable is used only inside a SUBI or FUNCTIONI declaration.
ParamStr$() | Windows Unix | ARRAY | Used only inside a SUBI or FUNCTIONI declaration. Returns string parameter value, first element starting at 0.
ParamVal() | Windows Unix | ARRAY | Used only inside a SUBI or FUNCTIONI declaration. Returns numeric parameter value, first element starting at 0.
ParamValCount | Windows Unix | INTEGER | Returns number of Numeric parameters received. This variable is used only inside a SUBI or FUNCTIONI declaration.
Screen.ConsoleX | Windows Unix | INTEGER | Returns maximum column for console screen, useful under Unix.
Screen.ConsoleY | Windows Unix | INTEGER | Returns maximum row for console screen, useful under Unix.
Screen.Cursor | Windows | INTEGER | Change global mouse pointer
Screen.Cursors | Windows | ARRAY of INTEGER | R/W array of cursor handles.
Screen.Height | Windows | INTEGER | Returns Windows screen Height (not to be confused with Form Height)
Screen.MouseX | Windows | INTEGER | Returns X Coordinate of Mouse Pointer relative to your screen.
Screen.MouseY | Windows | INTEGER | Returns Y Coordinate of Mouse Pointer relative to your screen.
Screen.Width | Windows | INTEGER | Returns Windows screen Width
Stack.Int() | Windows Unix | ARRAY | Returns most current stack integer parameter. First element starting at 0. This function is deprecated.
Stack.Str$() | Windows Unix | ARRAY | Returns most current stack string parameter. First element starting at 0. This function is deprecated.


Appendix C: Loops

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Loops

Introduction to Looping

Loops provide a mechanism for executing a series of instructions a certain number of times. Many of your programs will involve looping. Compilers convert loops to GOTO statements, so you could implement your own LOOP using GOTOs without any consequences. However, for optimization purposes, the FOR loop in Rapid-Q doesn't use this mechanism to save on unnecessary instructions. You may notice that your FOR loop is slightly faster than your WHILE or DO loop in Rapid-Q.

FOR .. NEXT Loop
As previously stated, in Rapid-Q this looping structure is optimized, but you may only notice a slight difference. There are some special cases when using a FOR loop in Rapid-Q.
    FOR I(1) = 1 TO 100
    NEXT
This is not valid in Rapid-Q. Why not? Because I(1) is an array, you'll get a compiler error. Only simple types are supported, which means anything BUT arrays. The default increment value is 1, if you want a different increment value, please use STEP:
    FOR I = 1 TO 100 STEP 2
      PRINT I
    NEXT
This will skip all the even numbers, so the output will be: 1 3 5 7 9 ...etc. If for whatever reason you wanted to exit the loop, you can use EXIT FOR.

WHILE .. WEND
If you want to test a condition before entering the loop, you could use a WHILE .. WEND loop. There are no special cases when using this loop, it's exactly like QBasic:
    WHILE I < 100
      I++          '-- Increment I
    WEND
It's much like a DO .. LOOP, except the expression is tested before entering the loop. To exit the WHILE .. WEND loop for whatever reason, you use EXIT WHILE.

DO .. LOOP
A simple DO .. LOOP without any test expression will loop infinitely:
    DO
      PRINT " Hello World! "
    LOOP
To exit the DO .. LOOP, you use EXIT DO. Infinite loops aren't used much in Windows programming (event based anyway). You'll usually want a test expression as in our WHILE .. WEND loop, except we place it differently:
    DO
      I++
    LOOP UNTIL I >= 100
Unlike QBasic or other implementations of BASIC, Rapid-Q does not offer DO WHILE or LOOP WHILE. They're basically useless (ie. they can be implemented in another way), except to provide users with more options. For example, this is valid in QBasic:
   DO
   LOOP WHILE I < 100
Which is equivalent to:
   DO
   LOOP UNTIL I >= 100


Appendix C: Methods

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Methods

Introduction to Methods

There's many definitions of a "method," for lack of a better word, that's what I'm using to describe the methods CONSTRUCTOR, CREATE and WITH. Alone they serve no purpose, but you'll learn what each does, and how to use them here.

CREATE .. END CREATE
Using CREATE is exactly like using DIM
    CREATE Form AS QForm
    END CREATE

    '' or

    DIM Form AS QForm
However, the CREATE method offers more. It can save you typing, and also make your code look cleaner by embedding CREATEs (refer to Chapter 5). Any code you type inbetween the CREATE .. END CREATE method is automatically bound to that object. Since there's no point in regurgitating what was already mentioned, please refer to Chapter 5 for some examples.

WITH .. END WITH
The WITH construct is to provide the developer an easier way to reference properties, methods, and events of certain objects. Basically what it does is save you a lot of typing:
    Form.Caption = "Hello"
    Form.ShowModal

    '' Using WITH

    WITH Form
       .Caption = "Hello"
       .ShowModal
    END WITH
You can also embed WITH .. END WITH statements:
    Something.Another.Caption = "Hello"

    '' Using WITH

    WITH Something
       WITH Another
         .Caption = "Hello"
       END WITH
    END WITH
As you can see, the embedded WITH statement inherits the previous declaration. The period at the front tells the compiler to bind that variable to the WITH declaration. Anything which doesn't start with a period won't be bound, don't worry, decimal numbers won't be bound.

CONSTRUCTOR .. END CONSTRUCTOR
This method is only used inside a TYPE declaration when you're defining your own objects. It will give default values to your properties whenever your component is created (DIMmed).
    TYPE NewObject EXTENDS QObject
      Left AS INTEGER

      CONSTRUCTOR
        Left = 50
      END CONSTRUCTOR
    END TYPE
There's nothing to it, it's much like the CREATE method, except our object in this case is NewObject.


OLE

Hello,
I am sorry to bother you, but I need help with using COM controls.
My problem is not really with using QOLEOBJECT and QOLECONTAINER, I
understand fairly well how to use these. What I do not understand is how I
can find the properties, methods, and events of a particular control. For
example:

Dim Object as QOLEOBJECT
Object.CreateObject("Word.Basic")

How did you know to use "Word.Basic"?

Or another example:

Dim msHTML as QOLECONTAINER
msHTML.CreateObject("Shell.Explorer.1")

How did you know to use "Shell.Explorer"?

Using the program Dependency Walker to view msHTML.dll, I see nothing that
says "Shell.Explorer", so I assume that what I'm looking for is found
somewhere else.

I apologize for the dumb question, but it's been bugging for awhile now and
I still can't figure it out, so of coarse, all information will be GREATLY
appreciated.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

I just found out that I have a COM viewer included with VC++.

It can also be downloaded here
http://www.microsoft.com/com/resources/oleview.asp

It doesn't seem to have any documentation for the objects, but at
least it tells you what's there.

See
http://download.microsoft.com/download/ole/ole2v/3.5/W351/EN-US/Ole2v.exe

I'd like to know how to access and read Outlook Address Book
using qoleobject and qolecontainer from my little program.
I've tried with:

$apptype console
DIM Object AS QOLEOBJECT
Dim ot As QOLEOBJECT
Dim mapi As QOLEOBJECT
Dim x As QOLEOBJECT

Print "outlook..."
Print Object.Create("Outlook.Application")
Print Object.getIDOfName("GetNameSpace")
Sleep 2
Print "invoke"
Print Object.invoke("GetNameSpace","MAPI",mapi)
Print mapi.getIDOfName("AddressLists.Count")

Print "NameSpace..."
Print mapi.Invoke("AddressLists.Count")

SLEEP 5
Print "Stop"
Input asfdsadf
End

I'll like any suggestion. Thanks

Hi,

I use the code and of course, it works. (Thanks for the tip).

Now im trying to change one variable of the Flash Movie.
Taking an example from JavaScript i can do it.
Works a little strange, because it behavior different of the
original JS idea.
Now i want to know how could i know whats thinks can be done in a
similar way, im talking about getting acceso to the 'object'
properties, actions,etc. Just like "SetVariable'.

The NEW code is:

CREATE Form AS QFORM
Caption = "Swf"
Center
Visible = 1
CREATE swf AS QOLECONTAINER
CreateObject("ShockwaveFlash.ShockwaveFlash.5")
movie= "c:\windows\escritorio\p1.swf"
setvariable ("t","texto")
height =200
width = 200
END CREATE
Visible = 0
END CREATE

Form.ShowModal

swf.Free

You need to have an edit in the Flash Movie with a variable
named 'texto' (dynamic).

Hi,

For the Object "Explorer" you have these

PROPRETIES
----------
help
attach
busy
fullname
locationname
locationurl
name
offline
path
readystate
registerasbrowser
registerasdroptarget
silent
theatermode
toplevelcontainer
type
wherelc

METHODS
-------
Exec
GoBack
GoForward
GoHome
GoHome
Navigate
QueryStatusWB
Refresh

CREATE msHTML AS QOLECONTAINER
Align = 5
createObject("Shell.Explorer.1")
END CREATE

This Works
----------
msHTML.LocationURL returns the ... LocationURL
msHTML.Refresh Refreshes the viewed page
msHTML.Navigate ("www.google.com") view google page

It's posible too to INVOKE
msHTML.Invoke ("locationURL") ' never tried ???

I've never been able to use Exec to SaveThe File
------------------------------------------------
msHTML.Exec 4, 2, "c:\\Tampon\\RQGoogle.Htm", 0 ' or msHTML.ExecWB ...

Nor CUT AND PASTE
msHtml.Invoke ("ExecCommand", 17, 0, 0, 0) ' 17 = CUT
msHtml.Invoke ("ExecCommand", 12, 0, 0, 0) ' 12 = paste

You MUST find a documentation on the ShockWavaFlash !

-------------------------------------------------------------------------

And BTW, I am calm :)

Jacques

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

You should be able to use QOleObject. See the docs for an example.
You should be able to call its properties and methods much like you
do in VB. However events I don't think are supported.

MSXML is a COM based dll. The only functions it exports mostly
relate to registering the dll.

--- In rapidq@y..., Leo Dicaprio <Nadesom@y...> wrote:
>
> Under VB, after msxml.dll is included in the project,
> i can use it by
> Dim xml As New MSXML.DOMDocument
> and:
> xml.Load ("test.xml")
>
> Any idea under RQ?
> I cann't found the DLL's Export Table using Quick
> View.

Thanks.

I should read Yu' Doc ch.15. COM Programming.

Here is a code.

Another question now is how can we use xml under linux
with RQ.

DIM Obj AS QOLEOBJECT

Obj.CreateObject("Microsoft.XMLDOM")
Obj.load("car.xml")

print Obj.xml

showmessage "ok"

----- Original Message -----
From: "petek1827" <petek1827@yahoo.com>
To: <rapidq@yahoogroups.com>
Sent: Monday, February 25, 2002 3:21 PM
Subject: [rapidq] Re: use msxml.dll under rapidq

> You should be able to use QOleObject. See the docs
for an example.
> You should be able to call its properties and
methods much like you
> do in VB. However events I don't think are
supported.
>

Great!

Also i foud, that its possible to use CreateObject, which working
much faster and warantied, that it will supported by remote server.

Guys, look at this short example:

$APPTYPE CGI
$INCLUDE "INCLUDES/CGI.INC"

DIM ADODB AS QOLEOBJECT
DIM ConnString AS STRING
DIM strSQL AS STRING

ADODB.CREATEOBJECT("ADODB.Connection")

ConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=db1.mdb;"
ADODB.Open ConnString

RSF = ADODB.EXECUTE("SELECT * FROM SiteAdmin")
' -----------------------------------------------------------
' Next part not working:
DO
RSF.MOVENEXT
RESPONSEWRITE "<a href='?option=someaction'>" & RSF("DDD") & "</a>"
LOOP WHILE NOT RSF.EOF

So, im getting conecction to database (any DSN or DSN-less), im
allowed to execute SQL Queryes, but how to use Recordsets here?

Is any ideas about it?

--- In rapidq@y..., "edamian919" <edamian919@y...> wrote:
> hello, yes there's one way, you have to use the odbc driver for
> msaccess,
> On the weekend i'll send you an example
>
> bye
> --- In rapidq@y..., "bol_spider" <bol_spider@y...> wrote:
> > Hello, people!
> >
> > IS ANY WAY to use MS Access MDB bases?

' Declaring Application type
$APPTYPE CGI
' Including Web.Objects
$INCLUDE "OBJ_HTTP.INC"
' Including Rapid-Q Constants
$INCLUDE "RAPIDQ.INC"

' This line will break execution if file requested not by browser
IF REQUEST.HTTP_USER_AGENT ="" THEN END

' If requested by browser, generate response
' with proper status code.
' for IE you can generate always "200 OK" status, because IE
' don't see any difference in response codes.
RESPONSE.STATUS "200 OK"
' Declaring content type
RESPONSE.CONTENTTYPE "text/html"
' Also you can add/declare DocType when you using XML, WML and etc...
' And now send this generated header.
' Without sending header u will get CGI Error
RESPONSE.SENDHEADER

DIM USERNAME AS STRING
DIM PASSWORD AS STRING
' Here we looking for some values posted from browser
USERNAME = HTTP.GETVALUE("username")
PASSWORD = HTTP.GETVALUE("password")

DIM BUF AS STRING
' Now loading some page, which contains "keywords"
' We using keyword on page for automate content management process
' In this case we will nee to design only one page, which will be
' as basement for whole web site.
BUF = FSO.FILETOBUFFER("templates/t_index.htm")
' So, page loaded to buffer and now we processing keywords
BUF = REPLACESUBSTR$(BUF,"{@footer}","Copyright © 2002")
' and now checking for user settings
' if we have a "guest", show him a login form, which also prepared
' as "template"
IF USERNAME="" AND PASSWORD ="" THEN
DIM LOGINFORMCONTENT AS STRING
LOGINFORMCONTENT = FSO.FILETOBUFFER
("templates/t_loginform.htm")
BUF = REPLACESUBSTR$(BUF,"{@header}","Please enter
your account details:")
BUF =
REPLACESUBSTR$(BUF,"{@menucontent}",LoginFormContent)
END IF
' Now we displaying generated HTML content to user and he will
' see it as normal web page.
RESPONSE.WRITE BUF
' Here small example of using "Response" object
RESPONSE.WRITE "<HR NOSHADE SIZE=1 COLOR=RED>"
RESPONSE.WRITE "REFERER: " & REQUEST.HTTP_REFERER & "<BR>"
RESPONSE.WRITE "PATH_TRANSLATED:" & REQUEST.PATH_TRANSLATED
& "<BR>"
RESPONSE.WRITE "REQUEST_METHOD: " & REQUEST.REQUEST_METHOD
& "<BR>"
RESPONSE.WRITE "QUERY_STRING: " & REQUEST.QUERY_STRING
& "<BR>"
RESPONSE.WRITE "DECODED STRING: " & HTTP.HTMLDECODE
(REQUEST.QUERY_STRING) & "<BR>"

Try VBS first to verify your COM installation:

DIM INETCONTROL
set INETCONTROL=wscript.CREATEOBJECT("InetCtlsObjects.Inet")

VBS has the best compatibility for MS COM. I ever found an object works fine with VBS but failed in PHP script. Maybe RQ also.

Guidance

Exception EOleSysError in module fsodemo.exe at 0007E571.
Invalid class string.

DIM INETCONTROL AS QOLEOBJECT
INETCONTROL.CREATEOBJECT("InetCtlsObjects.Inet")

compiling fine, but execution faulted. is any ideas why?

Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com


Appendix C: Operators

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Operators

Introduction to Operators

Operators perform mathematical or logical operations on values. They are usually encompassed by an expression. For example, 2 * 8 is a valid expression, and * is an operator operating on values 2 and 8. Rapid-Q can evaluate both INFIX and POSTFIX (RPN) expressions, but if you want to evaluate POSTFIX expressions, you'll need to note the special cases.

Arithmetic operators
Rapid-Q maintains a table of precedence for each operator. The highest precedence operator will always execute before any lower precedence operator. For operators that share the same precedence, the left to right associativity law holds. Expressions enclosed in braces (...) automatically have higher precedence than expressions outside the braces.
Operation Operator Precedence Description
String index [] 1 Returns a character from a string
ie. s$[2]
returns the second character in string s$
Exponentiation ^ 1 Calculates power of a number
ie. 2^6
is 2 to the power of 6
Negation - 1 Negates a number
ie. -99
is negative 99
Multiplication * 2 Multiplies 2 numbers
ie. 2*6
is 2 multiplied by 6
Floating-point Division / 2 Divides 2 floating point numbers
ie. 6.5/2.6
is 6.5 divided by 2.6
Integer Division \ 2 Divides 2 integer numbers
Before integer division is performed, operands are rounded to integers. The result is truncated to an integer value.
ie. 6\2
is 6 divided by 2
Left Bit Shift SHL 2 Shifts bits left by amount specified
ie. 10 SHL 2
is number 10 whose bits are shifted 2 bits to the left
Right Bit Shift SHR 2 Shifts bits right by amount specified
ie. 10 SHR 2
is number 10 whose bits are shifted 2 bits to the right
Modulus/Remainder MOD 3 Returns the remainder of the division
ie. 15 MOD 10
is 15/10 whose remainder is 5
Inverse Modulus INV 3 Returns the inverse of a number in modulus
ie. 3 INV 26
The inverse of 3 is 9 in 1 (MOD 26)
Addition + 4 Add 2 operands (strings included)
ie. 3+6
is 3 plus 6 = 9
ie. "hi"+"world"
is "world" appended to "hi" = "hiworld"
Addition & 4 Same as using '+' but maintained for compatibility with other BASIC languages, such as VB.
Subtraction - 4 Subtracts 2 operands (strings included)
ie. 6-3
is 6 minus 3 = 3
ie. "jello"-"l"
is "jello" minus all occurrences of "l" = "jeo"

Relational operators
Relational operators are used to compare 2 values. The result of this comparison is either "true" (nonzero) or "false" (zero). You may assume that "true" equals -1.
Relation Operator Precedence Description
Equality = 5 Tests for equality between 2 operands (strings included)
ie. 2=2
if 2 equals 2 then "true" else "false"
Inequality <> 5 Tests for inequality between 2 operands (strings included)
ie. "hello"<>"world"
if "hello" is not equal to "world" then "true" else "false"
Less than < 5 Tests if operand is less than another (strings included)
ie. 2<10
if 2 is less than 10 then "true" else "false"
Greater than > 5 Tests if operand is greater than another (strings included)
ie. "z">"a"
if "z" is greater than "a" then "true" else "false"
Less than or equal <= 5 Tests if operand is less than or equal to another (strings included)
ie. 2<=10
if 2 is less than or equal to 10 then "true" else "false"
Greater than or equal >= 5 Tests if operand is greater than or equal to another (strings included)
ie. 20>=10
if 20 is greater than or equal to 10 then "true" else "false"

Logical operators
Logical operators perform tests on multiple relations, bit manipulation, or Boolean operations and return a true (nonzero) or false (zero) value to be used in making a decision.
Operation Operator Precedence Description
Logical complement NOT 6 Returns the complement (inverted bits)
ie. NOT -1
-1 has all bits set, NOT -1 inverts all bits
Conjunction AND 7 Compare corresponding bits in 2 operands and sets the corresponding bit in the result to 1 if both bits are 1.
ie. 5 AND 3
5 AND 3 = 1 since their first bits are set
Disjunction (inclusive "or") OR 8 Compares corresponding bits in 2 operands and sets bit to 1 if either one has a corresponding bit set.
ie. 5 OR 3
5 OR 3 = 7 since bits overlap
Exclusive "or" XOR 9 Compares corresponding bits in 2 operands and sets bit to 1 if only one of the operands has a corresponding bit set.
ie. 5 XOR 3
5 XOR 3 = 6 since one bit overlaps

INFIX/POSTFIX notation
Expressions, in most languages, are expressed in INFIX notation. Rapid-Q prefers INFIX notation, but can also handle POSTFIX notation with a few special cases.
      Example INFIX expression:
          A = 4 * 7 + (4 - 1)^6
INFIX notation is easier to use and understand than POSTFIX notation. In fact, Rapid-Q's POSTFIX notation is a simple side effect, and was not intentional. Please avoid using POSTFIX if possible.
      Example POSTFIX expression:
          A = (4) (7) (*) (4) (1) (-) (6) (^) (+)
The 2 expressions should evaluate to 757. As you'll note, when dealing with POSTFIX notation, make sure all operands and operators are enclosed in braces. When dealing with negation, you'll have to do this instead:
      Example POSTFIX expression w/negation:
          A = (5) (0-5) (-)
Notice that (0-5) and (-5) return different results.


Appendix C: Other Detailed Keywords

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix C: Other Detailed Keywords

Other Detailed Keywords

Most of these have the same functionality as QBasic, so you could just as easily look them up there. Again, when I refer to Unix, I mean Linux & Unix.

ABS MATH Function Windows/Unix
A math function that returns the absolute value of a numeric expression.

Syntax: ABS(numeric-expression)
A% = ABS(-123)

Details:
The absolute value of function returns the unsigned magnitude of its argument. So, ABS(-1) and ABS(1) are both 1.

ACOS MATH Function Windows/Unix
A math function that returns the arccosine of a numeric expression.

Syntax: ACOS(numeric-expression)
D# = ACOS(0.55)

Details:
Numeric-expression is in the range -1 to 1.

ASC STRING Function Windows/Unix
A string processing function that returns a numeric value that is the ASCII code for the first character in a string expression.

Syntax: ASC(string-expression)
A% = ASC("A")

ASIN MATH Function Windows/Unix
A math function that returns the arcsine of a numeric expression.

Syntax: ASIN(numeric-expression)
D# = ASIN(0.55)

Details:
Numeric-expression is in the range -1 to 1.

ATN/ATAN MATH Function Windows/Unix
A math function that returns the arctangent of a numeric expression.

Syntax: ATN(numeric-expression)
D# = ATN(0.9)

Details:
Numeric-expression is the angle expressed in radians.

BIN$ CONVERSION Function Windows/Unix
A binary conversion function which will convert any positive INTEGER number to its binary representation.

Syntax: BIN$(numeric-expression)
S$ = BIN$(123)

Details:
Negative numbers are not supported, and so results are not defined.

BIND POINTER Function Windows/Unix
BIND will bind a variable as a function pointer.

Syntax: BIND variable TO function
DECLARE SUB MyFunc(X AS INTEGER)
BIND A% TO MyFunc

Details:
To invoke this function pointer, use CALLFUNC.

CALLBACK/CODEPTR ADDRESS Function Windows
CODEPTR (or CALLBACK) will return the absolute address of a SUB or FUNCTION.

Syntax: CODEPTR(MySUB)
SUB MySUB
END SUB
A& = CODEPTR(MySUB)

Details:
Use this function for CALLBACK routines. Not all cases are implemented, results may vary depending on the CALLBACK and the type of parameters it receives.

CALLFUNC POINTER Function Windows/Unix
CALLFUNC will execute the function pointer that was bound by using BIND.

Syntax: CALLFUNC(fptr, param1, param2, ...)
CALLFUNC(FPtr, 10, 20)
PRINT CALLFUNC(FPtr2, 10, 20)

sub procedure1
' Do things...
end sub
function procedure2 as long
procedure2 = 451
end function

dim lres as long
dim fnptr1 as integer
dim fnptr2 as integer
bind fnptr1 to procedure1
bind fnptr2 to procedure2
callfunc fnptr1 'This works
callfunc fnptr2 'This also works
'lres=callfunc(fnptr2) 'This doesn't work. Compiler error
'lres=callfunc fnptr2 'This doesn't work. Compiler error
lres=(callfunc(fnptr2)) 'This WORKS!!!
print "lres=" ,lres

Details:
Depending on how you BIND your function pointer, you can either call CALLFUNC as a statement or a function. Make sure to supply the necessary number of parameters, else you will receive a compile error. Passing function pointers as parameters is not yet implemented, but you can read up on Chapter 11 to see how to emulate this.

CEIL MATH Function Windows/Unix
A math function that rounds a numeric expression up toward positive infinity.

Syntax: CEIL(numeric-expression)
A% = CEIL(66.2) '-- Returns 67

CHDIR SYSTEM Statement Windows/Unix
CHDIR will change the current working directory for your application.

Syntax: CHDIR string-expression
CHDIR "c:\windows"

CHDIR translates a pathname into the OEM-defined (DOS) character set .
So for national codpages you need use next function
'-------------------------------------------------------------------'
function CHDirOEM (PathDst$) as short
result=0
dim PathDst1$ as string
PathDst1$=string$(len(PathDst$),"a")
chartooem PathDst$,PathDst1$
CHDIR PathDst1$
result=1
end function
'-------------------------------------------------------------------'

CHR$ STRING Function Windows/Unix
A string processing function that returns a one-character string whose ASCII code is the argument.

Syntax: CHR$(numeric-expression)
A$ = CHR$(66)

Details:
Numeric-expression should be in the range 0-255.

CINT CONVERSION Function Windows/Unix
A conversion function that converts a numeric expression to an integer by rounding the fractional part of the expression.

Syntax: CINT(numeric-expression)
A% = CINT(66.7)

Details:
Implemented for compatibility with QBasic, you can use the more logical function, ROUND, instead.

CLNG CONVERSION Function Windows/Unix
A conversion function that converts a numeric expression to an integer by rounding the fractional part of the expression.

Syntax: CLNG(numeric-expression)
A% = CLNG(66.7) '-- equals 67

Details:
Implemented for compatibility with QBasic, you can use the more logical function, ROUND, instead.

CONST Statement Windows/Unix
A non-executable statement that declares symbolic constants to use in place of numeric or string values.

Syntax: CONST constantname [ as Datatype ]= expression
CONST False = 0
CONST True AS LONG = NOT False
CONST A$ = "Hi world!"
CONST Char = CHR$(66)
CONST Combine = A$ + Char

Details:
Expression can be any value, numeric or string. Rapid-Q will decipher what the constant value will be bound to (ie. a string or a numeric variable) if the constantname is not followed by a type-declaration character (%. &, !, #, $, etc...).

CONVBASE$ CONVERSION Function Windows/Unix
A conversion function which takes the string expression represented in a specified base to be converted to another specified base determined by the arguments passed.

Syntax: CONVBASE$(string-expression, frombase, tobase)
S$ = CONVBASE$("FFD", 16, 2) '-- Convert from base 16 to 2
S$ = CONVBASE$("287", 10, 16) '-- Convert from base 10 to 16

Details:
Negative numbers are not supported.

COS MATH Function Windows/Unix
A math function that returns the cosine of an angle given in radians.

Syntax: COS(numeric-expression)
PI = 3.14153
C# = COS(PI)

Details:
Numeric-expression is the angle expressed in radians.

DATA Statement Windows/Unix
A non-executable statement that stores the numeric and string constants used by a program's READ statements.

Syntax: DATA {constant|EXECUTE(...)}[,...]
DATA my dog ate my homework, "oh, boy!", 34.4
DATA EXECUTE(LEFT$("Hello", 2, 3))

Details:
Constant is any valid numeric or string constant. If a string constant contains commas, colons, or leading or trailing spaces you want to preserve in your program, you must enclose the string in double quotes. You can also execute code by using the EXECUTE keyword. The return value of this executed code will be the value returned to your READ statement.

DATE$ SYSTEM Function Windows/Unix
A function that returns a string containing the current date formatted as MM-DD-YYYY. Where MM = month (1-12), DD = day (1-31) and YY = year (1980-2099)

Syntax: DATE$
PRINT DATE$

Details:
Unlike QBasic where you can set the current date using the DATE$ statement, you cannot do this under Rapid-Q.

DEC Statement Windows/Unix
Decrements numeric variable by one, or by the amount specified.

Syntax: DEC(variable [, amount])
DEC(I)
DEC(I, 10)

DEF... Statement Windows/Unix
DEFBYTE, DEFDBL, DEFDWORD, DEFINT, DEFLNG, DEFSHORT, DEFSNG, DEFSTR, DEFWORD are declaration statements that name one or more variables and allocates storage space for them.

Syntax: DEFINT variable[(subscripts)] [, ...]
DEFSTR A, B, C="Hello", D, E
DEFINT I=99, J(100,10), K

Details:
You cannot specify a range of variables, for example: DEFINT A-Z works fine under QBasic, but not Rapid-Q. You can initialize each variable as demonstrated above. DEF... statements are equivalent to calling DIM, but can save you a lot of typing. To initialize an array, wrap the values around curly braces {...}. For Example,
DEFINT A(1 TO 10) = {1,2,3,4,5,6,7,8,9,10}
Initializes elements 1 through 10 with the values 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 respectively.

DELETE$ STRING Function Windows/Unix
A function that deletes part of a string.

Syntax: DELETE$(string-expression, start, length)
A$ = DELETE$("Hello world", 2, 3) '-- Result: Ho world

DIM Statement Windows/Unix
Declaration statement that names one or more variables and allocates storage space for them.

Syntax: DIM variable[(subscripts)] AS type
DIM A AS INTEGER, B(2,5,3,9,2) AS INTEGER
DIM S AS STRING
DIM Form AS QFORM
Dim arg!(10) as single
Dim dateTime(1 To 9) as integer

Also you can

DefSng arg!(10) ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
DefSng dateTime(1 To 9) = { 1, 2, 3, 4, 5, 6, 7, 8, 9}

See also Variables and Assignments

Details:
Use the optional (subscripts) to declare the size of arrays, up to 5 dimensions.

DIR$ SYSTEM Function Windows
A system function used to obtain the first/next file corresponding to a specified filespec.

Syntax: DIR$[(file-spec, attribute)]
FileName$ = DIR$("*.*", 0) '-- Get first file
FileName$ = DIR$ '-- Get next file

fn$="C:\BAS\RAPIDQ old\WSC4VB22.ZIP"
FileName$ = DIR$(fn$, 0) ' not to quote a filename containing spaces

Details:
File-spec specifies a filename or path (which can include wildcards characters). Calling DIR$ with no parameters return additional filename matches. If no matches exist (or all matches have been exhausted), DIR$ returns an empty string. DIR$ returns all regular files as well as any special files specified in the attribute parameter.

Here are some valid file attributes, you can combine
them by using OR (ie. faReadOnly OR faDirectory)

&H1 = faReadOnly       &H8 = faVolumeID ' not working
&H2 = faHidden        &H10 = faDirectory
&H4 = faSysFile       &H20 = faArchive
                      &H3F = faAnyFile
To obtain additional information on the currently matched file, use the FileRec properties.
FileRec.FileName    - Returns Windows long file name
FileRec.ShortName   - Returns the short file name
FileRec.Date        - Returns the file date as a string
FileRec.Time        - Returns the file time as a string
FileRec.Size        - Returns the file size
FileRec.FileTime    - Returns the file time as an integer
You can use FileRec.FileTime to compare file times. So a newer file will have a FileTime greater than an older file.

DIREXISTS SYSTEM Function Windows
A function that returns 0 if directory does not exist, non-zero otherwise.

Syntax: DIREXISTS(string-expression)
A = DIREXISTS("c:\windows") or A = DIREXISTS("c:\windows\")

DOEVENTS RAPID-Q Specific Windows
Returns control to the operating system to process the events in its queue, and returns back control to the program once done.

Syntax: DOEVENTS
DO
DOEVENTS
LOOP

Details:
DoEvents should normally be used for long-running processes (ie. long loops or anything else that eats up the CPU), so that the user can abort the process if necessary. DoEvents can also be used to handle multiple forms.

END Statement Windows/Unix
Terminates your program.

Syntax: END
END

Details:
Call END to terminate your application, but if there are any Windows still opened, you should close them first.

ENVIRON SYSTEM Statement Windows/Unix
A statement used to set or modify an environment variable.

Syntax: ENVIRON string-expression
ENVIRON "PATH=c:\windows"
ENVIRON "TEST what"

Details:
String-expression must have the form
parametername=text
or
parametername text
Everything to the left of the equal sign or space is assumed to be a parameter, and everything to the right, text. If the parametername has not previously existed in the environment string table, it is appended to the end of the table. If a pametername already exists, it gets deleted and the new parametername is appended to the end of the table.

ENVIRON$ SYSTEM Function Windows/Unix
A function that returns an environment string.

Syntax: ENVIRON$(environment-string)
A$ = ENVIRON$("PATH")

Details:
It is not possible, at this time, to retrieve an environment string by its index.

EXP MATH Function Windows/Unix
A math function that returns the exponential function (e raised to the power of n).

Syntax: EXP(numeric-expression)
A# = EXP(1)

EXTRACTRESOURCE RESOURCE Statement Windows/Unix
A statement that extracts a resource, from the current program, to a file.

Syntax: EXTRACTRESOURCE resource-value, filename
EXTRACTRESOURCE Resource(0), "test.bmp"

Details:
The resource-value is the absolute position of the resource within the current program. To find the absolute position of the resource, see also RESOURCE(), and RESOURCECOUNT.

FIELD$ STRING Function Windows/Unix
A function that returns a field (or token) separated by deliminators.

Syntax: FIELD$(Source-string, deliminator-string, field-number)
A$ = FIELD$("John&Doe&555-1234", "&", 2) '-- Returns Doe
A$ = FIELD$("John&&Doe&&555-1234", "&&", 3) '-- Returns 555-1234

FILEEXISTS SYSTEM Function Windows/Unix
A function that returns 0 if file does not exist, non-zero otherwise. The current working directory is searched for the file if no path is specified.
Not to quote a filename containing spaces
 Syntax: FILEEXISTS(string-expression)
A = FILEEXISTS("rapidq.exe")
FIX MATH Function Windows/Unix
A function that removes the fractional part of a number.

Syntax: FIX(numeric-expression)
A% = FIX(342.97)

FLOOR MATH Function Windows/Unix
A math function that rounds a numeric expression down toward negative infinity.

Syntax: FLOOR(numeric-expression)
A% = FLOOR(66.7) '-- Returns 66

FORMAT$ STRING Function Windows/Unix
A function that returns a formatted string assembled from a Pascal style format string and a series of arguments. The Pascal style format string closely resembles C style format strings, but definitely not VB compatible.

Syntax: FORMAT$(Format-string, arg1, arg2, ...)
A$ = FORMAT$("Location: %s %4d %-10.4g", "Any", 1234, 55.39) '-- Returns Location: Any 1234 55.39
Details:
Format strings passed to the string formatting routines contain two types of objects--plain characters and format specifiers. Plain characters are copied verbatim to the resulting string. Format specifiers fetch arguments from the argument list and apply formatting to them. Format specifiers have the following form:
"%" [index ":"] ["-"] [width] ["." prec] type
A format specifier begins with a % character. After the % come the following, in this order:
An optional argument index specifier, [index ":"]
An optional left justification indicator, ["-"]
An optional width specifier, [width]
An optional precision specifier, ["." prec]
The conversion type character, type
The following table summarizes the possible values for type:
d | Decimal. The argument should be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.
e | Scientific. The argument should be a floating-point value. The value is converted to a string of the form "-d.ddd...E+ddd". The resulting string starts with a minus sign if the number is negative. One digit always precedes the decimal point. The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string--a default precision of 15 is assumed if no precision specifier is present. The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.
f | Fixed. The argument should be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative. The number of digits after the decimal point is given by the precision specifier in the format string--a default of 2 decimal digits is assumed if no precision specifier is present.
g | General. The argument should be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string--a default precision of 15 is assumed if no precision specifier is present. Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses fixed point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.
n | Number. The argument should be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The "n" format corresponds to the "f" format, except that the resulting string contains thousand separators.
m | Money. The argument should be a floating-point value. The value is converted to a string that represents a currency amount.
s | String. The argument must be a string. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.
x | Hexadecimal. The argument should be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.

Conversion characters may be specified in uppercase as well as in lowercase--both produce the same results.
An index specifier sets the current argument list index to the specified value. The index of the first argument in the argument list is 0. Using index specifiers, it is possible to format the same argument multiple times. For example Format$("%d %d %0:d %d", 10, 20) produces the string "10 20 10 20".

FRAC MATH Function Windows/Unix
A function that returns the fractional part of a number.

Syntax: FRAC(numeric-expression)
A# = FRAC(342.97)

HEX$ CONVERSION Function Windows/Unix
A function that returns the hexidecimal (base 16) representation of the (base 10) numeric expression.

Syntax: HEX$(numeric-expression)
A$ = HEX$(123)

Details:
Negative numbers are supported. In the Windows version, the string is pre-padded with 0's to fit the string length of 8.

IIF Function Windows/Unix
The immediate IF function returns one of two parts depending on the evaluation of an expression. Notice that both parts are evaluated, whether the expression returned true or false, so watch for undesirable side effects.

Syntax: IIF(expression, true-expr, false-expr)
A$ = IIF(6 > 5, "TRUE", "FALSE") '-- returns TRUE

INC Statement Windows/Unix
Increments numeric variable by one, or by the amount specified.

Syntax: INC(variable [, amount])
INC(I)
INC(I, 10)

INITARRAY ARRAY Statement Windows/Unix
Initializes an array with the corresponding values.

Syntax: INITARRAY(Array, value [, ...])
DIM A(1 TO 100) AS INTEGER
INITARRAY(A, 55, 234, 45, 99)

Details:
Equivalently:
DEFINT A(1 TO 100) = {55, 234, 45, 99}

Initializing arrays as opposed to looping through each one saves a bit of time.

INP I/O Function Windows/Unix
A device I/O function that returns the byte value read from an I/O port.

Syntax: INP(port)
A% = INP(&H3C9)

Details:
Port is any word value between 0 and 65535. Return value is in the range 0 to 255.

INPW I/O Function Windows/Unix
A device I/O function that returns the word value read from an I/O port.

Syntax: INPW(port)
A = INPW(&H3C9)

Details:
Port is any word value between 0 and 65535. Return value is also in the range 0 to 65535.

INSERT$ STRING Function Windows/Unix
A function that returns a string with an inserted substring beginning at a specified index.

Syntax: INSERT$(insert-string, source-string, index-number)
A$ = INSERT$("hi", "Hello", 3) '-- returns Hehillo

INSTR STRING Function Windows/Unix
A function that compares 2 strings and returns the position of the find-string with respect to the search-string. If found, INSTR returns the index position of the find-string, 0 otherwise.

Syntax: INSTR([start,] search-string, find-string)
A% = INSTR("Hello", "ll") '-- returns 3
A% = INSTR(4, "hehe they", "he") '-- returns 7

INT MATH Function Windows/Unix
A function that returns the largest integer less than or equal to a numeric-expression. Fractional part is truncated.

Syntax: INT(numeric-expression)
A& = INT(342.97)

KILL SYSTEM Statement Windows/Unix
A statement that removes a disk file.

Syntax: KILL filespec
KILL "mydocuments.txt"
KILL "c:\path with spaces \mydocuments.txt" ' quotes not needed
KILL "*.c" - not working with wildcard

Use
sub KillFiles (FileName$)
'Kill files in FileName$
' for example KillFiles "C:\BAS\RAPIDQ\tmp\*.tmp"

FName$ = DIR$(FileName$, 0) '-- Get first file
while FName$ <>""
kill FName$
if fileexists (FName$)>0 then print "Can't kill file "+FName$
FName$ = DIR$ '-- Get next file
wend
end sub

KILLMESSAGE RAPID-Q Specific Windows
A statement that removes a message from the queue.

Syntax: KILLMESSAGE hWnd, Message
KILLMESSAGE form.handle, WM_CHAR

Details:
Ideally, KillMessage should be used inside an event, such as OnKeyDown, to remove any messages you don't want processed further.

LBOUND ARRAY Function Windows/Unix
A function that returns the lower bound of the array.

Syntax: LBOUND(arrayname [,dimension])
DIM A(-50 TO 100) AS INTEGER
L% = LBOUND(A) '-- Returns -50

Details:
If the array has multiple dimensions, you can use the optional dimension argument to check the lower bound of each one.

LCASE$ STRING Function Windows/Unix
A string function that returns a string expression with all letters lower-case.

Syntax: LCASE$(string-expression)
A$ = LCASE$("HELLO") '-- returns hello

LEFT$ STRING Function Windows/Unix
A string function that returns a string consisting of the leftmost n characters of a string.

Syntax: LEFT$(string-expression, n)
A$ = LEFT$("Hello",2) '-- returns he

LEN STRING Function Windows/Unix
A function that returns the number of characters in a string.

Syntax: LEN(string-expression)
A% = LEN("HELLO") '-- returns 5

Details:
LEN will not return the number of bytes required by a variable. This option is available under QBasic.

LFLUSH PRINTER Statement Windows
A statement used to begin a print job.

Syntax: LFLUSH
LPRINT "print this line"
LFLUSH '-- call this to start printing

Details:
You should call LFLUSH after you're satisfied that you want to start printing. If you don't call LFLUSH, then whenever your application terminates is when your document will start its print job.

LIBRARYINST DLL Function Windows
Returns the handle to the DLL module. If the DLL hasn't been loaded yet or is not found, this function returns 0.

Syntax: LIBRARYINST(DLLName)
DECLARE FUNCTION UpdateWindow LIB "USER32" ALIAS _
"UpdateWindow" (hWnd AS LONG) AS LONG
UpdateWindow(0) '-- Using function will load DLL
hInst& = LIBRARYINST("USER32")

Details:
Declaring a function as a DLL function does not automatically load the DLL. The DLL is loaded once the function is used. Please note that library names should match, so in your declaration for LIB "USER32" ... to find this library, you must match that same name. ie. LIBRARYINST("USER32.DLL") returns 0, it must be "USER32" in this particular case. See also UNLOADLIBRARY.

LOG MATH Function Windows/Unix
A math function that returns the natural logarithm of a numeric expression.

Syntax: LOG(numeric-expression)
A# = LOG(10)

LPRINT PRINTER Statement Windows
A statement just like PRINT except all output is directed to the default printer. Make sure to call LFLUSH to start the print job.

Syntax: LPRINT [expressions][{;|,}][...]
LPRINT "print this line"
LFLUSH

Details:
You should call LFLUSH after you're satisfied that you want to start printing. If you don't call LFLUSH, then whenever your application terminates is when your document will start its print job.

LTRIM$ STRING Function Windows/Unix
A string function that returns a string with leading spaces removed.

Syntax: LTRIM$(string-expression)
A$ = LTRIM$(" Hello") '-- returns Hello

MEMCMP MEMORY Function Windows/Unix
A memory function that compares 2 memory addresses and returns 0 if the memory contents do not match, or non-zero otherwise.

Syntax: MEMCMP(ptr1, ptr2, count)
DEFINT I=10, J=10
A% = MEMCMP(VARPTR(I), VARPTR(J), SIZEOF(INTEGER))

MEMCPY MEMORY Function Windows/Unix
A memory function that copies n bytes of memory from source to destination.

Syntax: MEMCPY(destination, source, n)
DEFINT I=90, J=10
'-- After MEMCPY, I should equal 10
MEMCPY(VARPTR(I), VARPTR(J), SIZEOF(INTEGER))

MEMSET MEMORY Function Windows/Unix
A memory function that initializes a memory blocks.

Syntax: MEMSET(ptr, char, size)
DIM IntArray(1 TO 10) AS INTEGER
MEMSET(VARPTR(I(1)), 0, 10*SIZEOF(INTEGER))

MESSAGEBOX RAPID-Q Specific Windows
Displays a simple message box with prompts. This implements Window's MessageBox API function.

Syntax: MESSAGEBOX(message, title, flags%)
IF MessageBox("Close this form?", "Close", 1) = 1 THEN
'-- Close form
END IF

Details:
See Windows API Help file for valid flags.

' MessageBox() Flags
Public Const MB_OK = &H0&
Public Const MB_OKCANCEL = &H1&
Public Const MB_ABORTRETRYIGNORE = &H2&
Public Const MB_YESNOCANCEL = &H3&
Public Const MB_YESNO = &H4&
Public Const MB_RETRYCANCEL = &H5&

Public Const MB_ICONHAND = &H10&
Public Const MB_ICONQUESTION = &H20&
Public Const MB_ICONEXCLAMATION = &H30&
Public Const MB_ICONASTERISK = &H40&

Public Const MB_ICONINFORMATION = MB_ICONASTERISK
Public Const MB_ICONSTOP = MB_ICONHAND

Public Const MB_DEFBUTTON1 = &H0&
Public Const MB_DEFBUTTON2 = &H100&
Public Const MB_DEFBUTTON3 = &H200&

Public Const MB_APPLMODAL = &H0&
Public Const MB_SYSTEMMODAL = &H1000&
Public Const MB_TASKMODAL = &H2000&

Public Const MB_NOFOCUS = &H8000&
Public Const MB_SETFOREGROUND = &H10000
Public Const MB_DEFAULT_DESKTOP_ONLY = &H20000

Public Const MB_TYPEMASK = &HF&
Public Const MB_ICONMASK = &HF0&
Public Const MB_DEFMASK = &HF00&
Public Const MB_MODEMASK = &H3000&
Public Const MB_MISCMASK = &HC000&

Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
(ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

· hWnd
Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
· lpText
Points to a null-terminated string containing the message to be displayed.
· lpCaption
Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.
· uType
Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.

Specify one of the following flags to indicate the buttons contained in the message box:
MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK The message box contains one push button: OK. This is the default.
MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
MB_YESNO The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.

Specify one of the following flags to display an icon in the message box:
MB_ICONEXCLAMATION, MB_ICONWARNING
An exclamation-point icon appears in the message box.

MB_ICONINFORMATION, MB_ICONASTERISK
An icon consisting of a lowercase letter i in a circle appears in the message box.
MB_ICONQUESTION A question-mark icon appears in the message box.
MB_ICONSTOP,
MB_ICONERROR,
MB_ICONHAND
A stop-sign icon appears in the message box.

Specify one of the following flags to indicate the default button:
MB_DEFBUTTON1 The first button is the default button.
MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 The second button is the default button.
MB_DEFBUTTON3 The third button is the default button.
MB_DEFBUTTON4 The fourth button is the default button.

Specify one of the following flags to indicate the modality of the dialog box:
MB_APPLMODAL
The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows.
Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.
MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL
Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
MB_TASKMODAL
Same as MB_APPLMODAL except that all the top-level windows belonging to the current task are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the current application without suspending other applications.

In addition, you can specify the following flags:
MB_DEFAULT_DESKTOP_ONLY
The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.
MB_HELP
Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.
MB_RIGHT
The text is right-justified.
MB_RTLREADING
Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
MB_SETFOREGROUND
The message box becomes the foreground window. Internally, Windows calls the SetForegroundWindow function for the message box.
MB_TOPMOST
The message box is created with the WS_EX_TOPMOST window style.
MB_SERVICE_NOTIFICATION
Windows NT only: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.
For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.
To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices. 1. At link-time, specify a version number less than 4.0; or
2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION.
MB_SERVICE_NOTIFICATION_NT3X
Windows NT only: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.

MESSAGEDLG RAPID-Q Specific Windows
Displays a message box with an icon and a user defined caption. This implements Window's MessageBoxEx API function.

Syntax: MESSAGEDLG(string-expression, msgType, msgButtons, helpContext)
IF MessageDlg("Close this form?", mtWarning, mbYes OR mbNo, 0) = mrNo THEN
'-- Don't close form
END IF

Details:
msgType is used to display the type of icon that will be displayed in your message box.
0 = mtWarning      3 = mtConfirmation
1 = mtError        4 = mtCustom
2 = mtInformation
msgButtons is used to display custom dialog buttons. To display more than one message button, just OR them.
1 = mbYes       32 = mbAbort
2 = mbNo        64 = mbRetry
4 = mbOK       128 = mbIgnore
8 = mbCancel   256 = mbAll
16 = mbHelp
helpContext is ignored for now.

MID$ STRING Function Windows/Unix
A string function that returns a substring with n chracters starting from i of string-expression.

Syntax: MID$(string-expression, i, n)
A$ = MID$("Hello",3,2) '-- returns ll

Details:
You cannot use MID$ in this way:
MID$(A$, 1, 1) = "G"
Under QBasic, this valid statement replaces the first character from A$ with "G". To acheive the same effect under Rapid-Q, please use the REPLACE$ string function.

MKDIR SYSTEM Statement Windows/Unix
A statement that creates a new directory.

Syntax: MKDIR pathspec
MKDIR "abc"
mkdir "C:\BAS\RAPIDQ\help2\1234" - without last slash
or
mkdir "C:\BAS\RAPIDQ\help2\1234\" - with last slash
All variants are working
Details:
MKDIR will not rewrite a directory if one already exists.
If no path is specified, the directory is created in the current working directory.

In $APPTYPE console mode MKDIR translates a pathname character set using OEMtoChar.
So, for national codpages you need use next function

'--------------------------- Custom functions --------------------------
Declare Function CharToOem Lib "user32" Alias "CharToOemA" _
(ByVal lpszSrc As String, ByVal lpszDst As String) as Long

Declare Function OemToChar Lib "user32" Alias "OemToCharA" _
(ByVal lpszSrc As String, ByVal lpszDst As String) As Long

'-------------------------------------------------------------------'
function MkDirOEM (PathDst$) as short
result=0
dim PathDst1$ as string
PathDst1$=string$(len(PathDst$),"a")
chartooem PathDst$,PathDst1$
MkDIR PathDst1$
result=1
end function
'-------------------------------------------------------------------'

OUT I/O Statement Windows/Unix
A device I/O statement that sends a byte value to a machine I/O port.

Syntax: OUT port, value
OUT &H3C9, 128

Details:
  • Port is any word value between 0 and 65535.
  • Value is any byte value between 0 and 255.

    OUTW I/O Statement Windows/Unix
    A device I/O statement that sends a word value to a machine I/O port.

    Syntax: OUTW port, value
    OUTW &H378, 128

    Details:
  • Port is any word value between 0 and 65535.
  • Value is any byte value between 0 and 65535.

    PLAYWAV RAPID-Q Specific Windows
    Plays a .WAV file or a .WAV resource.

    Syntax: PLAYWAV wavfilename|wavresource, sndOptions
    $RESOURCE Welcome_WAV AS "welcome.wav"
    PLAYWAV "welcome.wav", SND_ASYNC OR SND_LOOP
    PLAYWAV Welcome_WAV, SND_ASYNC OR SND_LOOP

    Details:
    sndOptions determine how the wav file is played back.
    0 = SND_SYNC     '-- waits for wav to finish
1 = SND_ASYNC    '-- background play
3 = SND_LOOP     '-- Loop wav once finished playing
    You can combine SYNC or ASYNC with LOOP by OR'ing them. If your WAV file is not finished playing when you close your application, you will receive an access violation. You can stop the .WAV by passing an empty string as a filename.

    POSTMESSAGE RAPID-Q Specific Windows
    A WinAPI call to PostMessage, does not block.

    Syntax: POSTMESSAGE hWnd, uMsg, wParam, lParam
    POSTMESSAGE Form.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0

    Details:
    PostMessage is a WinAPI call so instead of filling this entire page with information you can look up this function in your WinAPI manual/help file.

    QUICKSORT SORTING Statement Windows/Unix
    QUICKSORT, aptly named, can be used to sort your arrays of any type, except Objects/UDTs of course. It, obviously, uses the QuickSort algorithm to perform the sort.

    Syntax: QUICKSORT(Array-begin, Array-end, ASCEND|DESCEND)
    DIM A(1000) AS INTEGER
    '-- put stuff in A
    QUICKSORT(A(10), A(500), ASCEND) '-- sorts elements 10..500

    Details:
    The pivot element in the above example is A(10), so if you want randomness, you'll have to replace A(10) with some random element from A(10)..A(500) in the above example. You can also sort multi-dimensional arrays and "span sort" arrays.

    Span sorting:
               DIM A(1 TO 100) AS LONG
           DIM B(1 TO 100) AS LONG
           DIM C(1 TO 100) AS LONG

           '--- puts some values into array A, B, C
           RANDOMIZE TIMER
           FOR I = 1 TO 100
               A(I) = RND(50000)
               B(I) = RND(50000)
               C(I) = RND(50000)
           NEXT

           QUICKSORT A(1), C(100), ASCEND
           PRINT A(1)," ",B(1)," ",C(1)
    As long as you DIM the arrays "side by side" they will share a contiguous space of memory, this means you can sort from the start of memory address A(1) to the end of memory address C(100). This technique is not recommended, but if you can find a use for it, go ahead.

    RANDOMIZE MATH Statement Windows/Unix
    Initializes (reseeds) the random-number generator.

    Syntax: RANDOMIZE [numeric-expression]
    RANDOMIZE TIMER

    Details:
    If argument is omitted, randomize will default as RANDOMIZE TIMER.

    READ Statement Windows/Unix
    A statement that reads values from a DATA statement and assigns the values to variables.

    Syntax: READ variablelist
    READ A%, S$, P(1,2)

    Details:
    Variablelist is made up of one or more variables, separated by commas, which are to receive the data. The variables may be string or numeric.

    REDIM Statement Windows/Unix
    Declaration statement that changes the space allocated to an array that has already been declared by DIM, preserving as much of the data as possible.

    Syntax: REDIM variable[(subscripts)] AS type
    DIM B(20) AS INTEGER
    REDIM B(100) AS INTEGER

    Details:
    If the array has not yet been declared by DIM, REDIM will be equivalent to calling DIM (except when dealing with components, in which case you'll receive a compiler error). You cannot change the data type for the array, ie. you cannot redefine array B to be something other than an INTEGER (as in the above example). Combining arrays is a by-product of REDIM.
    DIM A(1 to 100) AS INTEGER
DIM B(1 to 100) AS INTEGER
REDIM A(1 to 200) AS INTEGER   '-- Combines A and B together
    What the above code does is preserve the data in A as well as combining the array B. so index from 101 to 200 is the data for B and 1 to 100 is the data for A. Clarification: Array B has not been modified, it still maintains its own address space and will not overwrite A's data and vice versa. Note that this by-product does not apply to redimming Fixed Strings, Variants and Components.
    Redim table
      DIM Button(1 TO 2, 1 TO 2) AS QBUTTON
REDIM Button(1 TO 2, 1 TO 4) AS QBUTTON
    Note that when dealing with multiple dimensions the elements are shifted to fill each column. So element (2,2) is actually moved to position (1,4).

    REM Comment Windows/Unix
    A BASIC declaration that allows explanatory remarks to be inserted in a program. It's suggested that you use ' to start your comments instead.

    Syntax: REM remark
    REM This is a comment, nothing is executed
    ' This is another comment

    a=5 rem fkfkl, - not working
    a=5 ' fkfkl, - working

    RENAME SYSTEM Statement Windows/Unix
    A statement that renames a file. If file already exists the operation is not executed.

    Syntax: RENAME file1, file2
    RENAME "abc.txt", "xyz.txt"

    REPLACE$ STRING Function Windows/Unix
    A function that replaces a portion of a string with another.

    Syntax: REPLACE$(source-string, replace-string, index)
    A$ = REPLACE$("Hello", "J", 1) '-- returns Jello

    A$ = REPLACE$("Hello", "Jwer", 1) '-- returns Jwero
    A$ = REPLACE$("Hello", "Jwer111111111111", 1) '-- returns Jwer111111111111

    REPLACESUBSTR$ STRING Function Windows/Unix
    A function that replaces a substring with another string. All occurrences will be replaced. The length of the replacement string does not need to match the length of the replaced string.

    Syntax: REPLACESUBSTR$(source-string, replace-string, replacement-string)
    A$ = REPLACESUBSTR$("abcdefgabcdefg", "abc", "99") '-- returns 99defg99defg

    RESOURCE RESOURCE Function Windows/Unix
    A function that returns the absolute position of the resource from the current program.

    Syntax: RESOURCE(numeric-expression)
    EXTRACTRESOURCE Resource(0), "test.bmp"

    Details:
    RESOURCE() is an array consisting of 0 to RESOURCECOUNT-1 elements. Element 0 corresponds to the first $RESOURCE handle you specify and so on. If numeric-expression is not in the range 0 to RESOURCECOUNT-1, this function returns 0.

    RESOURCECOUNT RESOURCE Function Windows/Unix
    A function that returns the number of resources in the current program.

    Syntax: RESOURCECOUNT
    A% = RESOURCECOUNT

    RESTORE Statement Windows/Unix
    A statement that allows DATA statements to be reread from a specified line.

    Syntax: RESTORE [{linelabel | linenumber}]
    RESTORE

    Details:
    If the argument is omitted, the next READ statement which executes will read the first item in the first DATA statement in the program. Linelabel or Linenumber identifies the DATA statement you want the next READ statement to use. The first item from that line will be read.

    REVERSE$ STRING Function Windows/Unix
    A function that reverses (or mirrors) a string.

    Syntax: REVERSE$(string-expression)
    A$ = REVERSE$("Hello") '-- returns olleH

    RGB CONVERSION Function Windows/Unix
    A conversion function that takes the red, green and blue parameters and combines them to form a BGR numeric representation.

    Syntax: RGB(redvalue, greenvalue, bluevalue)
    C = RGB(255, 0, 255)

    Details:
    Values range from 0-255. Values outside this range produce undefined results.

    RIGHT$ STRING Function Windows/Unix
    A function that returns the rightmost n characters of a string.

    Syntax: RIGHT$(string-expression, n)
    A$ = RIGHT$("Hello", 3) '-- returns llo

    32k limitation!

    RINSTR STRING Function Windows/Unix
    Reverse INSTR is a function that compares 2 strings and returns the position of the find-string with respect to the search-string. Instead of starting the search from left to right, like INSTR, RINSTR searches right to left (ie. the reverse of INSTR). If found, RINSTR returns the index position of the find-string, 0 otherwise.

    Syntax: RINSTR([start,] search-string, find-string)
    A% = RINSTR("Hello World", "l") '-- returns 10
    A% = RINSTR(4, "hehe they", "he") '-- returns 3
                    123 <-
                  ->1234

    A% = RINSTR(6, "he they", "he") '-- returns 5
                    12345 <-
                  ->123456

    RMDIR SYSTEM Statement Windows/Unix
    A statement that removes a directory.

    Syntax: RMDIR directory
    RMDIR "abc" "abc" is subdirectory name in the current directory.
    RMDIR "LastCopy\123" sub..subdirectory in the current directory.
    RMDIR "C:\W98\" full path

    RND MATH Function Windows/Unix
    A function that returns a random number whose sequence is generated by calling RANDOMIZE.

    Syntax: RND[(upper-bound)]
    A% = RND(10)

    Details:
    If no upper-bound is given, RND returns a decimal number in the range 0 to 1.

    ROUND MATH Function Windows/Unix
    A math function that converts a number to an integer by rounding the fractional part of the expression.

    Syntax: ROUND(numeric-expression)
    A% = ROUND(3.49) '-- Returns 3
    A% = ROUND(3.50) '-- Returns 4

    RTRIM$ STRING Function Windows/Unix
    A string function that returns a string with trailing spaces removed.

    Syntax: RTRIM$(string-expression)
    A$ = RTRIM$("Hello ") '-- returns Hello

    RUN SYSTEM Statement Windows/Unix
    A statement that executes a specified program without blocking.

    Syntax: RUN filespec
    RUN "rapidq.exe"

    SENDMESSAGE RAPID-Q Specific Windows
    A WinAPI call to SendMessage, blocks until message is processed.

    Syntax: SENDMESSAGE hWnd, uMsg, wParam, lParam
    SENDMESSAGE Form.Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0

    Details:
    SendMessage is a WinAPI call so instead of filling this entire page with information you can look up this function in your WinAPI manual/help file.

    SGN MATH Function Windows/Unix
    A math function that indicates the sign of a numeric expression.

    Syntax: SGN(numeric-expression)
    A% = SGN(-123) '-- Returns -1

    Details:
    If numeric-expression is positive, SGN returns +1.
    If numeric-expression is zero, SGN returns 0.
    If numeric-expression is negative, SGN returns -1.

    SHELL SYSTEM Statement/Function Windows
    SHELL can be called as a statement or as a function. It has the same functionality as RUN except that it blocks your application until the executed one has ended.

    Syntax: SHELL command
    SHELL "rapidq.exe"
    Syntax: SHELL(command, showCMD)
    PID = SHELL("rapidq.exe", SW_SHOWNORMAL)

    Details:
    If calling SHELL as a function, the return value is the process ID of the executed program, and will not block your program. showCMD can be any of the following:
    0 = SW_HIDE              6 = SW_MINIMIZE
1 = SW_SHOWNORMAL        7 = SW_SHOWMINNOACTIVE
2 = SW_SHOWMINIMIZED     8 = SW_SHOWNA
3 = SW_SHOWMAXIMIZED     9 = SW_RESTORE
4 = SW_SHOWNOACTIVATE   10 = SW_SHOWDEFAULT
5 = SW_SHOW

    Examples:
Shell "command.com /C copy /b one.txt+two.txt oneandtwo.txt"

x=Shell("Command.com /C echo y| del "+chr$(34) + ".\Original\*.*" +chr$(34) , 0)
    SHOWMESSAGE RAPID-Q Specific Windows/Unix
    A statement used to display a generic popup message box.

    Syntax: SHOWMESSAGE string-expression
    SHOWMESSAGE "Hello world!"

    SIN MATH Function Windows/Unix
    A math function that returns the sine of an angle given in radians.

    Syntax: SIN(numeric-expression)
    PI = 3.14153
    C# = SIN(PI)

    Details:
    Numeric-expression is the angle expressed in radians.

    SIZEOF MEMORY Function Windows/Unix
    A function that returns the size, in bytes, of a data type.

    Syntax: SIZEOF(datatype|variable)
    PRINT SIZEOF(MyUDT)
    PRINT SIZEOF(MyVar)
    PRINT SIZEOF(INTEGER)

    Details:
    To calculate the size of a UDT, you must first DIM it.
    ie. DIM MyUDT AS TMyUDT

    SOUND I/O Statement Windows
    A device I/O statement that generates sound through the PC Speaker.

    Syntax: SOUND frequency, duration
    SOUND 4000, 18

    Details:
  • Frequency is a numeric expression whose value is between 37 and 32,767. Frequency is measured in cycles/second, or hertz.
  • Duration is a numeric expression whose value is between 0 and 65,535. There are 18.2 clock ticks per second, so 18 is considered 1 second, etc...

    SPACE$ STRING Function Windows/Unix
    A string function that returns a string of spaces of length n.

    Syntax: SPACE$(n)
    A$ = SPACE$(5)

    SQR MATH Function Windows/Unix
    A math function that returns the square root of a number.

    Syntax: SQR(numeric-expression)
    A# = SQR(9) '-- returns 3

    STATIC Statement Windows/Unix
    Similar to DIM, this statement names one or more variables and allocates storage space for them. However, declaring STATIC variables means that variable values are preserved between procedure calls. Note that only simple types are affected.

    Syntax: STATIC variable[(subscripts)] AS type
    STATIC A AS INTEGER, B AS BYTE, S AS STRING

    Details:
    STATIC has no affect (ie. same as using DIM) when declared in the main module. Use STATIC only inside a SUB/I or FUNCTION/I.

    Examples:
        '-- Non static count
    SUB Count (N AS INTEGER)
       DIM B AS LONG

       B = N
       IF N = 10 THEN EXIT SUB
       Count(N+1)
       PRINT B
    END SUB

    Count(1)

    '-- Static count, B retains the same value
    SUB StaticCount (N AS INTEGER)
       STATIC B AS LONG

       B = N
       IF N = 10 THEN EXIT SUB
       StaticCount(N+1)
       PRINT B
    END SUB

    StaticCount(1)

    STR$ CONVERSION Function Windows/Unix
    A conversion function that returns a string representation of the value of a numeric expression.

    Syntax: STR$(numeric-expression)
    A$ = STR$(99)

    STRF$ CONVERSION Function Windows
    A conversion function that returns a formatted string representation of the value of a numeric expression.

    Syntax: STRF$(numeric-expression, Format%, Precision%, Digits%)
    A$ = STRF$(99.9934, ffGeneral, 4, 4)
    A$ = STRF$(12345678, ffNumber, 8, 0)

    Details:
    Precision% specifies how many decimal places to calculate.
    The following are valid Formats:
    0 = ffGeneral      2 = ffFixed
1 = ffExponent     3 = ffNumber
    ffGeneral converts to the shortest possible decimal string, where trailing zeros are removed. Digits% range from values of 0 to 4.
    ffExponent converts to scientific notation of the form -d.ddd...E+dddd. Digits% range from values of 0 to 4.
    ffFixed converts to fixed point format of the form -ddd.ddd... Digits% range from values of 0 to 18.
    ffNumber converts to a number format of the form -d,ddd,ddd.ddd... Where the resulting string contains thousand separators.

    STRING$ STRING Function Windows/Unix
    A string function that returns a string whose characters all have a given ASCII code or whose characters are all the first character of a string expression.

    Syntax: STRING$(count, byte)
    A$ = STRING$(9, 65) '-- Returns AAAAAAAAA
    Syntax: STRING$(count, string-expression)
    A$ = STRING$(9, "ABC") '-- Returns AAAAAAAAA

    Details:
    The first parameter indicates the number of times to repeat the character. The second parameter can either be a string expression, whose first character is used as the repeat character, or a byte number in the range from 0 to 255 representing the ASCII character code.

    32k limitation

    SWAP Statement Windows/Unix
    An assignment statement that exchanges the values of 2 variables.

    Syntax: SWAP variable1, variable2
    SWAP A$, B$

    Details:
    Variable1 and variable2 should be of the same type, but Rapid-Q won't complain. Also, do not swap variants using the SWAP function if their types do not match.

    TALLY STRING Function Windows/Unix
    Tally counts the number of occurrences of MatchString within a SearchString.

    Syntax: TALLY(search-string, match-string)
    Count& = TALLY("abcdefghijklmnabc", "abc") '-- returns 2

    TALLY is very slow !!!
    better use (Jacques Philippe):

    Function f_Tally (sSearchIn As String, sToFind As string) As Long
    DefInt iCharCounter = 0
    For N = 1 To Len(sSearchIn)
    If sSearchIn[N] = sToFind Then iCharCounter ++
    Next N
    Result = iCharCounter
    End Function
    ----------------------
    result
    for N=1 to 100
    myString =myString+string$(1000,"a")
    next
    'len(myString)=100000
    z=tally(myString,"a")
    z= f_Tally (myString,"a")

    8934 ms for 2 Loops tally=100000
    1545 ms for 2 Loops RQ Developped Tally=100000
    ----------------------

    TAN MATH Function Windows/Unix
    A math function that returns the tangent of an angle given in radians.

    Syntax: TAN(numeric-expression)
    T# = TAN(90)

    Details:
    Numeric-expression is the angle expressed in radians.

    TIME$ SYSTEM Function Windows/Unix
    A function that returns a string containing the current time formatted as HH:MM:SS. Where HH = hour (0-23), MM = minute (0-59) and SS = seconds (0-59)

    Syntax: TIME$
    PRINT TIME$

    Details:
    Unlike QBasic where you can set the current date using the TIME$ statement, you cannot do this under Rapid-Q.

    TIMER SYSTEM Function Windows/Unix
    A function that returns the number of seconds elasped since midnight.

    Syntax: TIMER
    T! = TIMER

    Details:
    Timer value for Linux/Unix is the number of seconds elasped since your program started.

    UBOUND ARRAY Function Windows/Unix
    A function that returns the upper bound of the array.

    Syntax: UBOUND(arrayname [,dimension])
    DIM A(-50 TO 100) AS INTEGER
    L% = UBOUND(A) '-- Returns 100

    Details:
    If the array has multiple dimensions, you can use the optional dimension argument to check the upper bound of each one.

    BUG !!
    DIM A%(-50 TO 100) AS INTEGER
    L% = UBOUND(A%) '-- Returns 0

    UCASE$ STRING Function Windows/Unix
    A string function that returns a string expression with all letters upper-case.

    Syntax: UCASE$(string-expression)
    A$ = UCASE$("Hello") '-- returns HELLO

    UNLOADLIBRARY DLL Statement Windows
    Removes DLL from memory (only those declared in Rapid-Q). If DLL hasn't been loaded or is not found, this statement does nothing.

    Syntax: UNLOADLIBRARY(DLLName)
    DECLARE FUNCTION UpdateWindow LIB "USER32" ALIAS _
    "UpdateWindow" (hWnd AS LONG) AS LONG
    UNLOADLIBRARY("USER32") '-- Removes USER32.DLL from memory

    Details:
    It is not required that you unload a DLL, this is done for you when your Rapid-Q program ends. Unloading a DLL library from memory does not mean the function call that requires the DLL will fail. The DLL is again reloaded into memory before the function call, so you can UnLoad it again if you want. Please note that library names should match, so in your declaration for LIB "USER32" ... to unload this library, you must match that same name. UNLOADLIBRARY("USER32.DLL") does nothing, it must be "USER32" in this particular case.
    See also LIBRARYINST.

    VAL CONVERSION Function Windows/Unix
    A conversion function that returns a numeric representation of the string expression.

    Syntax: VAL(string-expression)
    A = VAL("995")

    A = VAL("") ' return 0
    A = VAL("-") ' cause error !!
    A = VAL("+") ' cause error !!

    VARPTR ADDRESS Function Windows/Unix
    A function that returns the address, ie. pointer to, of the given variable name. Variable must be a declared variable, ie. not a component variable such as QForm.Caption

    Syntax: VARPTR(variablename)
    Addr& = VARPTR(MyString$)
    Addr& = VARPTR(MyArray(0))

    VARPTR$ ADDRESS Function Windows/Unix
    A function that returns the string representation of a given address.

    Syntax: VARPTR$(address)
    S$ = VARPTR$(279027343)

    VARTYPE VARIANT Function Windows/Unix
    A function that returns the data type of the current value stored in the variant.

    Syntax: VARTYPE(variant)
    DIM myvariant(100) AS VARIANT
    myvariant(1) = "G"
    VType = VARTYPE(myvariant(1))

    Details:
    Valid return values are:
    0 - Number (includes Byte, Word, Dword, Short, Long/Integer)
1 - Float (includes Single, Double)
2 - String

    Example
dim TstNum as variant
DEFDBL Number1
Number1=77.0
TstNum=Number1
VType = VARTYPE(TstNum)
print "VType0=" ,VType  ' Return 0

Number1=77.01
TstNum=Number1
VType = VARTYPE(TstNum)
print "VType1=" ,VType  ' Return 1
    All undefined variants are initialized as Numbers.


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide Contents
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgcontents.html/Serban Stanescu/None/01

Programmer's Guide Contents
by rapidQProjects, last update of the documentation: june, 15, 2001

1. Programmer's Guide: Introduction

2. Programmer's Guide: Sections

  1. Events

    This subsection covers all EVENTS, the "Applies to list", and sample code on how to use them.

  2. Methods

    This subsection covers all METHODS, the "Applies to list", and sample code on how to use them.

  3. How To...

    This subsection covers different issues, as the solutions have been found. Probably the main guidelines of its structure will be the FAQ.

  4. Objects List

    This subsection covers all QOBJECTS, (intrinsic or custom) the "Applies to list", and sample code on how to use them.

  5. Properties

    This subsection covers all PROPERTIES, the "Applies to list", and sample code on how to use them.

  6. Sample Code List

    This subsection covers mainly the application zone, consisting of applications source code from the archives available at this time. Since a full distribution of Rapid-Q is not yet available, we'll probably focus un download sites also.

  7. To Do List

    No need to explain that :).
I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: Events
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgevents.html/Serban Stanescu/None/01

Programmer's Guide: Events Section
by rapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: How To...
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pghowto.html/Serban Stanescu/None/01

Programmer's Guide: How To... Section
by rapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide Introduction
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgintro.html/Serban Stanescu/None/01

Programmer's Guide: Introduction
by RapidQProjects, last update of the documentation: june, 15, 2001

This section is probably the most needed section of this Project. For now, (15th June 2001), it is not more than a skeleton, a few blank pages. The section probably will remain in that state in Release 01 of the RQDP, since there's an extremely large amount of work to develop all this Project's sections at the same time. The main target of the Release 01, was to offer a more friendly way to use the original documentation. We hope we achieved that goal, maybe not at its best, but everything can be improved. Any suggestions, are welcome, as well as any contributions:
  1. Code snippets, with short descriptions;
  2. Screenshots from the apps uploaded;
  3. Articles on code samples, explaining in detail the concepts, solutions and the algorythms used;
  4. Lists of "ToDo", so we can improve the section;
  5. VOLUNTEERS, to put things in HTML code (extremely useful now!!).
Hoping that we will be able to cover all your needs in the future and offer you a REALLY useful "Programmer's Guide", we wish you,
Happy (Rapid-Q) coding!

The RapidQProjects Team


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: Methods
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgmethods.html/Serban Stanescu/None/01

Programmer's Guide: Methods Section
by rapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: Objects List
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgobjectslist.html/Serban Stanescu/None/01

Programmer's Guide: Objects List Section
by rapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: Properties
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgproperties.html/Serban Stanescu/None/01

Programmer's Guide: Properties Section
by RapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: Sample Code List
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgsamples.html/Serban Stanescu/None/01

Programmer's Guide: Sample Code List Section
by rapidQProjects, last update of the document: june, 16, 2001

I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Documentation

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide Title page
Current Document/Author/Revision/Release | pgtitle.html/Serban S/Serban S/01


Rapid-Q Programmer's Guide

Rapid-Q Documentation Project (RQDP) | Release 01 Programmer's Guide: To Do...
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | pgtodo.html/Serban Stanescu/None/01

Programmer's Guide: To Do... Section
by rapidQProjects, last update of the document: june, 16, 2001

1. What to do?!... This is merely an encyclopaedia! I don't dare putting your patience on test! Still... for "Release 01" the main goal was to make it easier to find basic info in William Yu's original docs. It was'n that easy as I figured at the beginning, but we made it... Some changes to the original docs had to be made, in order to put links to specific items. Some of them, had to be completely reformatted, for backwards compatibility and forwards compatibility [ :) :) :) ] (That is: Netscape 6.0 renders tables like I.E. 4.0! Don't laugh at me, laugh at them!).
So: this unexpected "improvement" of Netscape, forced substantial delay in Project's skedule, and thus, some of the initial ideas, were reskeduled for the future update.
2. What next? I don't know EXACTLY. Basically, my focus is on working at the "Programmer's Guide". BUT: if I have to do all the work by my own, don't expect at a soon update. I'm not THAT fast. Besides, I can't work exclusively at that project. I still have to earn my existence... So, any help is welcome and obviously, extremely useful.
3. Getting to the next target: that is building the FAQ system. That will be a nice thing. Thanks to Andreas Fink "FastCowCoder", we have about 4 Megs of raw (ASCII) material. Not bad for the beginning, ain't that so? For this part of the project, please contact him at rapidq@yahoogroups.com and mention at Subject: FAQ Section, for FastCowCoder or if you have his private e-mail, mail him directly.
4. Very important: The Official RapidQ Site (basicguru.com) desperately needs an update. So, this is some other task we have to accomplish... Volunteers?
4. At the end: Well, not EXACTLY at the end, but for now... I'm working at a Rapid-Q full package, with setup, RQDP included, etc., all the stuff I could get from the NET. That means also time, and I don't have too much.

With all my consideration, Serban Stanescu, June 16, 2001.
I want to go to:

Events
Methods
How To...
Objects List
Properties
Sample Code List
To Do... List


Rapid-Q Preface

Rapid-Q Documentation by William Yu ©1999-2000 Preface

A lot has changed since the initial release of Rapid-Q, but one thing that hasn't changed is the fact that Rapid-Q is constantly being upgraded almost daily. The overall goal still exists, to provide an alternative BASIC programming language that's not only FREE, but good and easy to use. Being a BASIC programmer at heart, I looked through the eyes of a user, and added the features and ease of use that I like to see in a good programming language. Some of the features you see are spawned in part by our excellent Rapid-Q user base. Requesting features is one way this project can succeed, since there are many out there that share the same vision. Perhaps in the future, some of these features will become standard in all BASIC languages. If you're familiar with either QBasic, PowerBasic, or even VisualBasic, you'll be able to program in Rapid-Q in no time. The advanced features that Rapid-Q offers need not be used at all, but is available when you get more comfortable with the language itself. For example, Rapid-Q offers object/component creation, function pointers, procedures with infinite parameters, variants, and overloaded macros, while still maintaining all the fundamental features that most BASIC programmers are familiar with, ie. GOTO, GOSUB, line numbers, etc... This makes converting legacy code much easier. The only feature which deviates from traditional BASIC languages is file handling. I believe that once you understand how file and memory streams work, this can be a huge benefit, rather than a hassle. For those who aren't aware, Rapid-Q is a 32-bit multiplatform GUI and CONSOLE BASIC compiler/interpreter for Windows, Linux, and Unix. Rapid-Q compiles your BASIC source code into byte-code, which is normally attached to an interpreter, but can also be run from other programming languages using specialized DLLs.

About this document
These chapters were written and rewritten as new features were added, which means that it's quite possible you'll find some inconsistent or obsolete comments and code. If you spot one of these, please send me an e-mail so I can remove/change it.

Source Codes
I have always stressed that the best way to learn is by example. It really isn't enough just to look at it and say "Uh huh, yeah." Take some time to take it apart and rewrite the code yourself. Trial and error is always a good way of learning. It seems we learn more by our mistakes, this is also true for programming. Yes, you'll have many nights of frustration when your code just doesn't seem to run properly, but once that bug is found, you'll be dancing around like there's no tomorrow. I'm also maintaining a knowledge base of some of the many questions that I've received from fellow Rapid-Q users. You can find a link to this on our homepage. Another site that I maintain is the All Basic Code Archives at http://www.basicguru.com/abc/ which consists of over 2600 BASIC source codes and hundreds of BASIC related resources.

Rapid-Q Audience
Being a BASIC programming language, I've targeted BASIC programmers, primarily beginner to intermediate BASIC programmers, but even advanced programmers have used Rapid-Q at some point. My future goal is to integrate Rapid-Q in a classroom, such as in junior/senior high school, or even in college.

The Future of Rapid-Q
Obviously expanding Rapid-Q by adding new features is something that will continue in the future, but I also plan on open sourcing Rapid-Q when I've done all I can. This of course can't be guaranteed, and there's no telling when this decision will be made. It's likely that the Linux/Unix version will be open source sooner than the Windows version.

Comments & Suggestions
I appreciate all comments, suggestions and constructive criticism. I would also like to extend thanks to all beta testers for their help and suggestions. The best way to voice your opinion is on our mailing list, this way we can all discuss the problem or suggestions that you may have. However, I don't discourage individual e-mails, so feel free to contact me and I'll try to get back to you ASAP.

E-mail me
William Yu <voxel@edmc.net>


Printer

Hello,
I am sorry to bother you, but I need help with using COM controls.
My problem is not really with using QOLEOBJECT and QOLECONTAINER, I
understand fairly well how to use these. What I do not understand is how I
can find the properties, methods, and events of a particular control. For
example:

Dim Object as QOLEOBJECT
Object.CreateObject("Word.Basic")

How did you know to use "Word.Basic"?

Or another example:

Dim msHTML as QOLECONTAINER
msHTML.CreateObject("Shell.Explorer.1")

How did you know to use "Shell.Explorer"?

Using the program Dependency Walker to view msHTML.dll, I see nothing that
says "Shell.Explorer", so I assume that what I'm looking for is found
somewhere else.

I apologize for the dumb question, but it's been bugging for awhile now and
I still can't figure it out, so of coarse, all information will be GREATLY
appreciated.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

I just found out that I have a COM viewer included with VC++.

It can also be downloaded here
http://www.microsoft.com/com/resources/oleview.asp

It doesn't seem to have any documentation for the objects, but at
least it tells you what's there.

See
http://download.microsoft.com/download/ole/ole2v/3.5/W351/EN-US/Ole2v.exe

I'd like to know how to access and read Outlook Address Book
using qoleobject and qolecontainer from my little program.
I've tried with:

$apptype console
DIM Object AS QOLEOBJECT
Dim ot As QOLEOBJECT
Dim mapi As QOLEOBJECT
Dim x As QOLEOBJECT

Print "outlook..."
Print Object.Create("Outlook.Application")
Print Object.getIDOfName("GetNameSpace")
Sleep 2
Print "invoke"
Print Object.invoke("GetNameSpace","MAPI",mapi)
Print mapi.getIDOfName("AddressLists.Count")

Print "NameSpace..."
Print mapi.Invoke("AddressLists.Count")

SLEEP 5
Print "Stop"
Input asfdsadf
End

I'll like any suggestion. Thanks

Hi,

I use the code and of course, it works. (Thanks for the tip).

Now im trying to change one variable of the Flash Movie.
Taking an example from JavaScript i can do it.
Works a little strange, because it behavior different of the
original JS idea.
Now i want to know how could i know whats thinks can be done in a
similar way, im talking about getting acceso to the 'object'
properties, actions,etc. Just like "SetVariable'.

The NEW code is:

CREATE Form AS QFORM
Caption = "Swf"
Center
Visible = 1
CREATE swf AS QOLECONTAINER
CreateObject("ShockwaveFlash.ShockwaveFlash.5")
movie= "c:\windows\escritorio\p1.swf"
setvariable ("t","texto")
height =200
width = 200
END CREATE
Visible = 0
END CREATE

Form.ShowModal

swf.Free

You need to have an edit in the Flash Movie with a variable
named 'texto' (dynamic).

Hi,

For the Object "Explorer" you have these

PROPRETIES
----------
help
attach
busy
fullname
locationname
locationurl
name
offline
path
readystate
registerasbrowser
registerasdroptarget
silent
theatermode
toplevelcontainer
type
wherelc

METHODS
-------
Exec
GoBack
GoForward
GoHome
GoHome
Navigate
QueryStatusWB
Refresh

CREATE msHTML AS QOLECONTAINER
Align = 5
createObject("Shell.Explorer.1")
END CREATE

This Works
----------
msHTML.LocationURL returns the ... LocationURL
msHTML.Refresh Refreshes the viewed page
msHTML.Navigate ("www.google.com") view google page

It's posible too to INVOKE
msHTML.Invoke ("locationURL") ' never tried ???

I've never been able to use Exec to SaveThe File
------------------------------------------------
msHTML.Exec 4, 2, "c:\\Tampon\\RQGoogle.Htm", 0 ' or msHTML.ExecWB ...

Nor CUT AND PASTE
msHtml.Invoke ("ExecCommand", 17, 0, 0, 0) ' 17 = CUT
msHtml.Invoke ("ExecCommand", 12, 0, 0, 0) ' 12 = paste

You MUST find a documentation on the ShockWavaFlash !

-------------------------------------------------------------------------

And BTW, I am calm :)

Jacques

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

You should be able to use QOleObject. See the docs for an example.
You should be able to call its properties and methods much like you
do in VB. However events I don't think are supported.

MSXML is a COM based dll. The only functions it exports mostly
relate to registering the dll.

--- In rapidq@y..., Leo Dicaprio <Nadesom@y...> wrote:
>
> Under VB, after msxml.dll is included in the project,
> i can use it by
> Dim xml As New MSXML.DOMDocument
> and:
> xml.Load ("test.xml")
>
> Any idea under RQ?
> I cann't found the DLL's Export Table using Quick
> View.

Thanks.

I should read Yu' Doc ch.15. COM Programming.

Here is a code.

Another question now is how can we use xml under linux
with RQ.

DIM Obj AS QOLEOBJECT

Obj.CreateObject("Microsoft.XMLDOM")
Obj.load("car.xml")

print Obj.xml

showmessage "ok"

----- Original Message -----
From: "petek1827" <petek1827@yahoo.com>
To: <rapidq@yahoogroups.com>
Sent: Monday, February 25, 2002 3:21 PM
Subject: [rapidq] Re: use msxml.dll under rapidq

> You should be able to use QOleObject. See the docs
for an example.
> You should be able to call its properties and
methods much like you
> do in VB. However events I don't think are
supported.
>

Great!

Also i foud, that its possible to use CreateObject, which working
much faster and warantied, that it will supported by remote server.

Guys, look at this short example:

$APPTYPE CGI
$INCLUDE "INCLUDES/CGI.INC"

DIM ADODB AS QOLEOBJECT
DIM ConnString AS STRING
DIM strSQL AS STRING

ADODB.CREATEOBJECT("ADODB.Connection")

ConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=db1.mdb;"
ADODB.Open ConnString

RSF = ADODB.EXECUTE("SELECT * FROM SiteAdmin")
' -----------------------------------------------------------
' Next part not working:
DO
RSF.MOVENEXT
RESPONSEWRITE "<a href='?option=someaction'>" & RSF("DDD") & "</a>"
LOOP WHILE NOT RSF.EOF

So, im getting conecction to database (any DSN or DSN-less), im
allowed to execute SQL Queryes, but how to use Recordsets here?

Is any ideas about it?

--- In rapidq@y..., "edamian919" <edamian919@y...> wrote:
> hello, yes there's one way, you have to use the odbc driver for
> msaccess,
> On the weekend i'll send you an example
>
> bye
> --- In rapidq@y..., "bol_spider" <bol_spider@y...> wrote:
> > Hello, people!
> >
> > IS ANY WAY to use MS Access MDB bases?

' Declaring Application type
$APPTYPE CGI
' Including Web.Objects
$INCLUDE "OBJ_HTTP.INC"
' Including Rapid-Q Constants
$INCLUDE "RAPIDQ.INC"

' This line will break execution if file requested not by browser
IF REQUEST.HTTP_USER_AGENT ="" THEN END

' If requested by browser, generate response
' with proper status code.
' for IE you can generate always "200 OK" status, because IE
' don't see any difference in response codes.
RESPONSE.STATUS "200 OK"
' Declaring content type
RESPONSE.CONTENTTYPE "text/html"
' Also you can add/declare DocType when you using XML, WML and etc...
' And now send this generated header.
' Without sending header u will get CGI Error
RESPONSE.SENDHEADER

DIM USERNAME AS STRING
DIM PASSWORD AS STRING
' Here we looking for some values posted from browser
USERNAME = HTTP.GETVALUE("username")
PASSWORD = HTTP.GETVALUE("password")

DIM BUF AS STRING
' Now loading some page, which contains "keywords"
' We using keyword on page for automate content management process
' In this case we will nee to design only one page, which will be
' as basement for whole web site.
BUF = FSO.FILETOBUFFER("templates/t_index.htm")
' So, page loaded to buffer and now we processing keywords
BUF = REPLACESUBSTR$(BUF,"{@footer}","Copyright © 2002")
' and now checking for user settings
' if we have a "guest", show him a login form, which also prepared
' as "template"
IF USERNAME="" AND PASSWORD ="" THEN
DIM LOGINFORMCONTENT AS STRING
LOGINFORMCONTENT = FSO.FILETOBUFFER
("templates/t_loginform.htm")
BUF = REPLACESUBSTR$(BUF,"{@header}","Please enter
your account details:")
BUF =
REPLACESUBSTR$(BUF,"{@menucontent}",LoginFormContent)
END IF
' Now we displaying generated HTML content to user and he will
' see it as normal web page.
RESPONSE.WRITE BUF
' Here small example of using "Response" object
RESPONSE.WRITE "<HR NOSHADE SIZE=1 COLOR=RED>"
RESPONSE.WRITE "REFERER: " & REQUEST.HTTP_REFERER & "<BR>"
RESPONSE.WRITE "PATH_TRANSLATED:" & REQUEST.PATH_TRANSLATED
& "<BR>"
RESPONSE.WRITE "REQUEST_METHOD: " & REQUEST.REQUEST_METHOD
& "<BR>"
RESPONSE.WRITE "QUERY_STRING: " & REQUEST.QUERY_STRING
& "<BR>"
RESPONSE.WRITE "DECODED STRING: " & HTTP.HTMLDECODE
(REQUEST.QUERY_STRING) & "<BR>"

Try VBS first to verify your COM installation:

DIM INETCONTROL
set INETCONTROL=wscript.CREATEOBJECT("InetCtlsObjects.Inet")

VBS has the best compatibility for MS COM. I ever found an object works fine with VBS but failed in PHP script. Maybe RQ also.

Guidance

Exception EOleSysError in module fsodemo.exe at 0007E571.
Invalid class string.

DIM INETCONTROL AS QOLEOBJECT
INETCONTROL.CREATEOBJECT("InetCtlsObjects.Inet")

compiling fine, but execution faulted. is any ideas why?

Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com


Appendix C: Procedures

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Procedures

Introduction to Procedures

A procedure in BASIC is either a SUB or FUNCTION (or SUBI and FUNCTIONI). It's functionally the same as GOSUB and RETURN but introduces the concept of parameters and return values. Unlike QBasic, a FUNCTION can also be called as a SUB. Meaning you can ignore its return value.

DECLARE SUB
Use DECLARE SUB whenever you want to provide a "forward" declaration without actually writing the SUB yet.
    DECLARE SUB Test

    CALL Test

    SUB Test
      '' Do Stuff
    END SUB
Using CALL to call your subroutine is strictly optional. As you can see, we're providing a forward declaration of the SUB Test. To avoid using DECLARE SUB, you could have written the SUB Test before CALLing it.
    SUB Test
    END SUB

    Test
This way you don't need to use DECLARE SUB. Please note that your parameter names in the DECLARE SUB and your actual SUB declaration MUST MATCH exactly! If you're not sure what I mean, take this for example:
    DECLARE SUB Test (A AS INTEGER, B AS INTEGER)

    SUB Test (X AS INTEGER, Y AS INTEGER)
       PRINT X;" ";Y
    END SUB
Don't change the variable names! This is because when you defined your DECLARE SUB, the parameter names have been fixed as A and B, which also means you can comfortably do this:
    DECLARE SUB Test (A AS INTEGER, B AS INTEGER)

    SUB Test
       PRINT A;" ";B
    END SUB
This is perfectly valid, since you've already declared your subroutine to have an A and B parameter. You don't actually need to define parameters if you already have a forward declaration in place. Obviously this can become confusing so it's not recommended.

Passing variables by reference
There are 2 ways to pass variables by reference. Unlike other BASIC languages, Rapid-Q assumes that all parameters are passed by value unless explicitly specified. To do this explicitly, you can attach a BYREF keyword in front of your parameter list. Here's an example
    SUB StrCat (BYREF Source AS STRING, Text AS STRING)
        Source = Source + Text
    END SUB

    A$ = "Hello"
    StrCat A$, " world!"
    PRINT A$              '-- returns "Hello world!"
Another way is to prepend an '@' symbol in front of the variable:
    SUB StrCat (Source AS STRING, Text AS STRING)
        Source = Source + Text
    END SUB

    A$ = "Hello"
    StrCat @A$, " world!"
    PRINT A$              '-- returns "Hello world!"

FUNCTIONs versus SUBs
The only difference between a FUNCTION and a SUB is that a FUNCTION returns a value.
   FUNCTION Test AS INTEGER
     Test = 123
     Result = 123
   END FUNCTION

   Rval% = Test
Our FUNCTION Test returns an INTEGER, which we can clearly see returns 123. To return a value, you can use the FUNCTION's name or use the keyword Result. Just because you've attached a return value to the FUNCTION, it does not automatically terminate until it reaches your END FUNCTION. So you can really assign as many return values as you like without consequences. The last return value assigned will ultimately be the one bound to your FUNCTION. To exit a FUNCTION or SUB, just use EXIT FUNCTION, or EXIT SUB respectively. One special case in using SUBs or FUNCTIONs in Rapid-Q is that you can only pass at most 10 parameters. QObjects, Arrays, UDTs and Variants are passed by reference, everything else is passed by value. In order for Rapid-Q to recognize that you want to pass a variable by reference, you must attach an @ symbol in front of the variable, or use BYREF in your parameter list. See Chapter 3 section 5 for more information.

SUBI and FUNCTIONI
There's a whole chapter reserved for these two procedure methods. It's not really that complicated, but is very handy to use. They provide the programmer with infinite parameters without type checking. Only simple types like numbers and strings can be passed, no Arrays, UDTs or QObjects. See Chapter 9 for all the details.


APPLICATION

Rapid-Q Documentation by William Yu (c)1999 Appendix A: APPLICATION

APPLICATION Component

This object is global, and need not be created.

Application Properties
Field | Type | R/W | Default | Support
ExeName | STRING | R | WXG
The executable name of the application, path name is excluded (use COMMAND$(0) for full path information).
Handle | INTEGER | R | W
hInstance of the application.
HelpFile | STRING | RW | W
HelpFile specifies the name of the file the application uses to display help.
HintColor | INTEGER | RW | clInfoBk | W
HintColor determines the color of the hint boxes for the Help Hints.
HintHidePause | INTEGER | RW | 2500 | W
HintHidePause specifies the time interval to wait before hiding the Help Hint if the mouse has not moved from the control or menu item.
HintPause | INTEGER | RW | 500 | W
HintPause specifies the time interval that passes before the control's Help Hint appears when the user places the mouse pointer on a control or menu item.
HintShortPause | INTEGER | RW | 50 | W
HideShortPause specifies the pause to wait before bringing up a hint if a hint has already been shown.
Icon | STRING | RW | W
Specify an icon filename to appear as the default icon of your application.
IcoHandle | RESOURCE | W | W
Specify an icon resource to appear as the default icon of your application.
Example:
$RESOURCE game_ICO AS "game.ico"
Application.IcoHandle = game_ICO
ShowHint | INTEGER | RW | True | W
Title | STRING | RW | W

Application Methods
Method | Type | Description | Params | Support
HelpCommand | SUB (Command AS WORD, Data AS LONG) | Accesses the Help commands in the WinHelp API | 2 | W
HelpContext | SUB (Context AS LONG) | Bring up the Application's HelpFile at specifed Context ID | 1 | W
HelpJump | SUB (JumpID AS STRING) | Brings up the HelpFile and displays the screen in the Help file that has the JumpID | 1 | W
Minimize | SUB | Minimize Application | 0 | W
Terminate | SUB | Terminates Application | 0 | WXG

Application Examples
  Application.HintColor = &H00FF00

  CREATE Form AS QFORM
      CREATE Button AS QBUTTON
          Hint = "Button Hint"
          ShowHint = 1
      END CREATE
      ShowModal
  END CREATE


QChartEx.rqb

'----- Compiler Directives
$OPTIMIZE ON
$TYPECHECK ON

'----- Code modules (Change path to point to the correct directory on your system)
$INCLUDE "QChart.obj"

'----- Form Event SUB Declarations
DECLARE SUB btnOnClick (SENDER AS QButton)
DECLARE SUB frmMainResize (SENDER AS QForm)

'----- API Constants and Functions
CONST GWL_HWNDPARENT = (-8)                         'Minimize to task bar
CONST HWND_DESKTOP = 0
DECLARE FUNCTION SetWindowLong LIB "user32" ALIAS "SetWindowLongA"_
                 (hwnd AS LONG, nIndex AS LONG, dwNewLong AS LONG) AS LONG

'----- Rapid-Q Constants
CONST alRight = 4
CONST poLandscape = 1

CREATE frmMain AS QForm

  Center
  Width = 640
  Height = 480
  Caption = "QChart Example"
  OnResize = frmMainResize

    CREATE drwHisto1 AS QButton
      Caption = "Histogram"
      OnClick = btnOnClick
    END CREATE

    CREATE drwBar1 AS QButton
      Caption = "Bar Graph 1"
      Top = 25
      OnClick = btnOnClick
    END CREATE

    CREATE drwBar2 AS QButton
      Caption = "Bar Graph 2"
      Top = 50
      OnClick = btnOnClick
    END CREATE

    CREATE drwBar3 AS QButton
      Caption = "Bar Graph 3"
      Top = 75
      OnClick = btnOnClick
    END CREATE

    CREATE drwXYpt AS QButton
      Caption = "XY Points"
      Top = 100
      OnClick = btnOnClick
    END CREATE

    CREATE drwXYln AS QButton
      Caption = "XY Lines"
      Top = 125
      OnClick = btnOnClick
    END CREATE

    CREATE drwXYboth AS QButton
      Caption = "XY Both"
      Top = 150
      OnClick = btnOnClick
    END CREATE

    CREATE drwXYlog AS QButton
      Caption = "XY Logs"
      Top = 175
      OnClick = btnOnClick
    END CREATE

    CREATE drwLine AS QButton
      Caption = "Line Graph"
      Top = 200
      OnClick = btnOnClick
    END CREATE

    CREATE drwLinePts AS QButton
      Caption = "Line w/Points"
      Top = 225
      OnClick = btnOnClick
    END CREATE

    CREATE drwBox AS QButton
      Caption = "Box Plot"
      Top = 250
      OnClick = btnOnClick
    END CREATE

    CREATE drwHiLo1 AS QButton
      Caption = "HLC Style 1"
      Top = 275
      OnClick = btnOnClick
    END CREATE

    CREATE drwHiLo2 AS QButton
      Caption = "HLC Style 2"
      Top = 300
      OnClick = btnOnClick
    END CREATE

    CREATE btnRedraw AS QButton
      Caption = "Redraw"
      Top = 325
      OnClick = btnOnClick
    END CREATE

    CREATE btnClear AS QButton
      Caption = "Clear"
      Top = 350
      OnClick = btnOnClick
    END CREATE

    CREATE btnSave AS QButton
      Caption = "Save"
      Top = 375
      OnClick = btnOnClick
    END CREATE

    CREATE btnPrint AS QButton
      Caption = "Print"
      Top = 400
      OnClick = btnOnClick
    END CREATE

    CREATE btnExit AS QButton
      Caption = "Exit"
      Top = 425
      OnClick = btnOnClick
    END CREATE

    CREATE Graph AS QChart                              'Create a copy of the new object
      Align = alRight
      Width = frmMain.ClientWidth - btnClear.Width
      Height = frmMain.ClientHeight
      Image.OnPaint = Graph.ImagePaint                  'This line REQUIRED to process Repaints
    END CREATE'Graph

END CREATE'frmMain

'API Call that lets RapidQ programs minimize to the task bar
setwindowlong(frmMain.handle, GWL_HWNDPARENT, HWND_DESKTOP)
setwindowlong(application.handle, GWL_HWNDPARENT, frmMain.handle)

WITH Graph
  .Initialize                                           'Set default values
  .ClearBuffer                                          'Start with a clean slate
  .ImagePaint                                           'Paint the blank Canvas
END WITH
frmMain.ShowModal

'----- Event SUBs

SUB btnOnClick (SENDER AS QButton)

  DIM i  AS INTEGER                                     'Loop counters...
  DIM j  AS INTEGER
  DIM k  AS SINGLE                                      'A Scratch Variable

  SELECT CASE Sender.Caption

    CASE "Histogram"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Histogram Example"           'Change desired options
        .SubTitle.Text = "No Grid, No Border"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .DoLegend = False
        .AxisBorder = False
        .XAxis.Grid = False
        .YAxis.Grid = False
        .Data.ColCount = 1                              'Set .Data Grid dimensions
        .Data.RowCount = 10
        j = 25                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.RowCount
          .Data.Cell(0,i) = "Class " + STR$(i)
          .Data.Cell(1,i) = STR$(RND * j)
        NEXT i
        .ChartType = ctBar                              'Bar Chart
        .ChartStyle = csHisto                           'Histogram
        .DrawBar (False)                                'Draw it!
      END WITH

    CASE "Bar Graph 1"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Bar Graph Example 1"         'change desired options
        .SubTitle.Text = "Positive Values"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = False
        .Data.ColCount = 5                              'Set .Data Grid dimensions
        .Data.RowCount = 2
        k = 25                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount
          .Data.Cell(i , 0) = STR$(i)                   'Legend in Row 0 of each Col
          FOR j = 1 TO .Data.RowCount
            .Data.Cell(i,j) = STR$(RND * k)
          NEXT j
        NEXT i
        FOR j = 1 TO .Data.RowCount
          .Data.Cell(0,j) = "Treatment " + STR$(j)      'X Labels in Col 0 of each Row
        NEXT j
        .ChartType = ctBar                              'Bar Chart
        .ChartStyle = csBar                             'Grouped Bars
        .DrawBar (False)                                'Draw it!
      END WITH

    CASE "Bar Graph 2"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Bar Graph Example 2"         'change desired options
        .SubTitle.Text = "Negative Values"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Data.ColCount = 8                              'Set .Data Grid dimensions
        .Data.RowCount = 1
        k = 25                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of each Col
          FOR j = 1 TO .Data.RowCount
            .Data.Cell(i,j) = STR$((RND) * -k)
          NEXT j
        NEXT i
        FOR j = 1 TO .Data.RowCount
          .Data.Cell(0,j) = "Level " + STR$(j)          'X Labels in Col 0 of each Row
        NEXT j
        .ChartType = ctBar                              'Bar Chart
        .ChartStyle = csBar                             'Grouped Bars
        .DrawBar (False)                                'Draw it!
      END WITH

    CASE "Bar Graph 3"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Bar Graph Example 3"         'change desired options
        .SubTitle.Text = "Positive and Negative Values"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Data.ColCount = 4                              'Set .Data Grid dimensions
        .Data.RowCount = 3
        k = 20                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount
          .Data.Cell(i , 0) = "Long Legend Title " + STR$(i)'Legend in Row 0 of each Col
          FOR j = 1 TO .Data.RowCount
            .Data.Cell(i,j) = STR$((RND - RND) * k)
          NEXT j
        NEXT i
        FOR j = 1 TO .Data.RowCount
          .Data.Cell(0,j) = "Level " + STR$(j)          'X Labels in Col 0 of each Row
        NEXT j
        .ChartType = ctBar                              'Bar Chart
        .ChartStyle = csBar                             'Grouped Bars
        .DrawBar (False)                                'Draw it!
      END WITH

    CASE "XY Points"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Scatter Plot Example"        'change desired options
        .SubTitle.Text = "Data in All Four Quadrants"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Data.ColCount = 16                             'Set .Data Grid dimensions
        .Data.RowCount = 5
        k = .00100                                    '<-- change k for large and small values
        RANDOMIZE                                       'Load the data
        FOR i = 2 to .Data.ColCount STEP 2              'for each col pair
          .Data.Cell(i , 0) = "Group " + STR$(i \ 2)    'Legend in 2nd Col (Y) of Pair, Row 0
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(i - 1 , j) = STR$(k * (RND - RND))'X Values in Col 1
            .Data.Cell(i , j) = STR$(k * (RND - RND))   'Y Values in Col 2
          NEXT j
        NEXT i
        .ChartType = ctXY                               'XY Scatter Chart
        .ChartStyle = csPointsOnly                      'Just the Points
        .DrawXY (False)                                 'Draw it!
      END WITH

    CASE "XY Lines"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Two Sine Curves"             'change desired options
        .SubTitle.Text = "Out of Phase"
        .XTitle.Text = "Radians"
        .YTitle.Text = "Sine of X"
        .BW = True
        .YAxis.Div = 6
        .XAxis.AutoScale = False                        'Manually Scale
          .XAxis.Max = 2                                'Set Max Manually
          .XAxis.Min = 0                                'Set Min Manually
        .YAxis.AutoScale = False                        'Manually Scale
          .YAxis.Max = 1.5                              'Set Max Manually
          .YAxis.Min = -1.5                             'Set Min Manually
        .Data.ColCount = 4                              'Set .Data Grid dimensions
        .Data.RowCount = 21                             'Load the data
        FOR i = 2 to .Data.ColCount STEP 2              'for each col pair
          .Data.Cell(i , 0) = "Group " + STR$(i \ 2)    'Legend in 2nd Col of Pair, Row 0
          .Series(i\2).LineStyle = (i\2-1) MOD 5        'Cycle line styles
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(i - 1 , j) = STR$((j-1)/10)      'X Values in 1st Col of Pair
             k = ((j-1)/10 + [(i-2) * 4.75])* 3.141592
            .Data.Cell(i , j) = STR$(SIN(k))            'Y Values in 2nd Col of Pair
          NEXT j
        NEXT i
        .ChartType = ctXY                               'XY Scatter Chart
        .ChartStyle = csLinesOnly                       'Just the Lines
        .DrawXY (False)                                 'Draw it!
      END WITH

    CASE "XY Both"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Scatter Plot With Lines"     'change desired options
        .SubTitle.Text = "All options set to default"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Data.ColCount = 4                              'Set .Data Grid dimensions
        .Data.RowCount = 11
        k = 100                                         'Load the data
        RANDOMIZE
        FOR i = 2 to .Data.ColCount STEP 2              'for each col pair
          .Data.Cell(i , 0) = "Group " + STR$(i \ 2)    'Legend in 2nd Col of Pair, Row 0
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(i - 1 , j) = STR$(j)             'X Values in 1st Col of Pair
            .Data.Cell(i , j) = STR$(RND * k)           'Y Values in 2nd Col of Pair
          NEXT j
        NEXT i
'        .Data.Cell(1,4) = ""                            'Uncomment to see how QChart
'        .Data.Cell(4,8) = ""                            'handles missing data
        .ChartType = ctXY                               'XY Scatter Chart
        .ChartStyle = csBoth                            'Lines and Points
        .DrawXY (True)                                  'Draw it as an Overlay

      END WITH

    CASE "XY Logs"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Log - Log Scaling"           'change desired options
        .SubTitle.Text = "Grid with no Tics"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .YAxis.Tics = False
        .YAxis.LogScale = True
        .XAxis.Tics = False
        .XAxis.LogScale = True
        .DoLegend = False
        .Data.ColCount = 2                              'Set .Data Grid dimensions
        .Data.RowCount = 10
        RANDOMIZE                                       'Load the data
        FOR i = 2 to .Data.ColCount STEP 2              'for each col pair
          .Data.Cell(i , 0) = "Group " + STR$(i \ 2)    'Legend in 2nd Col of Pair, Row 0
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(i - 1 , j) = STR$(j)             'X Values in 1st Col of Pair
            .Data.Cell(i , j) = STR$(RND * 10^ (j/5))   'Y Values in 2nd Col of Pair
          NEXT j
        NEXT i
        .ChartType = ctXY                               'XY Scatter Chart
        .ChartStyle = csBoth                            'Points and Lines
        .DrawXY (True)                                  'Draw it!
      END WITH

    CASE "Line Graph"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Simple Line Graph"           'change desired options
        .SubTitle.Text = "X Labels Alternate Up and Down for Room"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .Data.ColCount = 5                              'Set .Data Grid dimensions
        .Data.RowCount = 12
        k = 18                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount                     'for each col
          .Series(i).LineStyle = (i-1) MOD 5            'Cycle line styles
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of Each Col
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(0 , j) = "Label " + STR$(j)      'X Labels
            .Data.Cell(i , j) = STR$(RND * k)           'Y Values
          NEXT j
        NEXT i
        .ChartType = ctLine                             'Line Chart
        .ChartStyle = csLinesOnly                       'Lines only
        .DrawLine (False)                               'Draw it!
      END WITH

    CASE "Line w/Points"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Line Graph With Points"      'change desired options
        .SubTitle.Text = "Tics Only, No Grid"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .BW = True
        .XAxis.Grid = False                             'Tics only
        .YAxis.Grid = False
        .Data.ColCount = 4                              'Set .Data Grid dimensions
        .Data.RowCount = 6
        k = 18                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount                     'for each col
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of Each Col
          FOR j = 1 to .Data.RowCount                   'add data to each row
            .Data.Cell(0 , j) = "Lbl " + STR$(j)        'X Labels
            .Data.Cell(i , j) = STR$(RND * k)           'Y Values
          NEXT j
        NEXT i
'        .Data.Cell(1,4) = ""                            'Uncomment to see QChart handle missing data
        .ChartType = ctLine                             'Line Chart
        .ChartStyle = csBoth                            'Points and Lines
        .DrawLine (False)                               'Draw it!
      END WITH

    CASE "Box Plot"
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Box and Whisker Plot"        'change desired options
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = False
        .XAxis.Tics = False
        .YAxis.AutoScale = False
          .YAxis.Min = 0
          .YAxis.Max = 50
        .Data.ColCount = 16                             'Set .Data Grid dimensions
        .Data.RowCount = 5
        k = 10                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount                     'for each col
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of Each Col
          .Data.Cell(i , 1) = STR$(RND * k + 40)        'Max Values
          .Data.Cell(i , 2) = STR$(RND * k + 30)        'Q3 Values
          .Data.Cell(i , 3) = STR$(RND * k + 20)        'Q2 Values
          .Data.Cell(i , 4) = STR$(RND * k + 10)        'Q1 Values
          .Data.Cell(i , 5) = STR$(RND * k)             'Min Values
        NEXT i
        .ChartType = ctBox                              'Box and Whisker Plot
        .ChartStyle = csWhisker
        .DrawBox (False)                                'Draw it!
      END WITH

    CASE "HLC Style 1"
      'NOTE: If values for .Data.Cells 2, 3 and 4 are set equal,
      'Box routine will draw a Hi-Lo-Close antenna style graph
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Hi-Lo-Close Plot"            'change desired options
        .SubTitle.Text = "Antenna Style"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = False
        .XAxis.Tics = False
        .Data.ColCount = 8                             'Set .Data Grid dimensions
        .Data.RowCount = 5
        k = 10                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount                     'for each col
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of Each Col
          .Data.Cell(i , 1) = STR$(RND * k + 50)        'Hi Value
          .Data.Cell(i , 2) = STR$(RND * k + 37)        '<-- Set all Three to
          .Data.Cell(i , 3) = .Data.Cell(i , 2)         '<-- the mid or "Close"
          .Data.Cell(i , 4) = .Data.Cell(i , 2)         '<-- Value
          .Data.Cell(i , 5) = STR$(RND * k + 25)        'Lo Value
        NEXT i
        .ChartType = ctBox                              'Hi-Lo-Close Plot
        .ChartStyle = csHiLo
        .DrawBox (False)                                'Draw it!
      END WITH

    CASE "HLC Style 2"
      'NOTE: If values for .Data.Cells 1 & 2 and 4 & 5 are set equal,
      'Box routine will draw a Hi-Lo-Close box style graph
      WITH Graph
        .Initialize                                     'Set defaults
        .MainTitle.Text = "Hi-Lo-Close Plot"            'change desired options
        .SubTitle.Text = "Box Style"
        .XTitle.Text = "X Axis"
        .YTitle.Text = "Y Axis"
        .XAxis.Grid = False
        .XAxis.Tics = False
        .Data.ColCount = 8                              'Set .Data Grid dimensions
        .Data.RowCount = 5
        k = 10                                          'Load the data
        RANDOMIZE
        FOR i = 1 to .Data.ColCount                     'for each col
          .Data.Cell(i , 0) = "Group " + STR$(i)        'Legend in Row 0 of Each Col
          .Data.Cell(i , 1) = STR$(RND * k + 50)        'Hi Value
          .Data.Cell(i , 2) = .Data.Cell(i , 1)         '<-- Set = to Hi Value
          .Data.Cell(i , 3) = STR$(RND * k + 35)        'Close Value
          .Data.Cell(i , 4) = STR$(RND * k + 20)        'Lo Value
          .Data.Cell(i , 5) = .Data.Cell(i , 4)         '<-- Set = Lo Value
        NEXT i
        .ChartType = ctBox                              'Hi-Lo-Close Plot
        .ChartStyle = csWhisker                         'Whiskers are hidden :)
        .DrawBox (False)                                'Draw it!
      END WITH

    CASE "Redraw"
      WITH Graph
        .MainFont.Name =  "Times New Roman"              'Change some options
        .SubFont.Name =   "Times New Roman"              'on the currently defined chart
        .PlotAreaColr = .Colors(15)
        SELECT CASE .SubFont.Size
          CASE .MainFont.Size
            .SubFont.Size = 12
          CASE ELSE
            .SubFont.Size = .MainFont.Size
        END SELECT
        SELECT CASE .DoLegend
         CASE TRUE
           .DoLegend = False
         CASE FALSE
           .DoLegend = True
       END SELECT
       SELECT CASE .GreyScale
         CASE TRUE
           .GreyScale = False
         CASE FALSE
           .GreyScale = True
       END SELECT
       .RedrawChart                                     'and redraw the chart
     END WITH

    CASE "Clear"
      Graph.ClearBuffer                                 'Start with a clean slate
      Graph.ImagePaint                                  'Paint the blank Canvas

    CASE "Save"
      Graph.SaveChart ("")

    CASE "Print"
      Graph.PrintChart (Printer.PrinterIndex, poLandscape, 40, 1)

    CASE "Exit"
      Application.Terminate

  END SELECT

END SUB
'-------------------------------------------------------------------------------------------

SUB frmMainResize (SENDER AS QForm)

  WITH Graph
    .Width = frmMain.ClientWidth - btnClear.Width       'Calculate new sizes
    .Height = frmMain.ClientHeight
    .RedrawChart                                        'Redraw the QChart Object
  END WITH
  'Plus anything else that needs doing in your form resize

END SUB


QColorButton.inc

'QColorButton
'By Achilles B. Mina
'Uploaded 7/5/03

TYPE QCOLORBUTTON EXTENDS QPANEL
  SndFreq AS INTEGER
  SndDur AS SINGLE
  CONSTRUCTOR
    Height = 26
    Width = 26
    BevelInner = 2
    Color = &HEEEEEE
    Cursor = -21
  END CONSTRUCTOR
  EVENT OnMouseDown
    QCOLORBUTTON.BorderStyle = 1
    QCOLORBUTTON.Caption = " " + QCOLORBUTTON.Caption
    IF QCOLORBUTTON.SndFreq = 0 AND QCOLORBUTTON.SndDur = 0 THEN ' XP compatibles
  '    SOUND(5000,.5)
    ELSE
 '     SOUND(QCOLORBUTTON.SndFreq,QCOLORBUTTON.SndDur)
    END IF
  END EVENT
  EVENT OnMouseUp
    QCOLORBUTTON.BorderStyle = 0
    QCOLORBUTTON.Caption = QCOLORBUTTON.Caption - " "
  END EVENT
END TYPE

CREATE Form AS QFORM
  Center
  CREATE Fake AS QCOLORBUTTON
    Left = 40
    Top = 40
    'SndFreq = 500
    'SndDur = .5
    Caption = "A"
  END CREATE
END CREATE

Form.ShowModal


Documentation component by John Kelly

Documentation component by John Kelly QDEBUG

QDEBUG Component

QDEBUG is a self-contained form that is handy for debugging loops, and code without interrupting program flow. The component is included in RAPIDQ2.INC. Some of the original code is from Pete Kleinschmidt and Michael Zito. Written by John Kelly. Windows 32 only. Cannot make arrays of this object and it must be declared at the GLOBAL level.

QDEBUG Properties

Read/Write Default
Form QFORM You can reset the Debug form just like any other form:
Debug.Form.Width = 100
Debug.Form.Font = myQFont, etc. 		R/W
Visible LONG R/W True
Enabled LONG Determines if the form is
0 (or False) = fixed/read-only
1 (or True) = Debug window can be moved by user/closed etc. 		R/W True

QDEBUG Methods

Method | Type | Description | Params
Print | SUBI (...) | Print out standard variable types, and strings | infinite
Bug | SUB (Str AS STRING) | keep compatible with previous release | 1
PrintStr | SUB (Str AS STRING) | Print out a string or variable converted to string | 1
Err$ FUNCTION () AS STRING
 Uses the Windows GETLASTERROR API and formats it into a text message. CAREFUL, if your program doesn't create an error, it will report the previous error. 0
ErrNum | FUNCTION () AS DWORD | Returns the last Windows Error, if you want to see the code for Err$ | 0

QDEBUG Events

Event Type Occurs when... Params
None ...

QDEBUG Example

$TYPECHECK ON
$INCLUDE "RAPIDQ2.INC"
DECLARE SUB btnTestClick
DIM Debug AS QDEBUG         'Should declare as global
CREATE frmTest AS QFORM
Caption = "Debug Test Program"
Center
CREATE btnTest AS QBUTTON
Caption = "OK"
Top = 30
Left = 30
Height = 20
OnClick = btnTestClick
END CREATE
END CREATE

SUB btnTestClick
DIM I AS INTEGER
DIM J AS INTEGER
FOR J = 1 TO 3
FOR I = 1 TO 20
Debug.Print("Run ", I, " through Loop", J) 'send strings AND varaibles to debug object
' Debug.ErrNum
' Debug.Err$ 'default output to window
NEXT
NEXT
END SUB

frmTest.ShowModal
$ENDIF

 QDEBUG Example #2
'create an error
$INCLUDE "RAPIDQ2.INC"
DIM Debug AS QDEBUG 'Should declare as global
SetLastError ERROR_BAD_USERNAME
Showmessage "debug error = " + Debug.Err$ + " Err#"+str$(Debug.ErrNum)

Contents


QDir.htm

'
' ============================================================================
' QDIR   EXTENDED  COMPONENT            March 2004        By Jacques Philippe
'
' DOCUMENTATION       like      "DOS"   DIR   and   DIR /S            V 1.0.0
' ============================================================================
'
'    $INCLUDE  "QDir.Inc"          cut and paste this  **ON TOP** of your code
'
'    RAPIDQ dont like comments on line containing "\\" or "\", compiler reports
'    an error and there is none. Juste remove the comment and then it will works.
'
'    EXAMPLE 1
'    ---------
'    a simple QDIR.DIR searching matching files without searching in Sub directories
'       ' in directory c:/windows searches the "*.hlp" files, directory not wanted,
'       ' only files with Archive attribute set are accepted
'
'       ' ------ CODE_1 ------
'       Dim myDir As QDir
'       myDir.OnFileFound = OnFileFound_ShowFileParams   '(QDir FileFound Event)
'       myDir.Dir ("c:/windows/*.hlp", "D", "A") ' arg2 rejected, arg3 mustAttributes
'       Print "path    = ";myDir.path
'       Print "EXAMPLE 1          FINISHED"
'
'       ' QDir OnFileFound Event
'       ' ----------------------
'       Sub OnFileFound_ShowFileParams
'           Print myDir.path & myDir.FileName & "   " & myDir.Time & "  " _
'                                                          & myDir.dateAlphaEU
'           ' and 50+ other properties for each File Found
'       End sub
'       ' ------ END CODE_1 ------
'    EXAMPLE 2
'    ---------
'    a QDIR.DIRS searching matching files with search in all sub directories
'       ' Same Search as In Example 1 but in sub directories too
'
'       ' ------ CODE_2 ------
'       Dim myDir As QDir
'       myDir.OnFileFound = OnFileFound_ShowFileParams   '( FileFound Event)
'       myDir.Dirs ("c:/windows/*.Txt", "D", "A") ' arg2 rejected, arg3 mustAttributes
'       Print "EXAMPLE 2          FINISHED"
'
'       ' QDir OnFileFound Event
'       ' ----------------------
'       Sub OnFileFound_ShowFileParams
'           Print myDir.path & myDir.FileName & "   " & myDir.Time & "  " _
'                                                           & myDir.dateAlphaEU
'           ' and ?50 other properties for each file found
'       End sub
'       ' ------ END CODE_2 ------
'
'    Attributes are refered by their first letter : "A" for archive, "D" for direct
'        "S" for System, "H" for Hidden, "R" for Read only, ...
'    myDir.WithDotsDirs = False  ' to reject \. and \.. directories
'
' ---------------------------------------------------------------------------------
'
'    METHODS  part 1
'    -------
'    - DIR   :  File Search without Scanning The Sub Directories
'
'      QDir.Dir (pathfilter$, rejectedAttributes$, mustAttributes$)           a Sub
'
'    - DIRS  :  File Search with Scanning the Sub Directories
'               Dirs chosen to remember the Command Dir /s  ???

'      QDir.Dirs (pathfilter$, rejectedAttributes$, mustAttributes$)          a Sub
'
'    - ChangeFileAttributes (sPathFileName$ , sAttributesAsString$) As Long
'           documented further  (returns  0 or 1)
'    - ChangeFileDateAndTime ( ... ) As Long  '   Functioni
'      ChangeFileDateAndTime (pathFileName$, Year%, month%, day%, hour%, _
'                       minute%, second%, optionWhichTimes$) As Long
'           documented further  ( returns 0 or 1)
'
'    Comments about these four methods
'    ---------------------------------
'       - path may be relative or absolute
'          ie : dir2\myfile.Ext or c:\dir1\dir2\myfile.Ext
'       - relative path is relative to APPLICATION directory (where the .EXE is)
'       - in path "\" and "/" are accepted as separator
'       - filter may be any kind of filter using wild card  "*.Txt", "*name.Txt"
'       - attributes are passed as a String, elements of that string are :
'           "A" for Archive
'           "D" for Directory
'           "H" for Hidden
'           "N" for Normal
'           "R" for Read Only
'           "S" for System
'           "T" for Temporary
'           "C" for Compressed
'           "0" for No Attribute Set (?=N?)
'       - You can use multiple attributes in any order ie : "HTCA"
'       - an unknown attribute letter will be ignored.
'       - attributes are not case sensitive
'       - in rejectedAttributes$, if more than one attribute is rejected, all file
'         having one of these rejected attributes set is rejected from the search.
'       - in mustAttributes$, if more than one attibute is present, to be accepted
'         a file must have all these attributes set. ie : no file can match "0A"
'       - Dir and Dirs will only return when ALL the directory job has been done.
'         There is a DoEvents in each QDir Loop.
'       - Once a QDir.Dir or QDir.Dirs is Started, a busy flag forbids to start
'         another occurence of QDir.Dir or QDir.Dirs, until the first job is
'         finished. To start more than one QDir.Dir or QDir.Dirs simultneously,
'         you must DECLARE (DIM) two or more  Variables As QDIR.
'
' -----------------------------------------------------------------------------
'    PROPERIES
'    ---------
'    Once a Matching File Is Found, QDIR gathers, computes and stores a lot of
'    datas about that File.
'
'    PROPERTIES GROUPE 1
'    -------------------
'    Note
'    ----
'    Each file is stored on disk with three times : the CreationTime,
'    the lastAccessTime and the most commonly used the lasWriteTime
'
'    Name, Path, Size
'    ----------------
'    fileName As string          the name of the fileFound
'    dosFileName As string       the dos name of thefile found
'    path As String              the Absolute path to the file  ie : C:\myDir\otherDir\
'    pathFileName As string      the Absolute path + the fileName  ie : c:\Windows\system.dat
'    size As Double              the size as a double (use StrF$(size, ffFixed, 18, 0) to exp
'                                (ffNumber to have thousands separators)
'    WithDotsDirs As Long        Set to False, the "." and ".." are not returned
'    Attributes
'    ----------
'    attributes As Long             the attributes af the file (sum of attributes)
'    attributesAsString As String   the attributes transformed in a string "ADHNRSTC0"
'                          If Instr(myDir.AttributesAsString, "A") Then   ....
'    ' File Times
'    ' ----------
'    dateTime As Double          the lastWriteTime of the file as a double
'    time As String              the lastwriteTime of the file, format HH:MM:SS
'    timems As String            the lastWriteTime of the file + milliseconds, format HH:MM:SS,mmm
'    date As String              the lastWriteTime date, format MM/DD/YYYY
'    dateEU As String            the lastWriteTime date, EU foramt DD/MM/YYYY
'    dateAlpha As String         the lastWriteTime in alphanumeric format "mon dec 24 2001"
'    dateAlphaEU As string       the lastWriteTime in alphanumeric EU format "mon 24 dec 2001"
'    strDayOfWeek As string      the lastWriteTime Day Of The Week : "Mon", "Tue", "Wed", "Thu" ...
'    days(0 To 6) As String      the 7 names of the strDayOfWeek. Source for AlphaNumeric dates
'    strMonthOfYear As String    the lastWriteTime Month Of The Year : "Jan", "Feb", "Mar", "Apr" ...
'    months(1 To 12) As String   the 12 names of strMonthOfYear. Source for AlphaNumeric dates.

'    PROPERTIES GROUP 2
'    ------------------
'    All the informations available for lastWriteTime -and more- are available for lastAccessTime
'    and creationTime too, but not directly, you have to get them in their QDIR_SYSTEMTIME TYPE
'
'    Type QDIR_SYSTEMTIME
'        year As Short                 ' the year as a number
'        month As Short                ' the month as a number
'        dayOfWeek As Short            ' number of the day of the week  SUNDAY = 0, MONDAY = 1, ...
'        day As Short                  ' the day in the month  1, 2, 3,...  12, 13, 14, ... 28/30/31
'        hour As Short                 ' the hour as a number
'        minute As Short               ' the minute as a number
'        second As Short               ' the second as a number
'        milliseconds As Short         ' the milliseconds as a number
'        ' Extended                    ' as described in PROPERTIES GROUP 1
'        dateTime As Double            ' The DateTime As A Number
'        date As String * 10           ' Date as a String  mm/dd/yyyy
'        dateEU As String * 10         ' EU date Foramt dd/mm/yyyy
'        dateAlpha As String * 16      ' "ddd" "mmm" DD, yyyy
'        dateAlphaEU As String * 15    ' "ddd" DD "mmm" yyyy
'        time As String * 8            ' without ms  HH:MM:SS
'        timems As String * 12         ' Time As a String  HH:MM:SS.iii
'        strDayOfWeek As String * 3    ' day of the week as in Day(0 To 6) : "Mon", "Tue", "Wed", ... "Sun"
'        nWeekDay As String * 1        ' "0", "1", "2", ... "6"
'        strMonthOfYear As String * 3  ' day of the week as in Months(1 To 12) : "Jan", "Feb", ... "Dec"
'    End Type
'
'    creation As QDIR_SYSTEMTIME    ' the Type contaning informations about the creationTime
'    lastAccess As QDIR_SYSTEMTIME  ' the Type contaning informations about the lastAccessTime
'    lastWrite As QDIR_SYSTEMTIME   ' the Type contaning informations about the lastWriteTime
'
'    The File Time Properties decribed above for lastwriteTime may be found here for all three
'    File Times : ie
'    - QDir.Creation.dateAlphaEU
'    - QDir.lastAccess.dateEU     and even
'    - QDir.lastWrite.timems      (which is equal to QDir.timems)
'
'    These three time TYPES give access to 3 x 18 porpeties (=54), not used every day :)
'
'    To compare dates and times, use dateTime. The dateTimes are DOUBLE precision numbers
'    (64 bit Integer, converted here in DOUBLE) holding a date and time associated with
'    a file. That DOUBLE specifies the number of 100-nanosecond intervals which have
'    passed since January 1, 1601 (10,000,000 for each elapsed second since then).
' ---------------------------------------------------------------------------------
'
'    METHODS    part  2
'    -------
'    - ChangeFileDateAndTime As Integer    a   Functioni
'
'      SYNTAX :
'      ------
'          ChangeFileDateAndTime (pathFileName$, Year%, month%, day%, hour%, _
'                                               minute%, second%, optionWhichTimes$)
'      Return  0 (False) on Failure or 1 (True) on success
'
'      EXAMPLES :
'      --------
'      - ChangeFileDateAndTime ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33)
'           the LastWriteTime Of MyFile is set to June 21 st 1983 at 17:22:23
'
'      - ChangeFileAndDate ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33 "Access")
'           the LastAccessTime Of myFile is set to June 21 st 1983 at 17:22:23
'
'      - ChangeFileAndDate ("c:\myDir\myFile", 1983, 6, 21, 17, 22, 33 "ACCESS Write CREATION")
'           the LastAccessTime, CreationTime and LastWriteTime Of myFile are
'           set to June 21 st 1983 at 17:22:23
'
'           Used in the Event OnFileFound with Qdir.pathFilename can change the Date
'           and Time of all matching files.
'      DOC
'      ---
'       A File is Stored on Disk with Three Different Dates and Times Named :
'           - the creationTime
'           - the lastAccesstime
'           - the lastWriteTime   (the one mostly mostly used shown)
'
'       Six NUMERIC Parameters **MUST** be Passed to the Functioni :
'           - the First  is the YEAR   of the new Date Time For the File
'           - the Second is the MONTH  of the new Date Time For the File
'           - the Third  is the DAY    of the new Date Time For the File
'           - the Fourth is the HOUR   of the new Date Time For the File
'           - the Fifth  is the MINUTE of the new Date Time For the File
'           - the Sixth  is the SECOND of the new Date Time For the File'
'
'       The FILENAME With or Without a Path must be Passed as a STRING !
'
'       The optionWhichTimes Parameter is a STRING that Indicates to the Functioni
'           which file Times must be Changed. If that String contains :
'           - "CREATION" the creationTime   will be Changed ("CRE" is enough)
'           - "ACCESS"   the lastAccessTime will be changed ("ACC" is enough)
'           - "WRITE"    the lastWriteTime  will be changed ("WRI" is enough)
'           Not case sensitive
'           If that string is not Passed or is Empty, the lastWriteTime only will
'           be changed
'
'       ERROR : on error a ShowMessage is POPED UP and the Functioni Returns 0 (False)
'
' ----------------------------------------------------------------------------
'
'    - ChangeFileAttributes (pathFilename$ As String, Attributes As String) As Integer
'
'       - attributes are passed as a String, elements of that string are :
'           "A" for Archive
'           "D" for Directory
'           "H" for Hidden
'           "N" for Normal
'           "R" for Read Only
'           "S" for System
'           "T" for Temporary
'           "C" for Compressed
'           "0" for No Attribute Set (?=N?)
'
'      EXAMPLE :
'      -------
'        ChangeFileAttributes ("c:\myDir\myFile","AR")
'           the attributes of myFile are set to Archive and ReadOnly
'
'       The function returns  1 (True)  if attributes have been changed and 0 if
'       an error has occured.
'
'       Used in the Event OnFileFound with Qdir.pathFilename can change the
'       attributes of all matching files.
'
' ----------------------------------------------------------------------------
'


Appendix A: QDOCKFORM

Rapid-Q Documentation by William Yu (c)1999-2000 - Additional by Ben Laws (c) 2004 Appendix A: QDOCKFORM

DOCKFORM Component

QDockForm is a similar to QForm, however there is one main difference... This one can dock. It is more a QPanel when it is docked (which is what this type extends). Basically, you place this component (better using 'align') on the main form. You will only be able to dock this form in its original location, and using the style property you can tell it to dock wherever it's opposite to, or a location of your choice.

Do not use this as your main form - it will not work because this type was derived from QPANEL (And obviously you can't use QPANEL as a main form)
Also, (almost) all unused properties, methods and events have been disabled for the main panel, so you wouldn't even know it was a panel.

This component is unlikely to work on anything other than Windows

QDockForm Properties
Field | Type | Read/Write | Default Value
Align | INTEGER | RW | 3
You should use this property over the left and top properties
AltAlign | INTEGER | RW | 0
If 'style' is 1 then specify the alignment of the second location the form can dock at. If AltAlign is 0 then by default, the opposite alignment of the original position is used
(e.g. original = top, alternative = bottom)
AltDock | INTEGER | R | 0
Returns TRUE if the form is docked in the alternative position, otherwise FALSE
AltPanel.Parent | QFORM | RW | This
This must be set to where you would like your form's alternative docking location to be.
CanClose | INTEGER | RW | False
TRUE if the form can close (has a close button at the top right), otherwise FALSE
Canvas | QCANVAS | RW
Use for drawing on the panel - use with the OnPaint event
Caption | STRING | RW
Caption is the text that appears as the title of your dockable form. It will only appear depending on the docked and undocked styles you use
Client | QPANEL | RW
You should always use this panel for placing components inside the form.
e.g.
    ...
    CREATE Properties AS QDOCKFORM
        ...
        CREATE PropertiesGrid AS QSTRINGGRID
            Parent = Properties.Client        'This is where you set the parent to be the properties client panel
        END CREATE
    END CREATE
You can also change the panel, like a regular QPANEL
Closed | INTEGER | R | False
Returns TRUE if the form is closed, otherwise False
Docked | INTEGER | R | True
Returns TRUE if the form is currently docked. The form is always docked on creation
DockStyle | INTEGER | RW | 0
Changes the appearance of the form.
Use styles 0 to 6, and 10. 7 to 9 are not used. They are for making your own toolbar styles. Anything past 10 is for making regular styles
This style is seen when the form is docked
DragCursor | INTEGER | RW | -21
The cursor to be displayed when it is over the draggable section of the form
Font | QFONT | W
Height | INTEGER | RW
Get or set the form's vertical size (in pixels). You should use align instead
Left | INTEGER | RW | 0
Specifies the left edge of the form relative to the desktop screen. You should use align instead
Locked | INTEGER | RW | False
Set to TRUE if the form is locked in its current docking position (i.e. cannot be moved), otherwise FALSE. Locking the form when it is not docked will result in the form not being able to move.
Parent | QFORM | W
Sizeable | INTEGER | RW | False
Specifies whether the form can be resized or not when undocked.
Using this is not advisable as there is no way of setting the minimum size of the form - yet.
ST1_TitleBackground | INTEGER | RW | 0
Color of the form's caption background for DockStyle 1 and UndockStyle 1
Style | INTEGER | RW | 0
0 = The form will dock only where it is placed
1 = The form will dock where it is placed, and in another location specified by 'AltAlign'
TitleColor | INTEGER | RW | 0
Color of the form's caption text (if any)
Top | INTEGER | RW | 0
UndockedForm.Handle | INTEGER | R
Get the form's handle for WinAPI calls.
UndockedForm.Parent | INTEGER | W | This
Set the parent when undocked
UndockedHeight | INTEGER | RW | 400
Height of form when undocked - overridden when sized.
UndockedWidth | INTEGER | RW | 170
UndockStyle | INTEGER | RW | 0
Changes the appearance of the form.
Use styles 1 to 5, and 10. 6 to 9 are not used. They are for making your own toolbar styles. Anything past 10 is for making regular styles
This style is seen when the form is undocked
Width | INTEGER | RW | 320
Visible | INTEGER | RW
Do not use when the form is undocked

QDockForm Methods
Method | Type | Description | Params
Close | SUB | Close the form | 0
Dock SUB (Dock AS INTEGER) 0 = Undock
1 = Dock at original position
2 = Dock at alternative (or original if not possible)

This method is also used to show a closed form. 		1

QDockForm Events
Event | Type | Occurs when... | Params
OnDock | SUB (Docked AS INTEGER, Alt AS INTEGER) | 'Docked' is true if the form was docked, otherwise false. 'Alt' is true if it was docked in the alternative location | 2
OnPaint | VOID | Form requires repainting. Use Canvas for drawing | 0
OnClose | VOID | Form is closing | 0

QDockForm Examples
$INCLUDE "QDOCKFORM.inc"

DECLARE SUB SortStatusBar (Docked AS INTEGER, Alt AS INTEGER)
DECLARE SUB AddText
DECLARE SUB DockLeft
DECLARE SUB DockRight
DECLARE SUB Undock
DECLARE SUB Selected
DECLARE SUB ShowForm
DECLARE SUB FormClosed

CREATE Form AS QFORM
    Width = 640
    Height = 480
    Center
    Caption = "Docking windows example"
    CREATE MainEdit AS QRICHEDIT
        Align = 5
        Visible = 1
    END CREATE
    CREATE EventsPanel AS QDOCKFORM
        UndockedForm.Parent = Form
        Align = 4
        DockStyle = 10
        UndockedWidth = EventsPanel.Width
        AltPanel.Parent = Form
        Style = 1
        Caption = "Events - Locked"
        Client.BevelOuter = 0
        Canvas.Font.Name = "Tahoma"
        Locked = 1
        CREATE StringGrid AS QSTRINGGRID
            Parent = EventsPanel.Client
            Align = 5
            ColCount = 2
            ColWidths(0) = EventsPanel.Client.Width / 2
            ColWidths(1) = EventsPanel.Client.Width / 2
            RowCount = 10
        END CREATE
    END CREATE
    CREATE ProjPanel AS QDOCKFORM
        AltPanel.Parent = Form
        'AltAlign = 4
        UndockedForm.Parent = Form
        Caption = "Project"
        Align = 3
        DockStyle = 1
        UnDockStyle = 1
        Style = 1
        Client.BevelOuter = 0
        Canvas.Font.Name = "Tahoma"
        UndockedWidth = ProjPanel.Width
        CanClose = 1
        OnClose = FormClosed
        CREATE ComponentsPanel AS QPANEL
            Parent = ProjPanel.Client
            Align = 5
            CREATE AddTextButton AS QBUTTON
                Left = 50
                Top = 150
                Caption = "Add Text"
                OnClick = AddText
            END CREATE
            CREATE DockLeftButton AS QBUTTON
                Top = 30
                Width = 70
                Left = 10
                Caption = "Dock Left"
                OnClick = DockLeft
            END CREATE
            CREATE DockRightButton AS QBUTTON
                Top = 30
                Width = 70
                Left = ComponentsPanel.Width - DockRightButton.Width - 20
                Caption = "Dock Right"
                OnClick = DockRight
            END CREATE
            CREATE UndockButton AS QBUTTON
                Left = (ComponentsPanel.Width - UndockButton.Width) / 2 - 10
                Top = 70
                Caption = "Undock"
                OnClick = Undock
            END CREATE
        END CREATE
    END CREATE
    CREATE ToolbarBox AS QDOCKFORM
        UndockedForm.Parent = Form
        Align = 1
        Height = 31
        DockStyle = 6
        UnDockStyle = 6
        UndockedWidth = 600
        UndockedHeight = 55
        AltPanel.Parent = Form
        Style = 1
        Caption = "Toolbar Example"
        CREATE Label AS QLABEL
            Parent = ToolbarBox.Client
            Caption = "Select a style:"
            Autosize = 1
            Top = 5
        END CREATE
        CREATE List AS QCOMBOBOX
            Parent = ToolbarBox.Client
            Left = 90
            Top = 2
            AddItems("0  - Striped","1  - Office XP","2  - Grips","3  - Striped (toolbar)","4  - Grips (toolbar)","5  - 3D (toolbar)","6  - Striped Horizontal (toolbar)","10 - Regular")
            ItemIndex = 1
            OnChange = Selected
        END CREATE
        CREATE ShowButton AS QBUTTON
            Parent = ToolbarBox.Client
            Top = 0
            Left = 290
            Caption = "Show Form"
            Enabled = 0
            OnClick = ShowForm
        END CREATE
    END CREATE
    CREATE StatusBarBox AS QDOCKFORM
        UndockedForm.Parent = Form
        Align = 2
        Height = 25
        DockStyle = 6
        UnDockStyle = 6
        UndockedWidth = 600
        UndockedHeight = 49
        AltPanel.Parent = Form
        Style = 1
        OnDock = SortStatusBar
        Caption = "Status Bar"
        CREATE SB AS QSTATUSBAR
            Parent = StatusBarBox.Client
            Align = 5
            SizeGrip = 0
            AddPanels("This Statusbar can be moved!", "I'm Docked at the Bottom!")
            Panel(0).Width = 160
        END CREATE
    END CREATE
END CREATE

Form.ShowModal

SUB SortStatusBar (Docked AS INTEGER, Alt AS INTEGER)
    IF Docked = 0 THEN
        SB.Panel(1).Caption = "I'm Not Docked Anywhere!"
        EXIT SUB
    END IF
    IF Docked = 1 THEN
        SB.Panel(1).Caption = "I'm Docked at the " + IIF(Alt = 1, "Top", "Bottom")
    END IF
END SUB

SUB AddText
    MainEdit.AddString("You just added some text")
END SUB

SUB DockLeft
    ProjPanel.Dock(1)
END SUB

SUB DockRight
    ProjPanel.Dock(2)
END SUB

SUB Undock
    ProjPanel.Dock(0)
END SUB

SUB Selected
    ProjPanel.DockStyle = VAL(LEFT$(List.Item(List.ItemIndex), 2))
    ProjPanel.UnDockStyle = VAL(LEFT$(List.Item(List.ItemIndex), 2))
    ProjPanel.Canvas.Repaint
END SUB

SUB ShowForm
    ShowButton.Enabled = 0
    ProjPanel.Dock(ProjPanel.AltDock + 1)

END SUB

SUB FormClosed
    ShowButton.Enabled = 1
END SUB
1


Documentation by John Kelly

Documentation by John Kelly QFILEDIALOG

QFILEDIALOG Component

This is a new custom component in RAPIDQ2.INC. Creates an Open or Save Dialog box that is set by Mode property. The dialog box is sizeable and allows selection of multiple files. If you use it to save a file it will ask if you want to overwrite the existing file. There will be icons for quick links to the desktop, network locations, and myDocuments folder. Windows 32 only. Cannot make arrays of this object and must be declared at the GLOBAL level.

QFileDialog Properties
Field | Type | R/W | Default
Caption | STRING | RW | "Open"
DefaultExt STRING
Default extension that will be automatically added to filename if user doesn't include it. 		RW
FileName | STRING Returns file name with path information | RW
FileTitle | STRING Returns the file name without path information | R
Files() | Array of STRING If Mode = fdOpen,and MultiSelect = True,then the array has a list of selected files. Files(0) is the directory, Files(1) is the first file name without the path | RW | All Files|*.*
Filter | STRING | RW | All Files|*.*
FilterIndex | INTEGER 1st index is 0 | RW | 1
InitialDir | STRING | RW
Mode INTEGER sets whether the dialog box will be an Open dialog or Save.
Valid arguments:
fdOpen = 0
fdSave = 1 		RW fdOpen
MultiSelect | INTEGER If set to true and Mode = fdOpen, then the user can select up to 256 files | RW | False
NoChangeDir | INTEGER If set to true the QFileDialog will not change the current directory | RW | False
Parent | LONG This is the parent form handle, can be null | RW | Null
SelCount INTEGER
Number of files the user selected when Multiselect = true 		R 0
WarnIfOverWrite INTEGER
Flag for warning if you want to overwrite the file when mode is fdSave 		RW True

QFileDialog Methods

Method | Type | Description | Params
Execute | FUNCTION | Returns TRUE (user picked files) or FALSE (user picked Cancel) | 0

QFileDialog Examples

$INCLUDE "RapidQ2.inc"
DIM i as integer
DIM fDialog as qfiledialog
fDialog.Caption = "QfileDialog test"
fDialog.FileName= "test.txt"
fDialog.InitialDir = "C:\RapidQ"
fDialog.MultiSelect = 1
IF fDialog.Execute THEN
  IF fDialog.MultiSelect THEN
     for i = 0 to fDialog.SelCount
        ShowMessage fDialog.Files(i)	'item #0 is the directory
     next i
  ELSE
     ShowMessage "file name & path =" + fDialog.FileName
     ShowMessage "file name no path =" + fDialog.FileTitle
  END IF
END IF


Appendix A: QFileListView

Documentation component by D.Glodt (c)2003

Appendix A: QFileListView

QFileListView Component

QFileListView is a component inherited from component QListView.
This component has columns for name , size, file type and date with
associated icon for each file type.

QFileListView Properties

Field | Type | R/W | Default
Filename | STRING | R |
 | File name selected. |  |
ColumnCaption | ARRAY(4) OF STRING | R/W |
 | Column label index 1=label file name index 2=label size index 3=label type index 4=label date |  |
Directory | STRING | R/W |
 | Directory name. |  |
Mask | STRING | R/W | *.*
 | File type to view. |  |

QFileListView Methods

Method | Type | Description | Params
Refresh | SUB | Refresh file list | 0
SetFocus | SUB | Set focus on file list | 0

QFileListView Event

Event | Type | Occurs when... | Params
OnFileSelect | (FileName as string) | On enter keypress or double click, parameter FileName is the file name selected. | 1
OnFileChange | (FileName as string) | On selected change in the list, parameter FileName is the file name selected. | 1

QFileListView Example
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$INCLUDE "Object\QFileListView.inc"

declare sub DirListFileSelect(file as string)
declare sub ChangeDirectory

CREATE Form AS QFORM
 Width=500
Height=300
Center
Caption="Exploreur"
CREATE Splitter1 AS QSPLITTER
 Align=alLeft
width=5
END CREATE
 CREATE DirTree AS QDirTree
 InitialDir=CURDIR$
 Align=alLeft
Width=200
OnChange=ChangeDirectory
END CREATE
 create DirList as QFileListView
 Align=alClient
width=200
ViewStyle=vsReport
OnFileSelect= DirListFileSelect
ColumnCaption(1)="Name" 'Label column
 ColumnCaption(2)="Size"
ColumnCaption(3)="Type"
ColumnCaption(4)="Modified"
Mask="*.*"
end create
end create

Form.ShowModal

sub DirListFileSelect(file as string)
ShowMessage("File"+File+" was selected.")
end sub

SUB ChangeDirectory
DirList.Directory =DirTree.Directory
END SUB


QFtpClient.htm

' ============================================================================
' QFTPCLIENT              EXTENDED  COMPONENT              By Jacques Philippe
'
' HTML DOCUMENTATION                               Version February 12th, 2003
' ============================================================================
'
'   INCLUDE :    $INCLUDE "QFTPCLIENT.INC"
'   -------
'
'   DIM :        DIM myFtp As QFtpClient
'   ---
'
'   METHODS :    DIRECTORY :  GetDir, MkDir, SetDir, RemoveDir,
'   -------           FILE :  PutFile, GetFile, Rename, Delete
'                     FIND :  FindFirstFile, FindNextFile
'                    OTHER :  ReadMessage
'
'   PROPERTIES :   GENERAL :  ErrorMsg, Agent
'   ----------   FILE_FIND :  FileName, FileSize, FileTime, FileDate, FileAttributes
'                             FileAttributesAsString
'
' =============================================================================
'
'   Examples Assume    $ECAPECHARS ON
'
'   EXAMPLES 1    no FTP directory scanning, just PutFile, GetFile
'   --------
'       Dim myFtp As QFtpClient
'       myFtp.Connect ("www.bigftp.com", "Zorro_007", "TopSecretPw")
'           myFtp.PutFile ("c:\\MyDir\\myFile.lkj", "d:\\hostDir\\newName.lkj")
'           myFtp.GetFile ("d:\\hostFir\\newName.lkj", "C:\\myDir\\newFile.lkj", True)
'       myFtp.Close
'
'   ' Note : Relative and absolute path are allowed
'
'   EXAMPLE 2     FTP scanning a Directory
'   ---------
'       Dim myFtp As QFtpClient
'       With myFtp
'          DefStr sFile
'          .Connect ("www.bigftp.com", "Zorro_007", "TopSecretPw")
'               sFile = .FindFirstFile ("c:\\ExistingDirAtRemoteHost\\*.bas")
'               While sFile <> ""
'                   If Instr(.fileAttributesAsString, "D") = 0 Then  ' reject directories
'                       Print "FileName : ";.fileName
'                       Print "                 Dos FileName : ";.dosFileName
'                       Print "                    File Size : ";.fileSize
'                       Print "                    File Date : ";.fileDate
'                       Print "                    File Time : ";.fileTime
'                       Print "               File Attributes: ";.fileAttributes
'                       Print "    File Attributes As String : ";.fileAttributesAsString
'                   End If
'                   sFile = .FindNextFile
'               Wend
'               Print "End Of Directory"
'           .Close
'       End With
'
'
'   EXAMPLE 3   Tracking Errors and FTP Scanning a Directory
'   ---------
'       Dim myFtp As QFtpClient
'       With myFtp
'           DefStr sFile
'           If .Connect ("www.bigftp.com", "Zorro_007", "TopSecretPw") Then
'               sFile = .FindFirstFile ("c:\\ExistingDirAtRemoteHost\\*.bas")
'               While sFile <> ""
'                   If Instr(.fileAttributesAsString, "D") = 0 Then  ' reject directories
'                       Print "FileName : ";.fileName
'                       Print "                 Dos FileName : ";.dosFileName
'                       Print "                    File Size : ";.fileSize
'                       Print "                    File Date : ";.fileDate
'                       Print "                    File Time : ";.fileTime
'                       Print "               File Attributes: ";.fileAttributes
'                       Print "    File Attributes As String : ";.fileAttributesAsString
'                   End If
'                   sFile = .FindNextFile
'               Wend
'               Print .errorMsg
'               Print "End Of Directory"
'           .Close
'           Else
'               Print .errorMsg
'               .Close
'           End If
'       End With
'
'
'   EXAMPLE 4  Using FTP Prompt Messages To Monitor Communication
'   ---------
'       Dim myFtp As QFtpClient
'       With myFtp
'           DefStr sFile
'           If .Connect ("www.bigftp.com", "Zorro_007", "TopSecretPw") Then
'               Print .ReadMessage
'               Sleep 1
'               sFile = .FindFirstFile ("c:\\ExistingDirAtRemoteHost\\*.bas")
'               While sFile <> ""
'                   If Instr(.fileAttributesAsString, "D") = 0 Then  ' reject directories
'                       Print "FileName : ";.fileName
'                       Print "                 Dos FileName : ";.dosFileName
'                       Print "                    File Size : ";.fileSize
'                       Print "                    File Date : ";.fileDate
'                       Print "                    File Time : ";.fileTime
'                       Print "               File Attributes: ";.fileAttributes
'                       Print "    File Attributes As String : ";.fileAttributesAsString
'                       Sleep 1
'                   End If
'                   sFile = .FindNextFile
'               Wend
'               Print .ReadMessage
'               Print "End Of Directory"
'               .Close
'           Else
'               Print .ReadMessage
'           End If
'       End With
'
' =============================================================================
'
'   METHODS  detailed
'   -------
'
'   - Function CONNECT (remoteServer$, login$, password$) As Long
'                Returns a valid handle to the FTP session if the connection is
'                successfull, or NULL otherwise.
'
'   - Function GETDIR As String
'                Returns the current Directory at Remote Host
'
'   - Function MAKEDIR (newDirectory As String) As Long
'                Create A New Directory At Remote Host
'                Overwrite = Error
'                Return True/False
'
'   - Function SETDIR (newDirectory As String) As Long
'               Set, Change Directory at Remote Host
'               Return True/False
'
'   - Function REMOVEDIR (delDirectory As String) As Long
'               Delete a Directory at Remote Host
'               Return True/False
'
'   - Function PUTFILE (localFileName$, remoteFileName$) As Long
'               Upload, Copy a File from Local Host To Remote Host
'               Relative and Absolute Path are allowed
'               Return True/False
'
'   - Function GETFILE (remoteFileName$, localFileName$, flagOverwrite%) As Long
'               DownLoad, Copy a File from Remote Host to Local Host
'               Relative and Absolute Path are allowed
'               Return True/False
'
'   - Function RENAME (oldName as String, newName as String) as Long
'               Rename a File at Remote Host
'               Return True/False
'
'   - Function DELETE (remoteFileName As String) As Long
'               Delete a file at Remote Host
'               Return True/False
'
'   - Function FINDFIRSTFILE (filter As String) As String
'               Search the First File Matching the filter in Remote Host Current
'               Directory. Return the filename or an Empty string if no matching
'               File is found. To be used with FINDNEXTFILE.
'
'   - Function FINDNEXTFILE As String
'               Search the Next File matching the filter (set in FINDFIRSTFILE)
'               in the Remote Host Directory. Return the filename or an Empty
'               String if no file match the filter anymore.
'
'   - Function READMESSAGE As String
'               returns an the FTP Message generated by the remote server or
'               ?local API call? (some kind of ftp monitoring)
'
'   - Function CLOSE As Long
'               ****  The FTP Session must be Closed !  ****
'               returns 1 if both FTP SESSION and "ALL" have Been Closed
'
' =============================================================================
'   PROPERTIES I    detailled
'   ------------
'     UseFull Properties General
'     --------------------------
'      -  ERRORMSG As String       report string after each Method Call    Read Only
'      -  AGENT As String          default : "FTP Object for RAPIDQ"
'
'     Usefull Properties Updated By FindFirstFile and FindNextFile
'     ------------------------------------------------------------
'      -  FILENAME As string
'      -  DOSFILENAME As string
'      -  FILESIZE As Double
'      -  FILEDATE As String       Format  MM/DD/YYYY   US Format
'      -  FILEDATEEU As String     Format  DD/MM/YYYY   European Format
'      -  FILETIMEMS As String     Format  HH:MM:SS.mmm  (mmm = milliseconds)
'      -  FILETIME As String       Format  HH:MM:SS
'      -  FILEDATETIME As Double   DateTime in 1/100 seconds since ??1-1-1900??
'                           use this to sort by datetime
'      -  fileAttributes As Long   Combination of Set Attributes As Attribute
'                           Contantes Show Here Under.
'      -  fileAttributesAsString As String   "ADHNRSTC" if all the file attributes
'                           are set
'
' =============================================================================
'   PROPERTIES II
'   -------------
'     Less UseFull Properties (harder to Use :)
'     -----------------------
'     General Properties
'     ------------------
'      - ftpHandle As Long     the handle of the FTP Socket              Read Only
'      - errorMsg As String    report string after each function call    Read Only
'
'     Open Properties      see the doc of API "InternetOpen" at ??www.allapi.net
'     ---------------      dont really know either :)
'      - Agent As String         default : "FTP Object for RAPIDQ"
'      - OpenType As Long        default : CONST INTERNET_OPEN_TYPE_PRECONFIG
'      - ProxyName As String     default : ""
'      - ProxyByPass As String   default : ""
'      - Open_dwFlags As Long    default : 0
'
'     Connect Properties   see the doc of API "InternetConnect" at ??www.allapi.net
'     ------------------   dont really know either :)
'      - FtpPort As Long            default : CONST INTERNET_DEFAULT_FTP_PORT
'      - InternetService As Long    default : CONST INTERNET_SERVICE_FTP
'      - InternetFlag As Long       a function of Internet Service (computed in code)
'      - Connect_dwContext As Long  default : 0
'
'     PutFile Properties       see the doc of API "FtpPutFile" at ??www.allapi.net
'     ------------------       dont really know either :)
'      -  FtpTransferType As Long   default : CONST FTP_TRANSFER_TYPE_UNKNOWN
'      -  Put_dwContext As Long     default : 0
'
'     GetFile Properties       see the doc of API "FtpGetFile" at ??www.allapi.net
'     ------------------       dont really know either :)
'      -  FlagsAndAttributes As Long      default : 0
'      -  Get_dwContext As Long           default : 0
'
'     FindFirstFile & FindNextFile Properties  see the API docs at ??www.allapi.net
'     ---------------------------------------
'      -  findfirst_dwFlags As Long       default : 0    API FindFirstFile
'      -  findFirst_dwContext As Long     default : 0    API FindFirstFile
'      -  WIN32_FIND_DATA As QFTP_WIN32_FIND_DATA      the WIN32 File Structure
'           Type QFTP_FILETIME
'               LowDateTime As Long
'               HighDateTime As Long
'           End Type
'
'           Type QFTP_WIN32_FIND_DATA             ' variables about the last find file
'               FileAttributes As Long         ' See CONSTANTES here under
'               'ftCreationTime As FILETIME    ' replaced by (1) & (2)
'               'ftLastAccessTime As FILETIME  ' replaced by (3) & (4)
'               'ftLastWriteTime As FILETIME   ' replaced by (5) & (6)
'               'RAPIDQ BUGS WITH NESTED TYPES so REPLACED BY The Six Following Lines
'               CreationTimeLow As Long        ' (1) low dw = unsigned long
'               CreationTimeHigh As Long       ' (2) high dw = unsigned long
'               LastAccessTimeLow As Long      ' (3) low dw = unsigned long
'               LastAccessTimeHigh As Long     ' (4) high dw = unsigned long
'               LastWriteTimeLow As Long       ' (5) low dw = unsigned long
'               LastWriteTimeHigh As Long      ' (6) high dw = unsigned long
'               nFileSizeHigh As Long          ' low dw = unsigned long
'               nFileSizeLow As Long           ' high dw = unsigned long
'               dwReserved0 As Long
'               dwReserved1 As Long
'               cFileName As String * xxFTP_MAX_PATH  ' The FileName
'               cAlternate As String * 14             ' The Dos FileName
'           End Type
'
'           Const QFTP_FILE_ATTRIBUTE_ARCHIVE = &H20        ' "A"
'           Const QFTP_FILE_ATTRIBUTE_DIRECTORY = &H10      ' "D"
'           Const QFTP_FILE_ATTRIBUTE_HIDDEN = &H2          ' "H"
'           Const QFTP_FILE_ATTRIBUTE_NORMAL = &H80         ' "N"
'           Const QFTP_FILE_ATTRIBUTE_READONLY = &H1        ' "R"
'           Const QFTP_FILE_ATTRIBUTE_SYSTEM = &H4          ' "S"
'           Const QFTP_FILE_ATTRIBUTE_TEMPORARY = &H100     ' "T"
'           Const QFTP_FILE_ATTRIBUTE_COMPRESSED = &H800    ' "C"
'
'      -  hFind As Long   the Handle used by the FindFirstFile And FindNextFile
'                         allows recursive FIND in sub directory too (=work)
'
' =============================================================================


QFuncLib.inc

'===============================================
' Functions library
'===============================================
Const PI=acos(-1)

'===============================================
' Return the short name of file
'===============================================
Function GetFileName(file as string) as string
 result=RIGHT$(file,Len(file)-RINSTR(file,"\"))
End Function

'===============================================
' Return the path name of file
'===============================================
Function GetPathName(file as string) as string
  result=LEFT$(file,RINSTR(file,"\")-1)
End Function

'===============================================
' Return the extension of file
'===============================================
Function GetFileExt(file as string) as string
  result=RIGHT$(file,Len(file)-RINSTR(file,"."))
End Function

'===============================================
' Return the n word in a string expression
'===============================================
Function Word$(s as string,index as integer) as string
  dim stemp as string
  dim i as integer
  dim flagSpace as integer

  stemp=""
  for i=1 to len(s)
    if mid$(s,i,1)<>space$(1) then
      stemp=stemp+mid$(s,i,1)
      flagSpace=0
    else
      if flagSpace=0 then stemp=stemp+space$(1)
      flagSpace=1
    end if
  next i
  stemp=ltrim$(rtrim$(stemp))
  result=Field$(stemp," ",index)
End Function

'==================================================
' Return the number of word in a string
'==================================================
function GetWordCount(s as String) as integer
  dim flagStop as integer
  dim counter as integer

  counter=1
  flagStop=0
  while flagStop=0
    if Word$(s,counter)<>"" then
      counter=counter+1
    else
      flagStop=1
    end if
  wend
  result=counter-1
end function

'====================================================
' Return a string with remove char
'====================================================
function RemoveChar$(s as string,char as string) as string
  dim source as string

  if s<>"" then
    source=s
    while instr(source,char)<>0
      source=left$(source,instr(source,char)-1)+mid$(source,instr(source,char)+len(char))
    wend
    result=source
  end if
end function

'====================================================
' Return a string without space to start and to end
'====================================================
Function Trim$(s as string) as string
  Result=LTRIM$(RTRIM$(s))
End Function

'======================================================
' Return ratio
'======================================================
function Ratio(Value1 as double,Value2 as double) as double
  Result=((Value1-Value2)*100)/Value1
end function

'========================================
' Return radian value
'========================================
function GetRadian(degrees as double) as double
  Result=degrees*(Pi/180)
end function

'==========================================
' Return degrees value
'==========================================
function GetDegrees(radian as double) as double
  Result=radian*(180/Pi)
end function

'===================================
' Return distance
'===================================
function Distance(x as double,y as double) as double
  Result=SQR(x^2+y^2)
end function

'===================================
' Return surface
'===================================
function Surface(Width as double,Height as double) as double
  Result=Width*Height
end function

'===================================
' Return blue value of color
'===================================
function GetBlue(Color as long) as long
    Result=int(Color/65536)
end function

'===================================
' Return red value of color
'===================================
function GetRed(Color as long) as long
    dim blue as long
    dim green as long

    blue=int(Color/65536)
    green=int((Color-(blue*65536))/256)
    Result=int(Color-(blue*65536)-(green*256))
end function

'===================================
' Return green value of color
'===================================
function GetGreen(Color as long) as long
    dim blue as long

    blue=int(Color/65536)
    Result=int((Color-(blue*65536))/256)
end function

'==========================================
' Return Dec from bin
'==========================================
function BinToDec(bin as string)as long
  dim bit as integer
  dim i as integer
  dim value as integer

  bin=REVERSE$(bin)
  bit=1
  value=0
  for i=1 to len(bin)
    if mid$(bin,i,1)="1" then value=value+bit
    bit=bit*2
  next i
  result=value
end function

'=============================================
' Return Dec from hex
'=============================================
function HexToDec(hex as string)as long
  dim bit as long
  dim valbit as integer
  dim i as integer
  dim value as integer

  hex=REVERSE$(hex)
  bit=1
  value=0
  for i=1 to len(hex)
    if mid$(hex,i,1)="A" then
      value=value+(10*bit)
    elseif mid$(hex,i,1)="B" then
      value=value+(11*bit)
    elseif mid$(hex,i,1)="C" then
      value=value+(12*bit)
    elseif mid$(hex,i,1)="D" then
      value=value+(13*bit)
    elseif mid$(hex,i,1)="E" then
      value=value+(14*bit)
    elseif mid$(hex,i,1)="F" then
      value=value+(15*bit)
    else
      value=value+(val(mid$(hex,i,1))*bit)
    end if
    if (bit*16)<2147483647 then bit=bit*16
  next i
  result=value
end function


Appendix A: QImageBox

Documentation component by D.Glodt (c)2004

Appendix A: QImageBox

QImageBox Component

QImageBox is a component used to view image file.
This component use the dll NVIEWLIB to view the files type jig,gif,jpg,pcx,tga,dib,rle ,if this dll is not
present in system or in your application directory , only types bmp,ico,cur,ani will be
view.

QImageBox Properties
Field | Type | R/W | Default
Progress | BOOLEAN | R/W | FALSE
 | Show progress bar for image type from dll NVIEWLIB |  |
FileName | STRING | R/W |
 | File name selected with full path |  |
ImgWidth | INTEGER | R |
 | Image width |  |
ImgHeight | INTEGER | R |
 | Image height |  |
Language | STRING | R/W |
 | Langage for dll. (French,English,German,Dutch,Portuguese,Spanish,Japanese,Italian) |  |

QImageBox Methods

Method | Type | Description | Params

QImageBox Events

Event | Type | Occurs when... | Params

QImageBox Example
$TypeCheck On
$Include "rapidq.inc"
$Include "Object\QImageBox.inc"

declare Sub FileSelect

CREATE Form ASQFORM
Caption = "Image Viewer"
Width=300
Height=300
Center
CREATE image ASQImageBox
Language="french"
color=clAppWorkSpace
Progress=true
Align=AlClient
width=200
END CREATE
CREATE btSelect AS QBUTTON
Align=AlBottom
Caption="&Select image"
OnClick=FileSelect
END CREATE
END CREATE
Form.ShowModal

Sub FileSelect
dim OpenDlg asQOpenDialog

OpenDlg.filter="Image(*.bmp;*.ico;*.ani;*.cur*.gif;*.jpg)|*.bmp;*.ico;*.ani;*.cur*.gif;*.jpg"
if OpenDlg.execute()then image.Filename=OpenDlg.Filename
End Sub


Qmp3 Component

I took inspiration from the "info.bas" file by grog, and the mp3 example from sm0oth2003.

Features:
- Read header info
- Read / write id3 tags ver 1.x
- A combobox for genre selection
- Play (and stop...) mp3 file

Qmp3 Properties

Field | Type | R/W | Notes | Support
Filename | STRING | RW |  | W
Title | STRING | RW |  | W
Artist | STRING | RW |  | W
Album | STRING | RW |  | W
Year | STRING | RW |  | W
Comment | STRING | RW |  | W
Track | BYTE | RW |  | W
Genre | STRING | RW |  | W
Genreid | BYTE | RW |  | W
GenresList | QSTRINGLIST | R | Used internally (do not touch if you don't know what you're doing) | W
GenresCB | QCOMBOBOX | RW | Be sure it has a parent before any action !! | W
Alias | STRING | RW | Alias used for MciSendString (generated automatically) | W
** Header Info **
Version | STRING | R |  | W
Layer | STRING | R |  | W
Protection | STRING | R |  | W
Bitrate | INTEGER | R |  | W
Frequency | INTEGER | R |  | W
Padding | STRING | R |  | W
Channels | STRING | R |  | W
IntensityStereo | STRING | R |  | W
MS Stereo | STRING | R |  | W
Copyright | STRING | R |  | W
Original | STRING | R |  | W
Emphasis | STRING | R |  | W

Qmp3 Methods

Method | Type | Description | Params | Support
ReadTags | SUB | Reads id3 Tags | 0 | W
WriteTags | SUB | Writes id3 Tags | 0 | W
Loadlist | SUB | Loads genres list into GenresCB. Be careful... you MUST assign a parent to GenresCB before you use this function. |  |
HeaderStart | Function | Looks for header start position. Used intenally(but someone could need it) | 0 | W
ReadHeader | SUB | Reads mp3 header info | 0 | W
Play | SUB | Should I explain it ?!? | 0 | W
Stop | SUB | Don't you know ?!? | 0 | W
Fitlength | FUNCTION (FitTag$, FitLen%) | External. Adds null characters to a text string until it reaches specified length. Cuts the string if the string length exceeds the specified length. | 2 | W

Qmp3 Events

Event | Type | Occurs when... | Params | Support
None |  |  |  |

Qmp3 Example


: QOLEOBJECT

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOLEOBJECT

QOLEOBJECT Component

QOleObject implements an automation client. Type checking is disabled for this component, see examples on how this can help you. This component is currently in an experimental stage. Longs, Doubles, and Strings are currently supported, other data types may be added later.

QOleObject Properties
Field Type R/W Default
Container QOLECONTAINER W

QOleObject Methods
Method | Type | Description | Params
CreateObject | FUNCTION (ClassName AS STRING) AS INTEGER | Create COM object, with actual name or CLSID | 1
CreateRemote | FUNCTION (Host AS STRING, ClassName AS STRING) AS INTEGER | Create remote COM object, with actual name or CLSID | 2
Free | SUB | Release object | 0
GetIDofName | FUNCTION (Name AS STRING) AS INTEGER | Returns the ID of an identifier, good for checking if it exists. Returns -1 if name is not found. | 1
GetObject | FUNCTION (ClassName AS STRING) AS INTEGER | Get active COM object, with actual name or CLSID | 1
Invoke | FUNCTIONI (ID AS STRING, Params, ...) AS VARIANT | Invoke method/property | Infinite
InvokeCopy | SUB (ID AS STRING, Object AS QOLEOBJECT) | Copy object (might not work... yet) | 2

QOleObject Events
Event Type Occurs when... Params

Word.Basic Methods - WRDBASIC.HLP

Method Params Type Description
FileOpen | FileName | string | The name of the document (paths are accepted).
ConfirmConversions | integer | True to display the Convert File dialog box if the file isn't in Microsoft Word format
ReadOnly integer True to open the document as read-only.
Note This argument doesn't override the read-only recommended setting on a saved document. For example, if a document has been saved with read-only recommended turned on, setting the ReadOnly argument to False will not cause the file to be opened as read/write.
AddToMru | integer | . True to add the file name to the list of recently used files at the bottom of the File menu.
DummyParam | integer | Needed for XP Office
PasswordDoc | string | The password for opening the document.
PasswordDot | string | The password for opening the template.
Revert long Controls what happens if FileName is the name of an open document.
True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.
WritePasswordDoc | string | The password for saving changes to the document.
WritePasswordDot | string | The password for saving changes to the template.
Dummy | string
Dummy string
Dummy string
FormatOpen long The file converter to be used to open the document. Can be one of the following constants

wdOpenFormatAuto = 0
wdOpenFormatDocument = 1
wdOpenFormatTemplate = 2
wdOpenFormatRTF = 3
wdOpenFormatText = 4
wdOpenFormatUnicodeText = 5
wdOpenFormatEncodedText = 5
wdOpenFormatAllWord = 6
wdOpenFormatWebPages = 7

CodePage | long | The document encoding (code page or character set) to be used by Microsoft Word when you view the saved document. Can be any valid MsoEncoding constant.
Visible | long | True if the document is opened in a visible window. The default value is True.
DummyParam | long
OpenConflictDocument | long | Specifies whether to open the conflict file for a document with an offline conflict.
OpenAndRepair | long | True to repair the document to prevent document corruption.
DocumentDirection long Indicates the horizontal flow of text in a document.
wdLeftToRight = 0
wdRightToLeft = 1
NoEncodingDialog | long | . True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default value is False.

Excel.Properties

QOleObject Examples

' This example requires MS WORD
' If you're using a localized version with a foreign language,
' you'll have to adjust the parameter names to match.
' Comments in italics indicate the old style syntax before
' type checking was disabled.  You can choose either approach.

$ESCAPECHARS ON

DIM Object AS QOLEOBJECT

'Object.CreateObject("{000209FE-0000-0000-C000-000000000046}")
Object.CreateObject("Word.Basic")
'Object.Invoke("AppShow")
Object.AppShow
'Object.Invoke("AppMaximize", "", 1)
Object.AppMaximize("", 1)
'Object.Invoke("FileNew")
Object.FileNew

PRINT Object.Bold  '-- is bold enabled?

Object.Insert("Hello world!\n")
Object.Bold

PRINT Object.Bold  '-- Bold should be enabled

Object.Insert("Rapid-Q is awesome!\n")
Object.Bold(0)     '-- Turn Bold off

SLEEP 5

Object.Free

----------------------------------------------
DIM WordObject AS QOLEOBJECT

filename$="C:\BAS\RAPIDQ\ole\hamai40.doc"
ConfirmConversions=1
ReadOnly=0
AddToRecentFiles =1
DummyInt=0
PasswordDoc$="qq"
PasswordTmp$ ="rr"
Revert =0
WritePasswordDocument$ =""
WritePasswordTemplate$ =""
DummyStr=""
'--------------------------'
FormatOpen =5'' wdOpenFormatEncodedText
CodePage =866
Visible =1
OpenConflictDocument =1
OpenAndRepair =1
DocumentDirection =1
NoEncodingDialog =1

WordObject.CreateObject("Word.Basic")
WordObject.AppShow

with WordObject

.fileOpen(filename$,ConfirmConversions,ReadOnly, AddToRecentFiles ,DummyInt, PasswordDoc$, PasswordDoc$, Revert , _
 WritePasswordDocument$,WritePasswordTemplate$,DummyStr$,DummyStr$,DummyStr$,FormatOpen ,CodePage,Visible, _
DummyParam,OpenConflictDocument,OpenAndRepair,DocumentDirection,NoEncodingDialog)

.TableInsertTable(0, 3, 5)

.Free
end with


: QPANEL

Rapid-Q Documentation by William Yu (c)1999 Appendix A: QPANEL

QPANEL Component

QPanel implements a generic container for your components.

QPanel Properties
Field | Type | R/W | Default | Support
Align | INTEGER | RW | alNone | W
Alignment | INTEGER | RW | taCenter | W
BevelInner INTEGER
'-- Bevel Style
CONST bvNone = 0
CONST bvLowered = 1
CONST bvRaised = 2
RW bvNone W
BevelOuter INTEGER
'-- Bevel Style
CONST bvNone = 0
CONST bvLowered = 1
CONST bvRaised = 2
RW bvRaised W
BevelWidth | INTEGER | RW | 1 | W
BorderStyle | INTEGER | RW | bpNone | W
'-- Bevel Border
CONST bpNone = 0 '-- No visible border
CONST bpSingle = 1 '-- Single-line border
BevelOuter =

BevelInner =

bvnone bvraised bvLowered bvLowered bvLowered bvraised bvraised BevelWidth=3
bvnone | bvnone | bvnone | bvLowered | bvraised | bvraised | bvLowered
BorderStyle=bpNone
BorderStyle=bpSingle
Caption | STRING | RW | W
ClientHeight | INTEGER | RW | WX
ClientWidth | INTEGER | RW | WX
Color | INTEGER | RW | W
Cursor | INTEGER | RW | crDefault | W
Enabled | INTEGER | RW | True | WX
Font | QFONT | W | W
Height | INTEGER | RW | WX
Hint | STRING | RW | W
Left | INTEGER | RW | 0 | WX
Parent | QFORM/QPANEL/QTABCONTROL | W | WX
ShowHint | INTEGER | RW | False | W
TabOrder | INTEGER | RW | W
Tag | INTEGER | RW | WXG
Top | INTEGER | RW | 0 | WX
Width | INTEGER | RW | WX
Visible | INTEGER | RW | True | WX

QPanel Methods
Method | Type | Description | Params | Support
Repaint | SUB | Refreshes panel and all contents | 0 | W

QPanel Events
Event | Type | Occurs when... | Params | Support
OnClick | VOID | User clicked on open area of panel | 0 | WX
OnDblClick | VOID | User double clicked panel | 0 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Mouse button held down | 4 | W
OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves over panel | 3 | W
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | W

QPanel Examples
  DIM Form AS QForm
  DIM Button AS QButton
  DIM Panel AS QPanel

  Panel.Parent = Form
  Panel.Width = 100
  Button.Parent = Panel

  Form.ShowModal


QSTRINGGRID

Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSTRINGGRID

QSTRINGGRID Component

QStringGrid allows you to present textual data in a tabular format.

QStringGrid Properties
Field | Type | R/W | Default
Align | INTEGER | RW | alNone
Align determines how the control aligns within its parent control.
BorderStyle | INTEGER | RW | bsSingle
Cell | 2D ARRAY of STRING | RW
Cell(X, Y) is an array of strings, one string for each cell in the grid.
X = Column, Y = Row
Col | INTEGER | RW
Col is the index of the column that contains the selected cell.
ColCount | INTEGER | RW | 5
Color | INTEGER | RW
ColumnList | ARRAY of STRING | RW
ColumnList maintains a list of strings deliminated by LF for use in Columned lists.
ColumnStyle | ARRAY of INTEGER | RW | gcsNone
ColumnStyle determines the style of each column.
0 = gcsList -- Column with a drop-down list for each item
1 = gcsEllipsis -- Column with an ellipsis button for each item
2 = gcsNone -- Normal column
ColWidths | ARRAY of INTEGER | RW
ColWidths is an indexed array giving the width in pixels of all the columns in the grid.
Cursor | INTEGER | RW | crDefault
DefaultColWidth | INTEGER | RW | 64
DefaultRowHeight | INTEGER | RW | 24
EditorMode | INTEGER | RW
Enabled | INTEGER | RW | True
FixedColor | INTEGER | RW
FixedCols | INTEGER | RW | 1
FixedColss is the number of columns on the left of the grid that cannot be scrolled.
FixedRows | INTEGER | RW | 1
FixedRows is the number of rows on the top of the grid that cannot be scrolled.
Font | QFONT | W
GridHeight | INTEGER | RW
GridLineWidth | INTEGER | RW | 1
GridWidth | INTEGER | RW
Handle | INTEGER | R
Height | INTEGER | RW
Hint | STRING | RW
Left | INTEGER | RW | 0
LeftCol | INTEGER | RW
Parent | QFORM/QPANEL/QTABCONTROL | W
PopupMenu | QPOPUPMENU | W
Row | INTEGER | RW
Row is the index of the row that contains the selected cell.
RowCount | INTEGER | RW | 5
RowHeights | ARRAY of INTEGER | RW
RowHeights is an indexed array giving the height in pixels of all the rows in the grid.
ScrollBars | INTEGER | RW | ssBoth
Separator | STRING | RW
Separator determines how the stringgrid should parse (ie. read/write) grid data. For example, you can save the grid data to a file, with each item deliminated by the Separator.
ShowHint | INTEGER | RW | False
TabOrder | INTEGER | RW
TabStops | ARRAY of INTEGER | RW
Tag | INTEGER | RW
Top | INTEGER | RW | 0
TopRow | INTEGER | RW
Visible | INTEGER | RW | True
VisibleColCount | INTEGER | R
VisibleRowCount | INTEGER | R
Width | INTEGER | RW

QStringGrid Methods
Method | Type | Description | Params
AddOptions SUBI Add options to string grid
CONST goFixedVertLine = 0 When True, horizontal lines appear between the rows within nonscrolling regions.
CONST goFixedHorzLine = 1 When True, vertical lines appear between the columns within nonscrolling regions.
CONST goVertLine = 2 When True, vertical lines appear between the columns
CONST goHorzLine = 3 When True, horizontal lines appear between the rows.
CONST goRangeSelect = 4 When True, the user can select a range of cells at one time. When goEditing is True, the user can no longer select a range of cells.
CONST goDrawFocusSelected = 5 When True, the cell with the focus is colored 'the same as other cells in a selected block are colored. When False, the cell with the focus remains the color of all unselected cells, the color specified with the grid Color property.
CONST goRowSizing = 6 When True, rows can be resized individually except for fixed or nonscrolling rows.
CONST goColSizing = 7 When True, columns can be resized individually except for fixed or nonscrolling columns.
CONST goRowMoving = 8 When True, the user can move a row to a new location in the grid using the mouse.
CONST goColMoving = 9 When True, the user can move a column to a new location in the grid using the mouse.
CONST goEditing = 10 When True, the user can edit the text in the grid. When goEditing is True, the user cannot select a range of cells at one time.
CONST goTabs = 11 When True, the user can use the Tab and Shift-Tab keys to move from column to column in the grid.
CONST goRowSelect = 12 When True, the user can only whole rows at a time instead of individual cells.
CONST goAlwaysShowEditor = 13 When True, the grid is in automatic edit mode 'if goEditing is also True. When the grid is in automatic edit mode, the user does not have to press Enter or F2 before editing the contents of a cell. When goAlwaysShowEditor is False and goEditing is True, the user must press Enter or F2 before editing the contents of a cell. If goEditing is False, setting goAlwaysShowEditor to True has no effect.
CONST goThumbTracking = 14 When True, the contents of the grid scrolls while the user is moving the thumb tab of the grid scroll bar. When False, the contents of the grid doesn't scroll until the user releases the thumb tab in its new position.

'-- ColumnStyles
CONST gcsList = 0
CONST gcsEllipsis = 1
CONST gcsNone = 2
 INTEGER, Infinite
DeleteCol | SUB (Column%) | Deletes/Remove a column | 1
DeleteRow | SUB (Row%) | Deletes/Remove a row | 1
DelOptions | SUBI | Delete options from string grid | INTEGER, Infinite
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5
InsertCol | SUB (Column%) | Inserts a blank column | 1
InsertRow | SUB (Row%) | Inserts a blank row | 1
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5
LoadFromFile | SUB (File$, RowOffset%, ColOffset%, MaxRows%) | Loads table from file w/Separator | 4
LoadFromStream | SUB (S AS QFileStream/QMemoryStream, RowOffset%, ColOffset%, MaxRows%) | Loads table from stream w/Separator | 4
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4
Pset | SUB (x%, y%, c%) | Pixel plot | 3
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5
Repaint | SUB | Force repainting of stringgrid | 0
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7
SaveToFile | SUB (File$, RowOffset%, ColOffset%, MaxRows%) | Saves table to file w/Separator | 4
SaveToStream | SUB (S AS QFileStream/QMemoryStream, RowOffset%, ColOffset%, MaxRows%) | Saves table to stream w/Separator | 4
SwapCols | SUB (Col1%, Col2%) | Swap two columns | 2
SwapRows | SUB (Row1%, Row2%) | Swap two rows | 2
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to cell | 5

QStringGrid Events
Event | Type | Occurs when... | Params
OnDrawCell | SUB (Col%, Row%, State%, R AS QRect) | Cells need to be redrawn | 4
OnEllipsisClick | SUB (Col%, Row%) | Pull down list is clicked | 2
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2
OnListDropDown | SUB (Col%, Row%, BYREF S AS STRING) | Pull down list is clicked. S is a string with items separated by a new line character. | 3
OnSelectCell | SUB (Col%, Row%, CanSelect%) | User has selected a cell | 3
OnSetEditText | SUB (Col%, Row%, Value$) | User has changed contents of cell | 3

QStringGrid Examples
CREATE Form AS QForm
  CREATE Grid AS QStringGrid
    Cell(1,1) = "hello"
  END CREATE
  Center
  ShowModal
END CREATE

'------------------------------------------------------------------
' Pulldown list example

$INCLUDE "RAPIDQ.INC"
$ESCAPECHARS ON

CONST AgeList = "10\n11\n12\n13\n14\n15\n16\n17\n18\n19"

SUB EllipsisClick (Col AS LONG, Row AS LONG, Sender AS QSTRINGGRID)
    Sender.Cell(Col, Row) = "Comments"+STR$(Row)
END SUB

CREATE Form AS QFORM
    CREATE Grid AS QSTRINGGRID
        Align = alClient
        AddOptions(goEditing)
        FixedRows = 1
        FixedCols = 0
        ColCount = 3
        RowCount = 5
        DefaultRowHeight = 20
        ColumnStyle(0) = gcsList
        ColumnStyle(1) = gcsEllipsis
        ColumnList(0) = AgeList
        Cell(0,0) = " Age"
        Cell(1,0) = " Comments"
        OnEllipsisClick = EllipsisClick
    END CREATE
    Caption = "Dropdown list example"
    Center
    ShowModal
END CREATE


Appendix A: QTabControlEx

Documentation component by D.Glodt (c)2004

Appendix A: QTabControlEx

QTabControlEx Component

QTabControlEx is a component inherited from QtabControl with members extend.
The DelTabs method from standard component is replaced by DeleteTabs method.

QTabControlEx Properties

Fields | Type | R/W | Default
TabCount | INTEGER | R | 0
 | Tab count |  |

QTabControlEx Methods

Method | Type | Description | Params
DeleteTabs | SUBI(Index&) | Delete tabs | 1
Clear | SUB | Remove all | 0

QTabControlEx Events

Event | Type | Occurs when... | Params

QTabControlEx Example


Appendix A: QTBUTTON

Rapid-Q Documentation par/by d-evolution (c)2004 - 2005 Appendix A: QTBUTTON

Composante QTBUTTON Component ....>

Version actuelle/Current version : 0.89
MàJ/Updated : 31/12/2004
QTButton est un contrôle hérité de QButton, d'où Q(True)Button, avec la possibilité de placer une enjolivure (un skin) en fond. Pour commencer, créez une resource "btn_BMP" contenant l'image bitmap qui sera l'enjolivure de tous les QTButtons.
QTButton is an herited QButton with skinning capability. First create a bitmap resource named "btn_BMP", this will be the default skin for all QTButtons you defined.

Example : $REsource btn_BMP As "_RES\Boutons.bmp"
*(remplacer la partie en vert, le reste ne doit pas être modifié / modify the green part, it should point to an existing bitmap)

Note IMPORTANTE sur l'utilisation de fichier BMP sous Win9x :
L'utilisation de certains fichiers BMP peut geler l'écran. Ouvrir l'image dans Internet Explorer et l'enregistrer à nouveau va résoudre ce problème. Vous remarquerez alors que l'image n'a plus la même taille sur le disque dur. De son côté XP semble moins irrité par ce léger problème, néanmoin après plusieurs exécutions de l'application un message Resource insuffisante peut apparaître et peut aller jusqu'à geler le système complètement.
RapidQ semble avoir un problème avec l'information supplémentaire contenue dans certaines images bitmap.

Fonctionel / Passed Corrigé / Fixed Acceptable / Partialy working Ne pas utiliser / Don't use
Commencez par créer une image bitmap contenant les images, alignées horizontalement, représentant vos boutons.
First create a bitmap picture containing all the pictures, in a horizontal row, that will represent your buttons.

Ordre des images / images order
1 2 3 4

1. Normal
2. Désactivé / Disabled
3. Enfoncé / Pushed
4. Survollé / Hover (New!)

QTButton supporte jusqu'à quatres effets, mais vous pouvez n'intégrer que le nombre qui vous plaît, tant qu'ils respectent l'ordre d'affichage. Ainsi vous pouvez n'avoir qu'un seul effet, deux effets, ainsi de suite.
QTButton support up to four fx, but you can add only the number you need, has long they respect the display order. So you may have only one effect, two effects and so on.
Propriétés de QTButton Properties
Champs/
Field 		Type L/E
R/W 		Défaut/
Default 		Supporte/
Support
Align | ENTIER / INTEGER | LE / RW | alNone | W
Align détermine la façon dont le contrôle s'aligne à l'intérieur de son contrôle parent.
Align determines how the control aligns within its parent control.
BMP STRING -- W
BMP est utilisé en interne par QTButton pour créer l'enjolivure. Vous risquez d'obtenir d'étrange résultat si vous l'ajoutez à votre code. Pour remédier à se problème .BMP doit être le premier champs déclaré ou essayez plutôt d'utiliser ICOBMP.BMP si vous désirez insèrer une petite image à côté du texte.
BMP is currently used internally by QTButton for drawing skin and shouldn't be used in your code. Instead try using ICOBMP.BMP if you want to put a little picture near the caption.

Use BMP to assign a new bitmap file, or to use BMP in a draw statement.
Examples:
DIM button AS QBUTTON
button.BMP = "whatever.bmp"
Ajouter une image en contournant l'enjolivure / Add picture w/o destroying the skin
La bonne façon / The Good Way :
DIM TButton1 AS QTBUTTON
TButton1.BMP = "whatever.bmp"
TButton1.Parent = Form
TButton1.Left = 8
...
ou/or
CREATE Button1 AS QTBUTTON
    BMP = "whatever.bmp"
    Left = 8
    ...
END CREATE
ou/or
CREATE Button1 AS QTBUTTON
    ICOBMP.BMP = "whatever.bmp"
    Left = 8
    ...
END CREATE
ou/or
Appeler Redraw juste après avoir ajoutée l'image /
Call Redraw once new BMP value set
Details:
You can hold multiple images on a single bitmap, but they must be of the same size and next to each other in a horizontal row.
The "first" bitmap appears when the button is up.
The "second" bitmap appears when the button disabled.
The "third" bitmap appears when the button is down (clicked).
You have to tell Rapid-Q how many images are in your bitmap by assigning the number to NumBMPs.
BMPHandle RESOURCE -- W
Comme BMP, BMPHandle est utilisé en interne par QTButton pour créer l'enjolivure. Vous risquez d'obtenir d'étrange résultat si vous l'ajoutez à votre code. Pour remédier à se problème .BMPHandle doit être le premier champs déclaré ou essayez plutôt d'utiliser ICOBMP.BMPHandle si vous désirez insèrer une petite image à côté du texte.
Like BMP, BMPHandle is currently used internally by QTButton for drawing skin and shouldn't be used in your code. Instead try using ICOBMP.BMPHandle if you want to put a little picture near the caption.

Assign a BMP resource handle to appear on the selected button.
Example:
$RESOURCE game_BMP AS "game.bmp"
DIM button AS QTBUTTON
button.bmpHandle = game_BMP
Ajouter une image en contournant l'enjolivure / Add picture w/o destroying the skin
La bonne façon / The Good Way :
'Voir l'astuce dans BMP /
'See the trick in BMP
Détails / Details:
Voir BMP / See BMP
Cancel | ENTIER / INTEGER | LE / RW | False | W
Si Cancel est True, l'événement OnClique attaché au button est éxécuté lorsque l'utilisteur appuie sur la touche Échappe.
If Cancel is True, the button's OnClick event handler executes when the user presses the Escape key.
Caption | STRING | LE / RW | WXG
Caption spécifie le texte qui apparaît sur le bouton. Pour souligner une lettre, inclure (&) devant la lettre.
Caption specifies the text that appears on the button. To underline a character, include an ampersand (&) symbol before the character.

Multi-Lignes / Multi-Lines
Pour créer un effet multi-lignes, ajoutez chr$(10) entre les mots où vous voulez créer l'effet.
To create a multi-lines button, add chr$(10) between the words where you want to create that effect.
Example :
.Caption = "Ceci est " +chr$(10) +_
           "un bouton " +chr$(10) +_
           "multi-lignes."
Color | ENTIER / INTEGER | LE / RW | X
Cursor | ENTIER / INTEGER | LE / RW | crDefault | W
Default | ENTIER / INTEGER | LE / RW | False | W
Si Default est True, l'événement OnClique attaché au button est éxécuté lorsque l'utilisteur appuie sur la touche Entrée.
If Default is True, the button's OnClick event handler executes when the user presses the Enter key.
Enabled | ENTIER / INTEGER | LE / RW | True | WXG
Font | QFONT | E / W | W
GroupIndex | ENTIER / INTEGER | LE / RW | 0 | WXG
GroupIndex permet à plusieurs boutons de coopérer en groupe. Si GroupIndex est 0, le bouton réagis independemment de tous les autres boutons.
GroupIndex allows buttons to work together as a group. If GroupIndex is 0, the button behaves independently of all other buttons.
Handle | ENTIER / INTEGER | E / R | W
Height | ENTIER / INTEGER | LE / RW | WXG
Hint | STRING | LE / RW | WXG
Kind | ENTIER / INTEGER | LE / RW | bkCustom | W
Layout ENTIER / INTEGER -- blBMPLeft W
Layout détermine où sera affiché l'image bitmap sur le bouton. /
Layout determines where the bitmap image appears on the button.
0 = blBMPLeft -- l'image apparaît à gauche du texte / image appears at the left side of the caption
1 = blBMPRight -- l'image apparaît à droite du texte / image appears at the right side of the caption
2 = blBMPTop -- l'image apparaît au dessus du texte / image appears above the caption
3 = blBMPBottom -- l'image apparaît sous le texte / image appears below the caption
Left | ENTIER / INTEGER | LE / RW | 0 | WXG
ModalResult | ENTIER / INTEGER | LE / RW | mrNone | W
NumBMPs | ENTIER / INTEGER | LE / RW | W
NumBMPs a été redéfinie pour déterminer le nombre d'image inclut dans l'image du bouton (l'enjolivure).
NumBMPs has been redefine to determine the number of images within the bitmap button (the skin).
NumICOBMPs | ENTIER / INTEGER | LE / RW | W
NumICOBMPs détermine le nombre d'image inclut dans l'image icône qui sera placée juste à côté du texte du bouton.
NumICOBMPs determines the number of images within the icon bitmap that will be draw near the button caption.
Parent | QFORM/QPANEL/QTABCONTROL | LE / W | WXG
PopupMenu | QPOPUPMENU | E / W | W
ShowHint | ENTIER / INTEGER | LE / RW | False | WXG
Spacing ENTIER / INTEGER -- 4 W
Actuellement utilisé en interne et ne devrait pas être inclut dans votre code.
Détermine l'espace, en pixels, séparant l'image du texte.
Currently used internally and shouldn't be used in your code.
Determines the separation, in pixels, between the image and the caption.

Note: Doit être déclaré après BMP/BMPHandle et non avant.
TabOrder | ENTIER / INTEGER | LE / RW | W
Tag | ENTIER / INTEGER | LE / RW | WXG
Top | ENTIER / INTEGER | LE / RW | 0 | WXG
Width | ENTIER / INTEGER | LE / RW | WXG
Visible | ENTIER / INTEGER | LE / RW | True | WXG

Méthodes de QTButton Methods
Méthode/ Method | Type | Description | Paramètres/ Params | Supporte/ Support
StartDrag | SUB | Permet de déplacer la bouton Allows Button to be dragged | 0 | W
ReDraw | SUB | Redessine le bouton ReDraw button | 0 | W

Événements de QTButton Events
Événement/ Event | Type | Survient lorsque.../ Occurs when... | Paramètres/ Params | Supporte/ Support
OnClick | VOID | L'utilisateur a cliqué sur le bouton User clicked on the button | 0 | WXG
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Une touche est maintenue enfoncée Key held down | 2 | W
OnKeyPress | SUB (Key AS BYTE) | L'utilisateur appuie sur une touche User presses a key | 1 | W
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | L'utilisateur relâche une touche User releases a key | 2 | W
OnMouseDown | SUB (Button%, X%, Y%, Shift%) | Le bouton de la souris est maintenu enfoncé Mouse button held down | 4 | WXG
OnMouseMove | SUB (X%, Y%, Shift%) | La souris se déplace Vous devrez ajouter .InheritOnMouseMove(x,y,shift) dans votre SUB Mouse moves You should add .InheritOnMouseMove(x,y,shift) in your SUB | 3 | WXG
OnMouseEnter | SUB (X%, Y%, Shift%, Sender As QTButton) | La souris entre sur le bouton Mouse moves over the button | 3 | WXG
OnMouseLeave | SUB (X%, Y%, Shift%, Sender As QTButton) | La souris quitte le bouton Mouse moves outside the button | 3 | WXG
OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Le bouton de la souris est relâché Vous devrez utiliser .InheritOnMouseUp dans le SUB Mouse button is released You should use .InheritOnMouseUp in your SUB | 4 | WXG

Options avancés de QTButton Advanced Options
Options générals affectant tous les boutons.
btn_BMP $REsource btn_BMP As "_RES\bitmap.bmp" | Resource obligatoir par défaut pour tous les QTButton, contenant l'image du bouton, si elle n'est pas spécifié vous recevrez un messages d'erreur. Il est possible de créer d'autres resources contenant d'autres images de bouton, pour ce, voir l'example plus bas.
QTBtnOptimize = True / *False *(Défaut/Default) | Option visant à optimizer le nombre de fois où le btn sera redessiné lors du chargement de l'application et ainsi accélérer l'ouverture de celui-ci. Il doit être insèrer juste après $include "QTButtonXX.inc" pour que optimisation soit au maximum. Si les btns sont dessinés incorrectement désactivez-le en retirant la ligne QTBtnOptimize ou en ajoutant QTBtnOptimize = False et LeNomDuBtn.ReDraw au chargement pour corriger le problème. Pour évaluer l'optimisation ajoutez la ligne ShowMessage STR$(DrawCount) au chargement de votre fenêtre principale et comparez-le avec et sans l'optimisation. Note: Vous pouvez aussi utiliser la méthode ReDraw pour forcer le redessinement des btns incorrectement dessinés et ainsi garder une meilleure optimisation.

Examples pour QTButton Examples (Copier et coller dans un nouveau projet/Copy and Paste in a new project)
Example 1 : (Actualisez la page pour restaurer le texte/To restore text simply Refresh the page)
Example 2 : (Actualisez la page pour restaurer le texte/To restore text simply Refresh the page)


Appendix A: QTreeViewEx

Documentation component by D.Glodt (c)2004

Appendix A: QTreeViewEx

QTreeView Component

QTreeView is a component inherited from QTreeView component with new methods.

QTreeViewEx Properties

Field | Type | R/W | Default

QTreeViewEx Methods

Method | Type | Description | Params
IndexOf | FUNCTION(name$) AS INTEGER | Return item index from text | 1
GetNameNode | FUNCTION(index&) AS STRING | Return text node from index | 1
GetIndexNode | FUNCTION(index&) AS INTEGER | Return index node from index | 1
IsNode | FUNCTION(index&) AS BOOLEAN | Return true if item index is a node | 1
GetLevelCount | FUNCTION AS INTEGER | Return level count | 0
EnumChildItems | SUB(index&) | Enum child items from index by event OnEnumChildItems | 1

QTreeViewEx Event

Evenement | Type | Occurs when... | Params
OnEnumChildItems | (index as integer,text as string,Node as integer) | At running of method EnumChildItems | 3

QTreeViewEx Example


QXls

 QXLS.INC by Doctor Electron Copyright 2002, 2003 Global Services

June 9, 2003 Rare problem with ReadOLEFile SUB fixed.
May 30, 2003 Faster version by value type matching in source code.
Apr 13, 2003 xlsOPEN fixed for files with "out of order" sectors.
Apr 8, 2003 xlsREAD of certain negative numbers fixed.
Mar 30, 2003 xlsOPEN of certain large files now faster.
Mar 11, 2003 .xls backup to .csv files source code included.
Jan 9, 2003 Faster inline code and xlsREAD of Russian characters.

FREEWARE: You are free to use this program, but permission from the author
is required for sale of this program or packaging it in products for sale or
for use in commercial settings.

1.1 KNOWN PROBLEMS: None. MS Excel will corrupt some files it writes. Qxls
deciphers the corruption and restores them to normal, much like Excel must
do when it reads the corrupted file. Thus, Qxls has hacked the corruption
scheme MS uses. One "known solution" is that xlsSAVE will store your data
in uncorrupted form.
Also, MS invents BIFF8 record codes from time to time. However, the sERR
string will report unrecognized codes (see below).

1.2 LIMITATIONS: Please see xlsSAVE and xlsWRITE descriptions below.

1.3 This $INCLUDE file for RapidQ Basic provides direct access to MS Excel 97
(and up) using BIFF8 format without lauching the MS Excel program itself.
It may be relatively easy to translate this code into MS VB or other Basic
coding environments. Indeed, the RK decoding routine herein was translated
from C. The rest is original code.

1.4 Three programs using qxls.inc are included.
(1) qxls.bas prints values from .xls files illustrating how the functions may
be used.
(2) rowtally.bas tests all .xls files in a directory for readability (xlsOPEN
successful) and counts all the rows in all of the sheets in all of the files.
This program can give a quick look at "progress" if daily operations involve
adding data to files increasing their rows with ledger items, new cases, etc.
(3) xls-backup.bas, written by a qxls user, will backup all .xls files in a
diretory to .csv files in a user-specified directory. For each .xls file with
multiple, non-empty sheets, xls-backup will write a separate .csv file for
each sheet. This program is more than a demo, since it has practical use for
backup as it comes "right out of the box".

If your files are not BIFF8, just read them into Excel 97 and up and save
in the new format.

2. QUICKSTART (Please see the demo program qxls.bas)

Select a workbook index (dimensioned as b in qxls.inc). b is a numeric value
from 0 to MaxBooks(a constant). With constant MaxBooks = 7, there may be eight
workbooks open simultaneously. These are stored in RAM, so more open workbooks
means more usage of system resources, especially for large files.

Define FileSpec(b) for workbook b, which is the full path and file name.
For example, for the demo.xls included, this is FileSpec(b)="demo.xls"

3. QXLS FUNCTIONS assume b is set to the workbook you want to access.

3.1 ret = xlsOPEN

There are no arguments. The values b and FileSpec(b) are used. xlsOPEN opens
the file and parses its contents, storing key values in data variables
associated with the value b. ret is a numeric variable which you define As LONG
in your program. xlsOPEN returns to ret -1 for error or the number of sheets in
the file.

3.2 string = xlsREAD(s, i, j)

s sheet number from 1 to ret in 3.1 above.
i 0-based row number.
j 0-based column number.

i, j and b above are 0-based, which means the first item has a 0 index.

xlsREAD returns four values: (1) a value string, (2) xType number, (3)
sERR string and (4) various values and pointers. xUnicode is the pointer
to a unicode string structure. sLength is the unicode structure length.
xIEEE = 8-byte floating number if applicable (xType). xInt = 4-byte
integer if applicable (xType). [For advanced programmers, xCode
contains the record type from which the value was obtained.]

For example,
x$=xlsREAD(2,0,0) 'read cell A1 in sheet 2
x$=xlsREAD(1,3,2) 'read cell C4 in sheet 1

x$ is the value. If a string, xType = -1. If a number, xType >= 0.
For numbers, xType gives the RK code which indicates floating or integer
and whether or not the stored value was multiplied by 100 (see RK constants
in qxls.inc). If xType = 4, then the value was stored as an 8 byte IEEE
floating point number (double in RapidQ).

All values are returned as strings. Use the VAL(x$) function to convert
numeric values to numeric variables. Or read the binary form as follows.

For example,
IF sERR <> "" THEN (your code to look at that here)
IF x$ <> "" THEN
SELECT CASE xType 'yourvar=VAL(x$) gives you the value
CASE -1: mystring = x$: Goto ItWasString
CASE 0, 4: mydoublevar = xIEEE: Goto ItWasDouble
CASE 1: mydoublevar = xIEEE: Goto ItWasDoubleX100 'value x 100
CASE 2: mylongvar = xInt: Goto ItWasInteger
CASE 3: mylongvar = xInt: Goto ItWasIntegerX100 'value x 100
CASE ELSE: PRINT "xType value violated UN human rights charter"
END SELECT
ItWasString:
'...etc...
END IF

If the requested cell is not defined or blank in the workbook, x$ will be
null. If the cell contains a formula, the resulting formula value is
returned by xlsREAD [and xCODE may not be a FORMULA type record].

Since the file has already been read and parsed, there are not many errors
that can occur. The string variable sERR is defined for each call to xlsREAD.
If sERR = "" (null), then there was no error reported. If the first character
of sERR is "#", this indicates special results such as #FORMULA, #BLANK,
#BOOLERR and #XXXX where XXXX is a four-character hex value for an unrecognized
record type. If you get any #XXXX, please notify the author. If x$ is null
and sERR = "#BLANK", it may indicate that somebody deleted what was in that cell.

3.3 ret = xlsCLOSE

There are no arguments. The RAM for workbook b is freed and internal data
arrays describing that workbook are cleared. ret is -1 for error (b > MaxBooks)
or b for success. That value of b may be used to open another workbook file.

3.4 ret = xlsSAVE(File As STRING)

Saves workbook b to file specified in "File" string, with ret = file size.

Your main program should probably check if File = FileSpec(b) used in xlsOPEN,
and if so, prompt the user regarding overwriting/replacing the existing file.

Advantages of xlsSAVE include (1) files are saved with all of the data in
continuous streams (uncorrupted) and (2) files will be shorter since only
the OLE header, BIFF8, OLE FAT, OLE directory and if applicable, extensions
of the FAT index, are written. That is, basic code in the original file and
any "summary information" and "document summary" is not written. This latter
point would exclude, for example, certain authorship information, and may
be viewed as an advantage or a limitation, depending on your needs.

3.5 ret = xlsWRITE(s, i, j, value As STRING)

xlsWRITE stores the value in sheet s, row i, column j, as in xlsREAD above.
If the value represents a number, xlsWRITE determines how to store it (integer
or floating, etc). ret = the number of bytes written in the new or replacement
record. All relevant pointers are updated with each xlsWRITE. Thus, if the
file is saved, it should be readable both by Qxls programs and by Excel.

xlsWRITE is "hot off the press" and has several limitations, which coming
updates hope to reduce. As with any new code, one should watch for bugs or
other problems, and be kind enough to notify the author. The major known
limitation at present is that xlsWRITE is limited to changing values or entering
new values in "defined rows." A "defined row" is a row that already exists
in the file when it is opened. Before this limitation is reduced or completely
removed, one can use a template file that already has the number of rows you
will need defined. Just save it from Excel, load it with xlsOPEN and away you
go. This procedure is not unlike Excel itself which loads a "blank book."

3.6 string = xlsSHEETNAME(s As LONG) 'Returns name of sheet s in book b.

3.7 ret = xlsMINROW(s As LONG) 'Returns first row of sheet s in book b.

3.8 ret = xlsMAXROW(s As LONG) 'Returns last row of sheet s in book b.

3.9 ret = xlsMINCOL(s As LONG) 'Returns first column of sheet s in book b.

3.10 ret = xlsMAXCOL(s As LONG) 'Returns last column of sheet s in book b.

3.11 ret = xlsSHEETLENGTH(s As LONG) 'Returns length in bytes of sheet s in book b.

3.12 ret = xlsNUMBERSHEETS 'Returns number of sheets in book b (like xlsOPEN).

4. EXAMPLES assuming the workbooks b have been opened with xlsOPEN:

FOR b = 0 to 3: MyArray$(b) = xlsREAD(2,2,1): NEXT b

reads cell B3 of sheet 2 in workbooks 0 to 3.
Note that the i argument (2) is row "3" and the j argument (1) is column "B".

b=0: price$ = xlsREAD(1,2538,5): b=3: asset$ = xlsREAD(3,24,6)

The price is in book 0, sheet 1, cell F2539; assets in book 3, sheet 3, cell G25.

b=1: item$ = xlsREAD(mysheet, myrow-1, mycol-1)

In workbook 1, get the value at myrow and mycol in mysheet.

Please look at the dimensioned variables in qxls.inc for two purposes. First,
the variables labeled as scratch may be used by your program between calls to
qxls functions, but may be changed by function calls. Second, the workbook
specific variables may be accessed by your program, such as FileSpec(b), etc.
In general, there should be read only access of the "internal variables" used by
the functions. It is better to use the defined functions above so that
any future change in the layout of qxls internal data will not require you
to change your application program.

5. HOW DO I WRITE EXCEL FILES?

There are several options:

First, xlsWRITE(s, i, j, v) and xlsSAVE(f) functions are rather powerful
although there are limitations in the current version described above.

Second, write a .csv file which is just a character delimited text file where
each row is an Excel file row. This can be imported into Excel and saved.
Your application program can also shell to "excel.exe myfile.csv".

6. DESIGN CONCEPTS

The overall goal was to write functions that work reliably.

qxls.inc uses indexing data in workbooks and creates some of its own indeces
during xlsOPEN to speed up access to data. Thus, in large files, data is
accessed almost as fast as in small files. The xlsOPEN function will take
more time (1) if xIntegrity = 1, (2) if the file is large, (3) if the file
contains more strings in the SST table which is parsed during xlsOPEN to
create the indeces qxls uses to access these strings.

The internal data tables were set up with the view that new features including
writing values could be added. Within the present framework of qxls.inc, it
would be relatively easy to add access/modification to cell formating (borders,
etc), the codes for kinds of #BOOLERR values, etc.

If qxls.inc is improved, your program will not become obsolete because the
basic function calls will be the same.

qxls.inc does not modify in any way your existing Excel files unless you save
a file with exactly the same file specification (as with any program). It is
recommended that saved files be renamed or you keep backups of existing files.

7. QXLS.INC WILL NOT READ A FILE

A design principle was generally to reject the file if any cross-reference
does not check out. For example, BOUNDSHEET records point to the start of the
sheet and if this does not agree with the actual start offset of the sheet, the
file is rejected. The general idea is you want accuracy in the data you read or
knowledge that something is wrong.

What to do, if qxls.inc will not parse (open) the file?

First, be sure that there are not more sheets in the file than are dimensioned
in the constants described below. Also, for very large numbers of strings, the
SST constant might need to be larger (display nSST(b) to see that).

Try reading the file into MS Excel and possibly saving it in shorter versions
or even as .csv which will then be read and saved again as .xls, hopefully
restoring file integrity.

qxls.inc may think the file format is bad because of a fault in qxls.inc. If
you think this is the case, maybe you might send me the file. [Note: please
do not send files with information that you or any other person might consider
to be private or confidential. Labels or other indicators can be deleted or
changed. If the problem centers on particular cells, just copy those cells
to the demo.xls included, so that not even your authorship information which may
be stored in your files is sent.]

The xIntegrity variable may be set to "1" to use qxls.inc as a file integrity
tester. With xIntegrity = 1, qxls will open a file parsing all the records in
all the sheets. For files greater than one megabyte in length, possibly with
tens of thousands of unique strings, the parsing in the present version works
well. For example, the SST record contains its count of unique strings. xlsOPEN
parses each string to count them and compare this count with the recorded count.
If they don't agree, the file is rejected.

At every step in xlsREAD any inconsistency or error is reported by the sERR string.
Thus, the user may have more confidence that a null return upon reading a
particular cell is believable. That is, in some applications, the absence of
a particular value is as important as the presence of a value.

8. MORE DETAILS

Look at comments in qxls.inc and particularly the constants:

CONST MaxBooks& = 7&
CONST MaxSheets& = 15& 'if your files have more or less sheets, edit this.
CONST MaxBytes& = 4095& 'used as a buffer
CONST MaxSST& = 255& 'used by qxls to create indexing to strings

The sERR string will notify you that one of the above constants is too small
to handle your particular workbooks. Simply edit qxls.inc to solve this.
Likewise, some RAM is saved if your programs never open more than three
workbooks at a time and you edit the constant in Qxls.inc:

CONST MaxBooks& = 2& 'three simultaneous books (0 - 2)

9. CONTACT

For more features or problems, please share your thoughts and experience regarding
what you need. doctorelectron@cwdom.dm

Most recent versions: Net Census, http://www.angelfire.com/space/netcensus/


RichEdit

Hello,
I am sorry to bother you, but I need help with using COM controls.
My problem is not really with using QOLEOBJECT and QOLECONTAINER, I
understand fairly well how to use these. What I do not understand is how I
can find the properties, methods, and events of a particular control. For
example:

Dim Object as QOLEOBJECT
Object.CreateObject("Word.Basic")

How did you know to use "Word.Basic"?

Or another example:

Dim msHTML as QOLECONTAINER
msHTML.CreateObject("Shell.Explorer.1")

How did you know to use "Shell.Explorer"?

Using the program Dependency Walker to view msHTML.dll, I see nothing that
says "Shell.Explorer", so I assume that what I'm looking for is found
somewhere else.

I apologize for the dumb question, but it's been bugging for awhile now and
I still can't figure it out, so of coarse, all information will be GREATLY
appreciated.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

I just found out that I have a COM viewer included with VC++.

It can also be downloaded here
http://www.microsoft.com/com/resources/oleview.asp

It doesn't seem to have any documentation for the objects, but at
least it tells you what's there.

See
http://download.microsoft.com/download/ole/ole2v/3.5/W351/EN-US/Ole2v.exe

I'd like to know how to access and read Outlook Address Book
using qoleobject and qolecontainer from my little program.
I've tried with:

$apptype console
DIM Object AS QOLEOBJECT
Dim ot As QOLEOBJECT
Dim mapi As QOLEOBJECT
Dim x As QOLEOBJECT

Print "outlook..."
Print Object.Create("Outlook.Application")
Print Object.getIDOfName("GetNameSpace")
Sleep 2
Print "invoke"
Print Object.invoke("GetNameSpace","MAPI",mapi)
Print mapi.getIDOfName("AddressLists.Count")

Print "NameSpace..."
Print mapi.Invoke("AddressLists.Count")

SLEEP 5
Print "Stop"
Input asfdsadf
End

I'll like any suggestion. Thanks

Hi,

I use the code and of course, it works. (Thanks for the tip).

Now im trying to change one variable of the Flash Movie.
Taking an example from JavaScript i can do it.
Works a little strange, because it behavior different of the
original JS idea.
Now i want to know how could i know whats thinks can be done in a
similar way, im talking about getting acceso to the 'object'
properties, actions,etc. Just like "SetVariable'.

The NEW code is:

CREATE Form AS QFORM
Caption = "Swf"
Center
Visible = 1
CREATE swf AS QOLECONTAINER
CreateObject("ShockwaveFlash.ShockwaveFlash.5")
movie= "c:\windows\escritorio\p1.swf"
setvariable ("t","texto")
height =200
width = 200
END CREATE
Visible = 0
END CREATE

Form.ShowModal

swf.Free

You need to have an edit in the Flash Movie with a variable
named 'texto' (dynamic).

Hi,

For the Object "Explorer" you have these

PROPRETIES
----------
help
attach
busy
fullname
locationname
locationurl
name
offline
path
readystate
registerasbrowser
registerasdroptarget
silent
theatermode
toplevelcontainer
type
wherelc

METHODS
-------
Exec
GoBack
GoForward
GoHome
GoHome
Navigate
QueryStatusWB
Refresh

CREATE msHTML AS QOLECONTAINER
Align = 5
createObject("Shell.Explorer.1")
END CREATE

This Works
----------
msHTML.LocationURL returns the ... LocationURL
msHTML.Refresh Refreshes the viewed page
msHTML.Navigate ("www.google.com") view google page

It's posible too to INVOKE
msHTML.Invoke ("locationURL") ' never tried ???

I've never been able to use Exec to SaveThe File
------------------------------------------------
msHTML.Exec 4, 2, "c:\\Tampon\\RQGoogle.Htm", 0 ' or msHTML.ExecWB ...

Nor CUT AND PASTE
msHtml.Invoke ("ExecCommand", 17, 0, 0, 0) ' 17 = CUT
msHtml.Invoke ("ExecCommand", 12, 0, 0, 0) ' 12 = paste

You MUST find a documentation on the ShockWavaFlash !

-------------------------------------------------------------------------

And BTW, I am calm :)

Jacques

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

This may help, but there's a lot of lore work... It will probably
be too slow for long texts until we have P IX 10000 MHz.

Jacques

' ----------------------------------
$ESCAPECHARS ON
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
Declare Sub OnClose_frmRapidView
'
Sub DummyProc
End Sub
CREATE frmRapidView AS QFORM
Autoscroll = false
WindowState = wsMaximized
Caption = "Demo RQ & HTML"
Visible = True
WndProc = DummyProc
CREATE msHTML AS QOLECONTAINER
Align = alClient
createObject("Shell.Explorer.1")
END CREATE
Visible = False
Onclose = OnClose_frmRapidView
End Create

c = "about:<head><basefont face=\"courrier\"></head><body scroll=\"no\">"
c = c + "<center><br><h1>Text Out, Anything you want<BR> One more line<br>WILL BE TOO SLOW</center></h1>"
c = c + "<H2><HR><U>GOOD LUCK</U></H2></basefont></head>"
msHTML.navigate(c)

Sub OnClose_frmRapidView
application.Terminate
End
End Sub
'
' ********************************************
frmRapidView.ShowModal
' ********************************************
' -------------------------------------------------

Tommy Watt wrote:

> Anyone know if there is a control for RapidQ to view HTML? It doesnt need to be a feature rich/full browser, just view HTML, particular colors and backgrounds of text, and fonts. Speed is important.
>
> Thank you,
>
> Tommy

You should be able to use QOleObject. See the docs for an example.
You should be able to call its properties and methods much like you
do in VB. However events I don't think are supported.

MSXML is a COM based dll. The only functions it exports mostly
relate to registering the dll.

--- In rapidq@y..., Leo Dicaprio <Nadesom@y...> wrote:
>
> Under VB, after msxml.dll is included in the project,
> i can use it by
> Dim xml As New MSXML.DOMDocument
> and:
> xml.Load ("test.xml")
>
> Any idea under RQ?
> I cann't found the DLL's Export Table using Quick
> View.

Thanks.

I should read Yu' Doc ch.15. COM Programming.

Here is a code.

Another question now is how can we use xml under linux
with RQ.

DIM Obj AS QOLEOBJECT

Obj.CreateObject("Microsoft.XMLDOM")
Obj.load("car.xml")

print Obj.xml

showmessage "ok"

----- Original Message -----
From: "petek1827" <petek1827@yahoo.com>
To: <rapidq@yahoogroups.com>
Sent: Monday, February 25, 2002 3:21 PM
Subject: [rapidq] Re: use msxml.dll under rapidq

> You should be able to use QOleObject. See the docs
for an example.
> You should be able to call its properties and
methods much like you
> do in VB. However events I don't think are
supported.
>

Great!

Also i foud, that its possible to use CreateObject, which working
much faster and warantied, that it will supported by remote server.

Guys, look at this short example:

$APPTYPE CGI
$INCLUDE "INCLUDES/CGI.INC"

DIM ADODB AS QOLEOBJECT
DIM ConnString AS STRING
DIM strSQL AS STRING

ADODB.CREATEOBJECT("ADODB.Connection")

ConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=db1.mdb;"
ADODB.Open ConnString

RSF = ADODB.EXECUTE("SELECT * FROM SiteAdmin")
' -----------------------------------------------------------
' Next part not working:
DO
RSF.MOVENEXT
RESPONSEWRITE "<a href='?option=someaction'>" & RSF("DDD") & "</a>"
LOOP WHILE NOT RSF.EOF

So, im getting conecction to database (any DSN or DSN-less), im
allowed to execute SQL Queryes, but how to use Recordsets here?

Is any ideas about it?

--- In rapidq@y..., "edamian919" <edamian919@y...> wrote:
> hello, yes there's one way, you have to use the odbc driver for
> msaccess,
> On the weekend i'll send you an example
>
> bye
> --- In rapidq@y..., "bol_spider" <bol_spider@y...> wrote:
> > Hello, people!
> >
> > IS ANY WAY to use MS Access MDB bases?

' Declaring Application type
$APPTYPE CGI
' Including Web.Objects
$INCLUDE "OBJ_HTTP.INC"
' Including Rapid-Q Constants
$INCLUDE "RAPIDQ.INC"

' This line will break execution if file requested not by browser
IF REQUEST.HTTP_USER_AGENT ="" THEN END

' If requested by browser, generate response
' with proper status code.
' for IE you can generate always "200 OK" status, because IE
' don't see any difference in response codes.
RESPONSE.STATUS "200 OK"
' Declaring content type
RESPONSE.CONTENTTYPE "text/html"
' Also you can add/declare DocType when you using XML, WML and etc...
' And now send this generated header.
' Without sending header u will get CGI Error
RESPONSE.SENDHEADER

DIM USERNAME AS STRING
DIM PASSWORD AS STRING
' Here we looking for some values posted from browser
USERNAME = HTTP.GETVALUE("username")
PASSWORD = HTTP.GETVALUE("password")

DIM BUF AS STRING
' Now loading some page, which contains "keywords"
' We using keyword on page for automate content management process
' In this case we will nee to design only one page, which will be
' as basement for whole web site.
BUF = FSO.FILETOBUFFER("templates/t_index.htm")
' So, page loaded to buffer and now we processing keywords
BUF = REPLACESUBSTR$(BUF,"{@footer}","Copyright © 2002")
' and now checking for user settings
' if we have a "guest", show him a login form, which also prepared
' as "template"
IF USERNAME="" AND PASSWORD ="" THEN
DIM LOGINFORMCONTENT AS STRING
LOGINFORMCONTENT = FSO.FILETOBUFFER
("templates/t_loginform.htm")
BUF = REPLACESUBSTR$(BUF,"{@header}","Please enter
your account details:")
BUF =
REPLACESUBSTR$(BUF,"{@menucontent}",LoginFormContent)
END IF
' Now we displaying generated HTML content to user and he will
' see it as normal web page.
RESPONSE.WRITE BUF
' Here small example of using "Response" object
RESPONSE.WRITE "<HR NOSHADE SIZE=1 COLOR=RED>"
RESPONSE.WRITE "REFERER: " & REQUEST.HTTP_REFERER & "<BR>"
RESPONSE.WRITE "PATH_TRANSLATED:" & REQUEST.PATH_TRANSLATED
& "<BR>"
RESPONSE.WRITE "REQUEST_METHOD: " & REQUEST.REQUEST_METHOD
& "<BR>"
RESPONSE.WRITE "QUERY_STRING: " & REQUEST.QUERY_STRING
& "<BR>"
RESPONSE.WRITE "DECODED STRING: " & HTTP.HTMLDECODE
(REQUEST.QUERY_STRING) & "<BR>"

Try VBS first to verify your COM installation:

DIM INETCONTROL
set INETCONTROL=wscript.CREATEOBJECT("InetCtlsObjects.Inet")

VBS has the best compatibility for MS COM. I ever found an object works fine with VBS but failed in PHP script. Maybe RQ also.

Guidance

Exception EOleSysError in module fsodemo.exe at 0007E571.
Invalid class string.

DIM INETCONTROL AS QOLEOBJECT
INETCONTROL.CREATEOBJECT("InetCtlsObjects.Inet")

compiling fine, but execution faulted. is any ideas why?

Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com


rq_math.inc

'------------------------------------------------------------------
'>>>>>>   rq-math.inc   Version 1.1 (09-2000)<<<<<<<<<<<<<<<<<<<<
'------------------------------------------------------------------
'                Rapid-Q Mathematics $Includes
'   written by Bruno Schäfer <bup.schaefer@planet-interkom.de>
'------------------------------------------------------------------
'  !!!!    All angles are in radiant !!!   ... but not in function DEG2RAD  :-)
' If an ERROR occurs in some functions there will be a Messagebox
' and the returned value is ZERO !!!!!
'
' Rapid-Q - http://www.basicguru.com/abc/rapidq/
'           http://www.egroups.com/group/rapidq
' This .inc.-file  contains additional commonly used mathematical functions
' and utilities (in addition to the standard mathematical functions
' supported in William Yu's Rapid-Q)
' This is a work in progress, so don't expect too much.
' Many thanks for ideas and remarks:
' send an e-mail to (bup.schaefer@planet-interkom.de) or the egroup.
' planned functions in next versions:
' better trapping of ERRORs and of undefined values  ...and more functions:
' different round methods,' vectoroperations, derivation, integral-functions,
' more natural constants,scientific function,' arithmetical and statistical
' functions (perhaps in own $includes ???)...
'==============================================================================
CONST rqPI = 3.141592654 '(This is PI)
CONST rqE = 2.718281828  '(This is e)
CONST rqh = 6.62620 * 10 ^ (-34)   '(J*S: Planck const.)
CONST rqc = 2.997925 * 10 ^ 8      '(m/s: velocity of light in vacuum)
'-------------------------------------------------------------------------------
'   ACOSH() returns the hyperbolic areacosine of x
'-------------------------------------------------------------------------------
Function ACOSH(value AS DOUBLE) AS DOUBLE
  SELECT CASE value
   CASE IS < 1
    MessageBox("Invalid Argument !!!", "ACOSH - Error", 0)
   CASE IS >= 1
    ACOSH =  ( LOG (value + SQR( value ^ 2 - 1 )))
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOT() returns the arccotangent of x
'-------------------------------------------------------------------------------
Function ACOT(value AS DOUBLE) AS DOUBLE
 ACOT = ((rqPI / 2) - ATAN (value))
End Function
'-------------------------------------------------------------------------------
'   ACOTH() returns the hyperbolic areacotangent of x
'-------------------------------------------------------------------------------
Function ACOTH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS > 1
   ACOTH =  (LOG((value + 1) / (value - 1)) * 0.5)
  CASE ELSE
   MessageBox("ERROR: Invalid Argument !!!", "ACOTH - Error", 0)
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOSEC() returns the arccosecans of x
'-------------------------------------------------------------------------------
Function ACOSEC(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS < 1
   MessageBox("Invalid Argument !!!", "ACOSEC - Error", 0)
  CASE ELSE
   ACOSEC =  (ASIN(1/value))
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   ACOSECH() returns the hyperbolic arccosecans of x
'-------------------------------------------------------------------------------
Function ACOSECH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS(value)
  CASE = 0
   MessageBox("Invalid Argument !!!", "ACOSECH - Error", 0)
  CASE ELSE
   ACOSECH =  (ASINH(1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ADDZ() returns the sum of two complex numbers
'-------------------------------------------------------------------------------
Function ADDZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 + re2
    Z(1) = im1 + im2
    Z(2) = 0
    Z(3) = 0
    ADDZ = Z()
End Function
'-------------------------------------------------------------------------------
'   ASINH() returns the hyperbolic areasine of x
'-------------------------------------------------------------------------------
Function ASINH(value AS DOUBLE) AS DOUBLE
 ASINH = LOG (value + (SQR(value * value + 1)))
End Function
'-------------------------------------------------------------------------------
'   ASEC() returns the arccosecans of x
'-------------------------------------------------------------------------------
Function ASEC(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS < 1
    MessageBox("ERROR:Invalid Argument !!!", "ASEC - Error", 0)
  CASE ELSE
   ASEC =  (rqPI / 2 - ASIN( 1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ASECH() returns the hyperbolic arccosecans of x
'-------------------------------------------------------------------------------
Function ASECH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS (value)
  CASE IS > 1
   MessageBox("ERROR:Invalid Argument !!!", "ASECH - Error", 0)
  CASE IS <= 0
   MessageBox("ERROR:Invalid Argument !!!", "ASECH - Error", 0)
  CASE ELSE
   ASECH = (ACOSH(1 / value))
 END SELECT
End Function
'-------------------------------------------------------------------------------
'   ATANH() returns the hyperbolic areatangent of x
'-------------------------------------------------------------------------------
Function ATANH(value AS DOUBLE) AS DOUBLE
 SELECT CASE ABS(value)
  CASE IS < 1
   ATANH = (LOG((1 + value) / (1 - value)) * 0.5)
  CASE 0
   ATANH = 1
  CASE ELSE
   MessageBox("ERROR:Invalid Argument !!!", "ATANH - Error", 0)
 END SELECT
End Function
'--------------------------------------------------------------------------------
'   CONJZ() returns the conjugated complex number of a complex number
'--------------------------------------------------------------------------------
Function CONJZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(1) = im * (-1)
    CONJZ = Z()
End Function
'-------------------------------------------------------------------------------
'   COSEC() returns the cosecans of x
'-------------------------------------------------------------------------------
Function COSEC(value AS DOUBLE) AS DOUBLE
 COSEC = 1 / SIN(value)
End Function
'-------------------------------------------------------------------------------
'   COSECH() returns the hyperbolic cosecans of x
'-------------------------------------------------------------------------------
Function COSECH(value AS DOUBLE) AS DOUBLE
 COSECH = (2 / (EXP(value) - EXP(value * -1)))
End Function
'-------------------------------------------------------------------------------
'   COSH() returns the hyperbolic cosine of x
'-------------------------------------------------------------------------------
Function COSH(value AS DOUBLE) AS DOUBLE
 COSH = (0.5 * (EXP(value) + EXP(value * -1)))
 IF value = 0 THEN COSH = 1
End Function
'--------------------------------------------------------------------------------
'   COSZ() returns the cosine of a complex number
'--------------------------------------------------------------------------------
Function COSZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = COS(re) * COSH(im)
    Z(1) = SIN(re) * SINH(im)
    COSZ = Z()
End Function
'--------------------------------------------------------------------------------
'   COSHZ() sine of a complex number
'--------------------------------------------------------------------------------
Function COSHZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = COSH(re) * COS(im)
    Z(1) = SINH(re) * SIN(im)
    COSHZ = Z()
End Function
'-------------------------------------------------------------------------------
'   COT() returns the cotangent of x
'-------------------------------------------------------------------------------
Function COT(value AS DOUBLE) AS DOUBLE
 COT = 1 / TAN(value)
End Function
'-------------------------------------------------------------------------------
'   COTH() returns the hyperbolic cotangent of x
'-------------------------------------------------------------------------------
Function COTH(value AS DOUBLE) AS DOUBLE
 SELECT CASE value
  CASE 0
   MessageBox("ERROR: Invalid Argument !!!", "COTH - Error", 0)
  CASE ELSE
   COTH = COSH(value) / SINH(value)
  END SELECT
End Function
'-------------------------------------------------------------------------------
'   DEG2RAD() returns radians instead of degrees
'-------------------------------------------------------------------------------
Function DEG2RAD(value AS DOUBLE) AS DOUBLE
 DEG2RAD = value * 0.017453
End Function
'--------------------------------------------------------------------------------
'   DIVZ() returns the quotient of two complex numbers
'--------------------------------------------------------------------------------
'   DIVZ() = Z1 / Z2
Function DIVZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = (req * re2 + im1 * im2) / (re2*re2 + im2*im2)
    Z(1) = (-re1 * im2 + re2 * im1) / (re2 * re2 + im2 * im2)
    Z(2) = 0
    Z(3) = 0
    DIVZ = Z()
End Function
'--------------------------------------------------------------------------------
'   EVEN() returns "1" (= true) if a number is even, else "0"
'--------------------------------------------------------------------------------
Function EVEN(value AS INTEGER ) AS INTEGER
   IF FRAC(value / 2) = 0 THEN
    EVEN = 1
   ELSE
    EVEN = 0
   END IF
End Function
'--------------------------------------------------------------------------------
'    EXPZ() returns the exponential value of a complex number (= e^z)
'--------------------------------------------------------------------------------
Function EXPZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : a = Z(3)
    Z(0) = EXP(re) * COS (im)
    Z(1) = EXP(re) * SIN (im)
    EXPZ = Z()
End Function
'-------------------------------------------------------------------------------
'   FAC() returns the factorial of the integer x
'-------------------------------------------------------------------------------
Function FAC(value AS LONG) AS LONG
 SELECT CASE value
  CASE IS < 13
   N = value
   value = 1
    For I = 1 to N
     value = value * I
    NEXT I
   FAC = value
  CASE IS > 12
   MessageBox("ERROR: Invalid Argument !!! Argument must <= 12!", "FAC - Error", 0)
 END SELECT
End Function
'--------------------------------------------------------------------------------
'   FIX() truncates the argument to closest integer value towards zero
'--------------------------------------------------------------------------------

'-------------------------------------------------------------------------------
'   GCD() returns the greatest common denominator of two integers
'   based on the Euclidean algorithm
'-------------------------------------------------------------------------------
Function GCD(value1 AS DOUBLE, value2 AS DOUBLE ) AS LONG
  ERROR% = 0
  SELECT CASE value1
   CASE IS <> INT(value1) 'Integer check
    ERROR% = 1
   CASE 0                 'ZERO check
    ERROR% = 2
  END SELECT
  SELECT CASE value2
   CASE IS <> INT(value2) 'Integer check
    ERROR% = 1
   CASE 0                 'ZERO Check
    ERROR% = 2
  END SELECT
  SELECT CASE ERROR%
   CASE 0
    value1 = ABS(value1) : value2 = ABS(value2)    'Euclidean algorithm
     DO
      Res = value1 - value2 * INT(value1/value2)
      IF Res = 0 THEN GCD = value2
      value1 = value2
      value2 = Res
     LOOP UNTIL Res = 0
   CASE 1
     GCD = 0
     MessageBox("Invalid Argument (no INTEGER)!!!", "GCD - Error", 0)
   CASE 2
     GCD = 0
     MessageBox("Invalid Argument (ZERO)!!!", "GCD - Error", 0)
  END SELECT
End Function
'--------------------------------------------------------------------------------
'   INVZ() returns the reciprocal value of a complex number
'--------------------------------------------------------------------------------
' INVZ(Z) = 1/Z
Function INVZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  re / ( re * re + im * im)
    Z(1) =  im / ( re * re + im * im)
    INVZ = Z()
End Function
'--------------------------------------------------------------------------------
'     LOGZ() returns the natural logarithm of a complex number
'--------------------------------------------------------------------------------
Function LOGZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  LOG (re / ( re * re + im * im))
    Z(1) =  im / ( re * re + im * im)
    LOGZ = Z()
End Function
'--------------------------------------------------------------------------------
'    LOG10() returns the base 10 log of x
'--------------------------------------------------------------------------------
 Function LOG10(value AS DOUBLE) AS DOUBLE
  LOG10 = (LOG (value) * LOG(10 * rqE))
 End Function
'--------------------------------------------------------------------------------
'     LOG10Z() returns the 10-th logarithm of z (base is 10)
'--------------------------------------------------------------------------------
Function LOG10Z(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) =  LOG (re / ( re * re + im * im))/ LOG (10)
    Z(1) =  im / ( re * re + im * im) / LOG (10)
    LOG10Z = Z()
End Function
'--------------------------------------------------------------------------------
'     LOGAZ() returns the a-th logarithm of z (base is a)
'--------------------------------------------------------------------------------
Function LOGAZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : a = Z(3)
    Z(0) =  LOG (re / ( re * re + im * im))/ LOG (a)
    Z(1) =  im / ( re * re + im * im) / LOG (a)
    LOGAZ = Z()
End Function
'--------------------------------------------------------------------------------
'    MAGZ() returns the absolute value of a complex number
'--------------------------------------------------------------------------------
Function MAGZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im)   '= |Z|
    Z(1) = 0
    MAGZ = Z()
End Function
'--------------------------------------------------------------------------------
'    MULZ() returns the product of two complex numbers
'--------------------------------------------------------------------------------
Function MULZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 * re2 - im1 * im2
    Z(1) = re1 * im2 + re2 * im1
    Z(2) = 0
    Z(3) = 0
    MULZ = Z()
End Function
'--------------------------------------------------------------------------------
'    NORZ() returns the normal form of a complex value
'--------------------------------------------------------------------------------
' Z = x + iy = re + i*im   =   r*e^i*theta
Function NORZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im)    ' = r = value
    Z(1) = ATAN (im / re)             ' = theta = argument
    NORZ = Z()                        'Z() = (r,theta)
End Function
'--------------------------------------------------------------------------------
'   ODD() returns "1" (=true) if a number(INTEGER) is odd
'--------------------------------------------------------------------------------
Function ODD(value AS INTEGER ) AS INTEGER
   IF FRAC( value / 2 ) <> 0 THEN
      ODD = 1
    ELSE
      ODD = 0
   END IF
End Function
'--------------------------------------------------------------------------------
'   POLZ() returns Z IN the polar coordinate system
'--------------------------------------------------------------------------------
' Transformation from    z = x + iy     to     z = r*cos((phi) + r*i*sin(phi)
Function POLZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SQR( re * re + im * im) * COS(ATAN (im / re))
    Z(1) = SQR( re * re + im * im) * SIN(ATAN (im / re))
    POLZ = Z()
End Function
'--------------------------------------------------------------------------------
'    POWZ() returns the power n  of a complex number = (x+iy)^n = z^n
'--------------------------------------------------------------------------------
 Function POWZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1) : expo = Z(2)
     Z(0) =(SQR( re * re + im * im)) ^ expo * COS(expo * ATAN (im / re) )
     Z(1) =(SQR( re * re + im * im)) ^ expo * SIN(expo * ATAN (im / re) )
     Z(2) = 0
    POWZ = Z()
End Function
'--------------------------------------------------------------------------------
'   RAD2DEG() returns degrees instead of radians
'--------------------------------------------------------------------------------
Function RAD2DEG(value AS DOUBLE) AS DOUBLE
 RAD2DEG = value / 0.017453
End Function
'--------------------------------------------------------------------------------
'   SEC() returns the secans of x
'--------------------------------------------------------------------------------
Function SEC(value AS DOUBLE) AS DOUBLE
 SEC = 1 / COS(value)
End Function
'--------------------------------------------------------------------------------
'   SECH() returns the hyperbolic secans of x
'--------------------------------------------------------------------------------
Function SECH(value AS DOUBLE) AS DOUBLE
 SECH = (2 / (EXP(value) + EXP(value * -1)))
' SECH = 1/ COSH (value)
End Function
'--------------------------------------------------------------------------------
'   SINH() returns the hyperbolic sine of x
'--------------------------------------------------------------------------------
Function SINH(value AS DOUBLE) AS DOUBLE
 SINH = (0.5 * (EXP(value) - EXP(value * -1)))
  IF value = 0 THEN SINH = 0
End Function
'--------------------------------------------------------------------------------
'   SINZ() sine of a complex number
'--------------------------------------------------------------------------------
Function SINZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SIN(re) * COSH(im)
    Z(1) = COS(re) * SINH(im)
    SINZ = Z()
End Function
'--------------------------------------------------------------------------------
'   SINHZ() sine of a complex number
'--------------------------------------------------------------------------------
Function SINHZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = SINH(re) * COS(im)
    Z(1) = COSH(re) * SIN(im)
    SINHZ = Z()
End Function
'--------------------------------------------------------------------------------
'   SQRZ() returns the square root of acomplex number
'--------------------------------------------------------------------------------
Function SQRZ(Z()AS DOUBLE ) AS DOUBLE
    re = Z(0): im = Z(1)
    Z(0) = ((re + SQR(re * re + im * im)) * 0.5) ^ 0.5
    Z(1) = (((re * -1) + SQR(re * re + im * im)) * 0.5) ^ 0.5
    SQRZ = Z()
End Function
'-------------------------------------------------------------------------------
'   SUBZ() returns the difference of two complex numbers
'-------------------------------------------------------------------------------
Function SUBZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1) : re2 = Z(2) : im2 = Z(3)
    Z(0) = re1 - re2
    Z(1) = im1 - im2
    Z(2) = 0
    Z(3) = 0
    SUBZ = Z()
End Function
'--------------------------------------------------------------------------------
'   TANH() returns the hyperbolic tangent of x
'--------------------------------------------------------------------------------
Function TANH(value AS DOUBLE) AS DOUBLE
    TANH = SINH(value) / COSH(value)
    IF value = 0 THEN TANH = 0
End Function
'--------------------------------------------------------------------------------
'   TANZ() returns the tangent of a complex number
'--------------------------------------------------------------------------------
Function TANZ(Z()AS DOUBLE ) AS DOUBLE
    re1 = Z(0): im1 = Z(1)
    Z(0) =  SIN(2 * re) / (COS(2 * re) + COSH(2 * im))
    Z(1) =  SINH(2 * im) / (COS(2 * re) + COSH(2 * im))
    TANZ = Z()
End Function

'=====================================================================================
'      >>>>> reserved words  <<<<<<
'=====================================================================================
'ACOSH, ACOT, ACOSEC, ACOSECH, ADDZ*, ASEC, ASECH, ATANH,CONJZ*, COSEC, COSECH, COSH,
'COSZ*, COSHZ*, COT, COTH, DEG2RAD, DIVZ*,EVEN*,EXPZ*, FAC, GCD*, INVZ*  LOG10,LOG10Z*,
'LOGAZ*, LOGZ*, MAGZ*, MULZ*, NORZ*,ODD*, POLZ*, POWZ*, RAD2DEG, RQE, RQPI, SEC, SECH,
'SINH, SINZ*,SINHZ*, SQRZ*, SUBZ*,TANH, TANZ*
'*: new functions in this version


RQTinyJP Package

-----------------------------------------------------------------------------
RQTINYJP PACKAGE October 17th, 2003 by Jacques PHILIPPE
-----------------------------------------------------------------------------
INTRODUCTION
------------
Pavel Minayev's RQTINY32.LIB and RQTINYCC.LIB allows to generate Tiny
executables but these executables does not accept Command Line arguments.
Based on the same idea and helped by his docs, here are RQTINY32.JP and
RQTINYCC.JP written in BCX(*), these one accept 200 Arguments in Command Line
and the BCX sources are available. You can rename RQTINY32.JP in RQTINY32.LIB
and use it instead of your previous RQTINY32.LIB. Same for RQTINYCC.JP to be
renamed RQTINYCC.LIB

Dont forget that the memory leak is still present in the RAPIDQCC.DLL and
RAPIDQ32.DLL, so your Tiny executables still 'leak'. That leak have been
solved by Doctor Electron in May 2003, for three years we have lived with
the problem. So maybe we can still live with it in our Tiny Executables ?

Tiny Executables are typically less than 20 KBytes and can be as short as
6 KBytes !

(*) BCX : Basic to C Translator, by Kevin Diggins. BCX creates fast and small
size executables.
-----------------------------------------------------------------------------
RAPIDQ BYTECODE INFOS
---------------------
RapidQ allows you to compile your sources in bytecode, for this you have to
use the -b option when calling the RC.EXE RapidQ compiler :

rc.exe -b MyCode.Bas

The result of this will be a file named :

MyCode.Bc

In the Files RapidQCC.DLL and RapidQ32.DLL are the two functions
RQ_ExecuteFile and RQ_ExecuteMemory which executes these RapidQ bytecodes
(see ExecuteByteCode.Bas in this package). Theses DLL can be downloaded at
http://www.basicguru.com/???/RQDLLS.ZIP

To Execute these bytecodes RAPIDQ32.DLL and RAPIDQCC.DLL must be 'loaded' ;
an easy way to do this is copy them in the c:\Windows directory (for WIN98).

RQTINY32.JP and RQTINYCC.JP are simply two executables -renamed .JP- to which
you just binary append the compiled bytecode and then rename the result
MyCode.Exe. RQTINY32.JP must be used for GUI applications and RQTINYCC.JP
must be used for CONSOLE applications.

The last for bytes of the bytecode files is the length of the bytecode. That
length does not include the last for bytes (who contain that length :).
That lenght is stored as this : LSW_LSB, LSW_MSB, MSW_LSB, MSM_MSB
-----------------------------------------------------------------------------
THIS PACKAGE :
------------
In this Package, you will also find :
- CmdConTest.Bas and CmdConTest.Bc Written in RapidQ
Console bytecode used in the Console examples of this package. A console
software displaying all the Command Line arguments it received.

- CmdGuiTest.Bas and CmdGuiTest.Bc Written in RapidQ
Console bytecode used in the Gui examples of this package. A Gui software
displaying all the Command Line arguments it received.

- Tiny32_Cmd.Bas and Tiny32_Cmd.Exe Written In BCX
executing a GUI bytecode file whose name is received as a Command Line
argument

- TinyCC_Cmd.Bas and TinyCC_Cmd.Exe Written In BCX
executing a Console bytecode file whose name is received as a Command Line
argument

- TinyBuilderDemo.Bas is Written in RapidQ
demonstrates howto build an executable from a bytecode file and
RQTINYCC.JP or RQTINY32.JP
will binary append :
RQTINY32.JP + CmdGuiTest.Bc to CmdGuiTest.Exe
and
RQTINYCC.JP + CmdConTest.Bc to CmdConTest.Exe

- TinyBuilder.Bas A rapidQ Code. NEW October 17th, 2003
New version of TinyBuilder posted on October 17th, 2003 in Yahoo Group
RapidQ message number 20390 by Manuel Candela.
Build an .exe with any .bc file passed as command line argument
A second argument different of "0" will build a GUI application.
If second command line argument is not passed or if its value is "0"
will build a console application.

USAGE : TinyBuilder yourPathFileName.bc [0|1] 1 for GUI application

- ExecuteByteCode.Bas
is the file named Test.Bas in the RQDLLS.ZIP file from www.basicguru.com
It shows how to use the functions RQ_ExecuteMemory and RQ_ExecuteFile
from RAPIDQ32.DLL and RAPIDQCC.DLL to execute bytecode.

- Test.Bat
A Demo batch file that runs the previous executables with arguments.

-----------------------------------------------------------------------------

Jacques

' ----- RAPIDQ BC to EXE BUILDER DEMO ---------------------------------------
Dim bcFile As QFileStream
Dim jpFile As QFileStream
Dim exeFile As QFileStream
DefStr sBc, sJp, sExe

bcFile.Open ("MyCode.bc", fmOpenRead)
jpFile.Open ("RQTINY32.JP", fmOpenRead) ' RQTINTCC.JP for console application
exeFile.Open ("MyCode.Exe", fmCreate)
sBc = bcFile.ReadBinStr(bcFile.Size)
sJp = jpFile.ReadBinStr(jpFile.Size)
exeFile.WriteBinStr (sJp, jpFile.Size)
exeFile.WriteBinStr (sbc, bcFile.Size)
exeFile.Close
jpFile.Close
bcFile.Close
' ---------------------------------------------------------------------------

-----------------------------------------------------------------------------
Version 17th october 2003 Modified by TinyBuilder.Bas
- Now accepts any .bc file as argument to build its .exe
- check too the existence of used files
- previous version of june 17th, 2003 renamed TinyBuilderDemo.Bas
Version 17th june 2003 ... minor forgotten changes :)
Version 16th june 2003
-----------------------------------------------------------------------------


Site Map

Site Index

Existing Files

appcredim.gif
chap10d1.gif
chap10d2.gif
chap12d1.gif
chap13d1.gif
chap13d2.gif
chap13d3.gif
chap13d4.gif
chap14d1.gif
chap4d1.gif
chap5d1.gif
chap5d2.gif
chap5d3.gif
chap5d4.gif
chap5d5.gif
chap5d6.gif
chap5d7.gif
chap5d8.gif
chap9d1.gif
chapter1.html
chapter10.html
chapter11.html
chapter12.html
chapter13.html
chapter14.html
chapter15.html
chapter2.html
chapter3.html
chapter4.html
chapter5.html
chapter6.html
chapter7.html
chapter8.html
chapter9.html
conditions.html
console.html
consoledetail.html
contents.html
datatypes.html
defs.html
gotos.html
index.html
indexa.html
indexalfa.html
indextitlu.html
internal.html
intro.html
loops.html
methods.html
operators.html
other.html
other1.html
otherdetail.html
PREF01.html
preface.html
procs.html
qapplication.html
qbitmap.html
qbutton.html
qcanvas.html
qcheckbox.html
qclipboard.html
qcombobox.html
qcomport.html
qcoolbtn.html
qd3dface.html
qd3dframe.html
qd3dlight.html
qd3dmesh.html
qd3dmeshbuilder.html
qd3dtexture.html
qd3dvector.html
qd3dvisual.html
qd3dwrap.html
qdirtree.html
qdximagelist.html
qdxscreen.html
qdxsound.html
qdxtimer.html
qedit.html
qfilelistbox.html
qfilestream.html
qfont.html
qfontdialog.html
qform.html
qgauge.html
qglassframe.html
qgroupbox.html
qheader.html
qimage.html
qimagelist.html
qlabel.html
qlistbox.html
qlistview.html
qmainmenu.html
qmemorystream.html
qmenuitem.html
qmysql.html
qnotifyicondata.html
qolecontainer.html
qoleobject.html
qopendialog.html
qoutline.html
qovalbtn.html
qpanel.html
qpopupmenu.html
qprinter.html
qradiobutton.html
qrect.html
qregistry.html
qrichedit.html
qsavedialog.html
qscrollbar.html
qscrollbox.html
qsocket.html
qsplitter.html
qstatusbar.html
qstringgrid.html
qstringlist.html
qtabcontrol.html
qtimer.html
qtrackbar.html
qtreeview.html
rqlogo.gif
troubles.html
types.html

Rapid-Q Documentation Project (RQDP) | Release 01 Site Index
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | siteindex.html/Serban Stanescu/None/01


Site Map

Rapid-Q Documentation Project (RQDP) | Release 01 Site Map
Credits & Contributions: | Issues:
William Yu | Original Documentation
Stanescu Serban | New documents, Project management
Others: | Rapid-Q Groups, Yahoo eGroups.
Current Document/Author/Revision/Release | sitemap.html/Serban Stanescu/None/01

Listing generated on 18.06.2001 12:08:13 by Directory Lister v0.3 (C) Copyright 2001 Leszek Skorczynski

d:\Rapid-Q\RapidQProjects\Manual\                                                     1169350
---------------------------------------------------------------------------------------------
appcredim.gif                                   980 20.08.2000
askeyword.html                                 3785 16.06.2001
backgdleather4.gif                             1283 16.06.2001
chap10d1.gif                                   3465 28.08.1999
chap10d2.gif                                   4118 29.08.1999
chap12d1.gif                                   3779 19.02.2000
chap13d1.gif                                   2547 30.03.2000
chap13d2.gif                                   4565 30.03.2000
chap13d3.gif                                   7289 30.03.2000
chap13d4.gif                                  14524 30.03.2000
chap14d1.gif                                   3450 27.04.2000
chap4d1.gif                                    6390 18.07.1999
chap5d1.gif                                    1311 20.07.1999
chap5d2.gif                                    2353 20.07.1999
chap5d3.gif                                    2360 20.07.1999
chap5d4.gif                                    2221 20.07.1999
chap5d5.gif                                    2170 20.07.1999
chap5d6.gif                                    3167 20.07.1999
chap5d7.gif                                    3749 21.07.1999
chap5d8.gif                                    2740 21.07.1999
chap9d1.gif                                    9510 28.08.1999
chapter1.html                                  6212 09.06.2001
chapter10.html                                28234 07.06.2001
chapter11.html                                 6957 12.06.2001
chapter12.html                                12647 01.08.2000
chapter13.html                                12087 29.04.2000
chapter14.html                                15174 03.08.2000
chapter15.html                                 7082 03.08.2000
chapter2.html                                  7818 15.08.2000
chapter3.html                                 32318 02.06.2001
chapter4.html                                  9741 22.05.2000
chapter5.html                                 11937 24.05.2001
chapter6.html                                  9567 17.06.2001
chapter7.html                                  5739 09.08.2000
chapter8.html                                  4913 09.08.2000
chapter9.html                                 18114 16.06.2001
chdrive.html                                   4428 16.06.2001
conditions.html                                3443 16.06.2001
console.html                                   4681 18.06.2001
consoledetail.html                            14451 18.06.2001
contents.html                                 28285 23.05.2001
datatypes.html                                 4291 12.06.2001
defs.html                                      1785 26.06.2000
faq.html                                       1472 09.06.2001
faq001.html                                   37595 12.06.2001
faq002.html                                   37261 12.06.2001
faq1a.gif                                      1444 12.06.2001
faqtitle.html                                  1765 12.06.2001
gotos.html                                     4351 12.06.2001
hystory.html                                  13049 18.06.2001
index.html                                     1041 12.06.2001
indexa.html                                   29965 18.06.2001
indexalfa.html                                  468 12.06.2001
indexfaq.html                                 29955 18.06.2001
indexpg.html                                  29978 18.06.2001
indextitlu.html                                1759 12.06.2001
internal.html                                  5581 16.06.2001
intro.html                                     2434 02.06.2001
loops.html                                     3776 12.06.2001
methods.html                                   3181 07.06.2001
operators.html                                 9452 12.06.2001
other.html                                    23295 03.06.2001
otherdetail.html                              83784 17.06.2001
pgcontents.html                                4147 16.06.2001
pgevents.html                                  2387 16.06.2001
pghowto.html                                   2391 16.06.2001
pgintro.html                                   3430 16.06.2001
pgmainpg.html                                   465 11.06.2001
pgmethods.html                                 2387 16.06.2001
pgobjectslist.html                             2403 16.06.2001
pgproperties.html                              2399 16.06.2001
pgsamples.html                                 2405 16.06.2001
pgtemplate.html                                2581 16.06.2001
pgtitle.html                                   1787 16.06.2001
pgtodo.html                                    5097 16.06.2001
pguide.html                                    1459 16.06.2001
pref01.html                                   14660 16.06.2001
preface.html                                   5053 29.07.2000
procs.html                                     5165 07.06.2001
qapplication.html                              5680 18.06.2001
qbitmap.html                                   7900 23.08.2000
qbutton.html                                   8995 23.08.2000
qcanvas.html                                  10618 23.08.2000
qcheckbox.html                                 3454 14.08.2000
qclipboard.html                                5201 20.08.2000
qcombobox.html                                 9134 23.08.2000
qcomport.html                                  7238 26.08.2000
qcoolbtn.html                                  8101 23.08.2000
qd3dface.html                                  5402 04.06.2000
qd3dframe.html                                 4320 19.07.2000
qd3dlight.html                                 2216 29.04.2000
qd3dmesh.html                                  1869 29.04.2000
qd3dmeshbuilder.html                           3571 31.05.2000
qd3dtexture.html                               1777 31.05.2000
qd3dvector.html                                2112 31.05.2000
qd3dvisual.html                                1761 31.05.2000
qd3dwrap.html                                  2001 18.07.2000
qdirtree.html                                  4847 06.05.2000
qdximagelist.html                              6088 24.08.2000
qdxscreen.html                                 9370 26.08.2000
qdxsound.html                                 10721 26.08.2000
qdxtimer.html                                  2150 26.08.2000
qedit.html                                     9923 26.08.2000
qfilelistbox.html                              8894 24.08.2000
qfilestream.html                               9469 24.08.2000
qfont.html                                     2758 25.06.2000
qfontdialog.html                               3362 29.04.2000
qform.html                                    22293 24.08.2000
qgauge.html                                    3769 25.08.2000
qglassframe.html                               3453 29.04.2000
qgroupbox.html                                 3816 14.08.2000
qheader.html                                   8434 14.08.2000
qimage.html                                    8303 25.08.2000
qimagelist.html                                6972 25.08.2000
qlabel.html                                    7185 25.08.2000
qlistbox.html                                 10236 26.08.2000
qlistview.html                                15510 26.08.2000
qmainmenu.html                                 2402 29.08.2000
qmemorystream.html                             8787 24.08.2000
qmenuitem.html                                 5076 29.08.2000
qmysql.html                                   12801 26.08.2000
qnotifyicondata.html                           1232 29.04.2000
qolecontainer.html                             5156 14.08.2000
qoleobject.html                                3935 03.08.2000
qopendialog.html                               2513 03.05.2000
qoutline.html                                  5333 14.08.2000
qovalbtn.html                                  4812 14.08.2000
qpanel.html                                    4549 14.08.2000
qpopupmenu.html                                4327 29.08.2000
qprinter.html                                  8771 18.08.2000
qradiobutton.html                              3616 14.08.2000
qrect.html                                      975 29.04.2000
qregistry.html                                 5535 29.04.2000
qrichedit.html                                 8534 26.08.2000
qsavedialog.html                               2097 29.04.2000
qscrollbar.html                                7484 26.08.2000
qscrollbox.html                                6591 26.08.2000
qsocket.html                                   5709 26.08.2000
qsplitter.html                                 4601 27.08.2000
qstatusbar.html                                4755 27.08.2000
qstringgrid.html                              12901 26.08.2000
qstringlist.html                               4517 23.06.2000
qtabcontrol.html                               6688 14.08.2000
qtimer.html                                    3401 27.08.2000
qtrackbar.html                                 6959 26.08.2000
qtreeview.html                                 8845 14.08.2000
rqlogo.gif                                    16877 31.12.1999
siteindex.html                                 7807 09.06.2001
sitemap.html                                   9722 18.06.2001
troubles.html                                  4418 14.07.2000
types.html                                     3239 07.06.2001


RQDP- By Category

RapidQ Documentation Project

Index: By Category

  • ADDRESS
  • ARRAY
  • CONVERSION
  • ASSEMBLER
  • QComponents
  • CONSOLE
  • DEVICE INPUT/OUTPUT
  • DISPLAY GRAPHICS/IMAGES
  • DIRECTORIES
  • DLL
  • FILES & DIRECTORIES
  • LOOPS
  • MANAGE MEMORY
  • MOUSE
  • PRINTER
  • FUNCTIONS, PROCEDURES & SUBS
  • RESOURCE
  • SORTING
  • STRINGS
  • TYPES
  • VARIABLES
  • VARIANT

FUNCTION

  • MATH
  • ADDRESS
  • String
  • CONVERSION
  • POINTER
  • SYSTEM
  • input/output

OPERATORS

  • Relational
  • Logical
  • Functional

ADDRESS
 CALLBACK
VARPTR
VARPTR$
ARRAY
 INITARRAY
DEF...
DIM
LBOUND
MEMSET
QUICKSORT
REDIM
UBOUND
Array functions
( func_array.inc )
  • ARRAverageSubtract
  • ARRAverage
  • ARRMax
  • ARRMin
  • ArrExtr (Max and Min)
  • ArrRaznost
  • ArrRaznostR
  • ArrSum
  • ArrSumR
  • kTArray
  • kTArrayR
  • Nakopl -Calculate average of function by moving window
  • LoadArray
  • SaveArray
  • ARRAddConst
  • ArrReSample
  • OgibF -build envelope - up and down
CONVERSION
 BIN$
RGB
CEIL
CINT
CLNG
CONVBASE$
FIX
FLOOR
FRAC
HEX$
INT - Convert NumericExpression to a 32-bit INTEGER, truncating decimals

Custom - Conversion.inc
vidnum$ - returns the string representation of a rounded numeric
 Hex2Dec
DecToHex
CNumByte - converts number to bytes sequence
 CByteNum - converts bytes sequence to number
SecTime - return number of seconds from 0:00
DayDate - return number of days from 0 year.
TimeString - convert number of seconds from 0:00 to hh:mm:ss fofmat
CONSOLE
 Writing Console Applications
GET$
INKEY$
INPUT
LOCATE
PCOPY
PEEK
POKE
PRINT
SETCONSOLETITLE
Input/output
INP
INPW
Display graphics/images

DLL
 LIB - How to call a DLL
 LIBRARYINST
UNLOADLIBRARY
Files & Directories:
Introduction to streams
FILEEXISTS
KILL
QFILESTREAM
QFILELISTBOX

Custom file functions
 QSHFileOperation.inc
QSHFileOperation -copy, rename, delete and move files and folders with wildcard and recursivly
-----------------------
 Files.inc
STRIPPATH - Returns file path (without file name)
STIPFILENAME - Returns file name (without path)
STRIPFILEEXT - Returns file extension (like ".exe", ".html" etc.)
FILENAMENOEXT - Returns file name without extension
FULLPATHNOEXT - Returns full path without file extension
C_Style Returns "slashed" path from a "backslashed" one
ChangeFileExt - Changes the extention of FileName to NewExt
 ExtractFileName - Returns only the file name
 ExtractFilePath - returns only the path
ChangeFileName - create string with new
filename with the same path
 ChangeFilePath - create string with new path with the same filename
 io2Rnd - convert text file with single value strings to binary
 Rnd2io - convert binary file with single type value data to text file with single type value strings
FileCopy -Copy FileSrc$ to FileDst$
KillFiles -Kill files in FileName$ with mask
FileSize - returns size of file
 SaveString - save string in file
 LoadString - load string from file

Directories
 CHDIR
CHDRIVE
CURDIR$
DIREXISTS
DIR$
MKDIR
QDIRTREE
RMDIR
Custom - Files.inc
MKSubDir
SubDirCopy -Copy directory with full subdir structure and files
fSubDirCopy-the same, but return result of operation
 DirCopy
KillSubDir -Kill files by mask$ in all subdirs
SYSDIR Retrieves windows shell directories
HOMEDIR The folder where the application is

Functions & Sub
 SUBI, FUNCTIONI, and DLLs
Rapid-Q Sub & Functions
PARAMSTR$
PARAMSTRCOUNT
Loops
 Loops
FOR .. NEXT Loop
EXIT FOR
WHILE .. WEND
EXIT WHILE
DO .. LOOP
EXIT DO
Math Functions
Arithmetic operators
ABS
ACOS
ASIN
ATAN
ATN
COS
DEC
EXP
INC
INV
LOG
MOD
RANDOMIZE
RND
ROUND
SGN
SIN
SQR
TAN
-- custom math func
 ACOSH
ACOT
ACOTH
ACOSEC
ACOSECH
ADDZ
ASINH
ASEC
ASECH
ATANH
CONJZ
COSEC
COSECH
COSH
COSZ
COSHZ
COT
COTH
DEG2RAD
DIVZ
EVEN
EXPZ
FAC
GCD
INVZ
LOG10
LOG10Z
LOGAZ
LOGZ
MAGZ
MULZ
NORZ
ODD
POLZ
POWZ
RAD2DEG
RQE
RQPI
SEC
SECH
SINH
SINZ
SINHZ
SQRZ
SUBZ
TANH
TANZ
FindMax
also see CONVERSION
Manage memory
MEMCMP
MEMCPY
MEMSET
Mouse
 MOUSEX, MOUSEY
POINTER
 BIND
BIND
CALLFUNC
CALLFUNC
PRINTER
 LPRINT
LFLUSH
PRINTER
using
Procedures
RESOURCE
 EXTRACTRESOURCE
RESOURCE
RESOURCECOUNT
SORTING
 QUICKSORT
Strings

Custom functions -
Conversion.inc
Add0Before - A function that pre-padd string with 0's to required Length
 ByteReOrder - A function that reorder bytes in string.
 LIKE - pattern matching routine
TimeString - return time in Houre, Min, Sec.

ASC
BIN$
CHR$
CONVBASE$ - Bin to Hex, ets.
 DATE$ - MM-DD-YYYY
 DELETE$
FIELD$
FORMAT$
HEX$
INKEY$
INSERT$
INSTR
LCASE$
LEFT$
LEN
LTRIM$
MID$
REPLACE$
REPLACESUBSTR$
REVERSE$
RIGHT$
RINSTR
RTRIM$
SPACE$
STRING$
STR$
STRF$
TALLY
TIME$
UCASE$
SYSTEM
 ENVIRON$
custom
 Control.inc - Windows control panel library for Rapid-Q
Types
objects
variants
udts
arrays
 INITARRAY
DIM Array
 Saving/Loading UDTs and Arrays
DEF
Set traps for events and errors
Relational
Functional
Logical
AND
Variables
 Variables and Assignments
BYTE (?)
WORD (??)
DWORD (???)
SHORT (%)
LONG (&) or INTEGER
SINGLE (!)
DOUBLE (#)
STRING ($)
VARIANT


Appendix C: Trouble Shooting

Rapid-Q Documentation by William Yu (c)1999 Appendix C: Trouble Shooting

How to debug your programs

In most cases, it's either a typo, or you're trying to use a function which is not supported under Rapid-Q. This occurs most often when you don't have $TYPECHECK ON. I can't stress this enough, unless you've used Rapid-Q for awhile, I strongly encourage everybody to turn this directive on. Rapid-Q has a very poor checking mechanism, and relies heavily on the programmer to write proper code. For Example:
    PRINT SPC(10)
SPC is not supported in Rapid-Q (in QBasic, SPC just skips spaces). If typechecking is off, the above statement is perfectly valid. SPC is a variable, initialized to 0, and (10) has no effect (ie. the number 10 is pushed on the stack, but no operation is done), so the above output will be 0.

Passing by reference
Only QObjects, Arrays, and Variants are passed by reference, all other variables are passed by value. To pass a variable by reference, you can either explicitly specify this by adding BYREF to your parameter list, or prepend an @ symbol to any variables you want passed by reference when calling the function. Do not use the @ symbol for Arrays, Variants, or QObjects since they are passed by reference by default. Read more about this in Chapter 3 or Appendix C: Procedures. Typechecking is done only for Arrays, Variants, and QObjects, since you can't pass an array of integers to a SUB that expects an array of doubles. You should get an error message if you try this, however, for all other variables which are passed by value, NO checking is done. Which means you could easily pass an integer to a SUB expecting a string. So becareful that you know the type of parameters for your SUB/FUNCTION, since Rapid-Q won't complain. Also make sure if you have DECLARE SUBs, that your SUB will have matching parameters, including matching parameter names.

Using Undocumented features
Rapid-Q has some undocumented features, most of which are in a beta-like stage. You can embed SUBs or FUNCTIONs but they can only be one level deep, and there are some consequences with using them. If you don't know what an embedded SUB looks like, take this for example:
    SUB MySub
      DIM I AS INTEGER

      SUB MyChildSub (X AS INTEGER)
        DIM N AS DOUBLE

        PRINT "In Child Sub"
      END SUB

      CALL MyChildSub(100)
    END SUB
There are some special issues involved, such as all variables are local to the SUBs that follow. Meaning, the variable I is local to SUB MyChildSub. Also, since Rapid-Q doesn't actually clean things up, you can actually call MyChildSub in your main program as well. This is a problem I'm working to correct when I find the time. One other feature which might interest people is postfix ++ and --
    DIM I AS INTEGER

    I++           '-- same as I = I + 1
    I--           '-- same as I = I - 1
    I -= 10       '-- same as DEC(I, 10)
    I += 15       '-- same as INC(I, 15)
Arrays are a special case, anything but Arrays can be incremented/decremented. Rapid-Q doesn't do any optimizing, so the above code and the given translation runs exactly the same.

Other errors
If you don't have a clue as to what is causing your programs to crash, your only hope is to put several PRINT statements in your program and incrementally check each block of code so that it works properly. If you're using Unix or Linux, try using gdb, sometimes it will give you some useful information, but most of the time it's not really that helpful in this kind of setting.

Contents


QListviewEx Tutorial

$include "Qlistviewex.inc"

dim form as qform
with form
.center
end with

' First. We create a new QlistviewEx                  |  - First Steps -
dim list as qlistviewex

' We set the parentpanel Parent window                |
list.Parentpanel.parent = form

' then align the parentpanel to the whole client area |
' (but we could align it in any way)                  |
list.parentpanel.align = 5

' To put other components we use the Draw method.     |
' the draw method is VERY important, because it's used|
' to update the QlistviewEx layout                    |
list.draw

'Ok, now it's time to add some columns. Please note:  |  - Adding Columns -
'if you want the component to run correctly you have  |
'to use this method instead of the normal addcolumns  |
'as this method updates the Columns_Count property too|
list.addcol "First Name/Last Name/City"

' Generally, csv files use ";" as column separator,   |  - Separator -
' but sometimes we need to import files or streams    |
' Which use different separators, like "/" or "," or  |
' strings like "<thisisacolumnseparator>".            |
' this is the purpose of the Separator property:      |
' before loading a file, write this                   |
list.Separator = "/"

'Now we want to load some data in the listview. We    |  - Loading data -
'could use the file included in this package called   |
'database.csv.
list.csvFile = "database.csv"
list.loadfromcsvfile

'You see, columns are a bit narrow, so we would like  |  - Columns width -
'to do something like this :                          |

list.column(0).width = 100
list.column(1).width = 100
list.column(2).width = 100

' And then call the draw method. By the way... have   |
' you already clicked on column headers ?!?  Yes, they|
' start automatic sorting                             |
list.draw

' Maybe we don't want REDs in our list                |  - Excluding items -
list.exclude(1, "red")

' Oh, sorry, we don't want WHITEs                     |  - Reloading data -
list.load
list.exclude (1, "White")

' As long as the program is "alive" (and as long as   |
' you don't change csv) the csv property will keep the|
' original data, so you can use the load method to    |
' reload data from memory                             |

' Now we want to keep only REDs                       |  - Filtering -

list.filter (1, "Red")

' ** NOTE ** Filter and exclude are NOT case sensitive|
' so RED or Red or red or rEd is the same             |

' Now we have to sort items by City. We have 2 ways   |  - Sorting -
' 1 - Click on the "City" column header               |
' 2 - Use the sortby method                           |

list.sortby ("City")

' Unlike filter and exclude Sortby is CASE SENSITIVE  |

' =================================================================|
' Changing layout and other capabilities                           |
' =================================================================|

' You can use QlistviewEx as a common Qlistview       |
' component, so you can add/delete items and subitems |
' as usual

' The "complex" structure of the QlistviewEx component|  - Header -
' allows a lot of extra properties/capabilities. For  |
' Example, if we want to change the header layout we  |
' can treat it as a common Qpanel:                    |

list.header.bevelinner = 1
list.header.color = rgb(20,145,200)
list.header.height = 25
list.header.font.size = 10

' or maybe we don't want to see it...                 |
list.header.visible = 0

' ParentPanel is a Qpanel, so we can do things like   |  - ParentPanel -
list.Parentpanel.align = 1
list.Parentpanel.height = 180

' Column headers are Qcoolbtn, so we can add icons,   |  - Column headers -
' and things like that                                |
list.Colheader(0).bmp = "Star.bmp"
list.draw

' if we don't want flat column headers we just write  |
list.flatheaders = 0
list.draw

' if we want only the first column header to be flat  |
' then:                                               |
list.colheader(0).flat = 1

' ** NOTE ** this property will be overwritten every  |
' time you call the draw method ...                   |

' IMPORTANT. You can change column headers caption    |
' using the .colheader.caption property, but this is  |
' not the correct way. If you want the QlistviewEx to |
' run properly, you must set column width and caption |
' using the QlistviewEx.Column() property and then    |
' call the DRAW method.

' When you manipulate hundreds of items, and you want |  - Fastclear -
' to clear the Qlistview, if you use the clear method |
' you will have to wait some minutes with a slow pc.  |
' in cases like this you can use the Fastclear method |
list.fastclear

' remember: it's not necessary if you have small lists|


Appendix C: User Defined Types

Rapid-Q Documentation by William Yu (c)1999 Appendix C: User Defined Types

Introduction to UDTs

User defined types (or UDTs) are structures that you can use in most BASIC languages, Rapid-Q is no exception.

Using TYPE
Here's an example of a user defined type:
    TYPE TWorld
        CityName(100) AS STRING
        Population(100) AS LONG
    END TYPE

    DIM World AS TWorld
As you can see, you can have arrays within UDTs. You can also create arrays of UDTs:
    TYPE TWorld
        CityName(100) AS STRING
        Population(100) AS LONG
    END TYPE

    DIM Country(100) AS TWorld
There is currently an issue with the memory address of your array (within UDT). Please note that this is hardly ever noticed unless you're going to pass one of these structures to a DLL that require arrays within UDTs. This address problem won't affect your program, but it's hard to explain (without getting too deep). NOTE: it only occurs when you create arrays of UDTs that have arrays within UDTs. In the first example (higher up), there is no address problem since you're not creating an array of UDTs. You can safely pass that to a DLL.

-----------------------------
I Know that there can be arrays of UDT's but why can't they be nested like so ???

Because it's not implemented in RapidQ :(
---------------------------------------
Copying UDTs
To copy 2 UDTs, just assign the two:

    TYPE TStuff
        A AS LONG
        B AS INTEGER
    END TYPE

    DIM S1 AS TStuff
    DIM S2 AS TStuff

    S1 = S2
Contents in S2 are copied to S1. When dealing with arrays within UDTs, the arrays are not copied, only referenced. To copy arrays of UDTs, you'll have to manually copy each one:
    DIM S1(100) AS TStuff
    DIM S2(100) AS TStuff

    FOR I = 1 TO 100
        S1(I) = S2(I)
    NEXT

Unhooking TYPE
There are actually 2 ways to create your types, with TYPE and STRUCT. STRUCT is actually mirrored in TYPE, to unhook the two, you have to undefine TYPE.
    $UNDEF TYPE

    TYPE TWorld
        CityName(100) AS STRING
        Population(100) AS LONG
    END TYPE

    DIM World AS TWorld
Using TYPE and STRUCT are not the same. If you unhook the two, TYPE now reverts back to the old style (pre-May 17 version), where arrays of UDTs is not allowed. Why the heck would I want a stripped down version? Well, perhaps performance. The old style TYPE lacks in many things, but makes up in performance, if that's really necessary.