Ein paar Mini Gambas Programme ( Minisinis) zurück zu Gambas
Programmieren scheint sehr kompliziert zu sein. Um es auch Anfängern schmackhaft zu machen , habe ich auf dieser Seite ein paar Miniprogramme für Gambas unter Linux KDE aufgelistet.
Ganz am Anfang brauchen Sie Wie plaziert man ein Programm in KDE Iconerstellung
Hinweise zum Download der Programme aus dem Internet Die Werkzeugkiste = Toolbox
Auch in in Visual Basic habe ich einige Miniprogramme geschrieben, diese sind in folgender Liste teilweise noch zu finden und werden nach und nach umgeschrieben.
Textdarstellung Variablen Variablen deklarieren Variablen umwandeln Format Maus Grafik Form Rechenkünste 10Künste Zufall
Balken Schleifen Zeit Wecker Ereignis Logik Farben Funktion Klasse Array Gitter WWW Zwischenablage
Dateien Sound Drucken Datenbank Menu Fehlermanagement Systeminfo Werkzeugkiste
Fehlermeldungen GB-Komponenten Fragen Das Drumherum
Wollen Sie auch ein Miniprogramm erstellen ? So geht es .
Hallo Welt 0 Simpler geht es nicht mehr
Hallo Welt 1 Sehr ausführlich erklärt , Fast schon etwas lang.
Hallo Welt 2 Etwas kürzer
Hallo Welt 3 Hallo Welt allgemein
Anfang und Ende
Print :,; , funktioniert nicht immer !
Schattentext
verbessertes Print mit Zeilenumbruch noch in vb
Texteingabe
Wie heißen Sie ? noch in vb
Welche Taste wurde gedrückt ? Ausgabe des Tastencodes
Inputbox
Textbearbeitung ( Befehlsübersicht zur String Bearbeitung)
InStr Texteile suchen
Leerstellen und Chr13 suchen
Programmstart
Automatisches Hochfahren. Das Programm wartet auf eine Eingabe.
bei Click auf einen Befehlsbutton
bei DoppelClick auf die Form ( Event = DoppelClick)
beim Berühren der Form mit der Maus ( Event = Enter )
Programmstart mit Datenübergabe
zweiten Programmstart verhindern noch in vb
Programmende
Mit dem Kreuz re obere Windowsecke
Mit dem Befehl STOP gibt es Ärger
mit dem Quit befehl gibt es öfter Ärger
mit Window.Close ( ist nicht static )
mit ALT und F4 immer dann wenn die Form keine Randmarkierungen hat.
Ende und vorher Datenbank schließen
Ende mit der ESC Taste
PUBLIC SUB Form_KeyPress()
IF Key.Code = Key["Esc"] THEN ME.Close
END
Programm abwürgen
Das Programm beenden mit dem Klick auf den roten Punkt
Das Programm beenden mit dem Klick auf das X rechts oben am Bildschirm
Programm abwürgen: Mit Strg und ESC kpm aufrufen.
Mit Alt F2 die Direkteingabe starten , Dann kpm starten ( kpm + Return )
Man erhält eine Aufstellung aller laufenden Prozeße
Den fehlerhaften Prozeß markiert man und drückt unten die Taste kill = beenden .
Programm abwürgen mit der RESET taste = Kaltstart = VORSICHT! alle nicht gespeicherten Dateien gehen verloren !!
(Leertaste funktioniert erstaunlicherweise wie Return)
Programm abwürgen mit Strg und Pause oder Strg und C funktioniert in Gambas nicht.
Programm abwürgen mit Strg , Alt und Entf funktioniert in Gambas nicht.
<
Rem funktioniert nicht
Apostroph funktioniert
Auskommentieren und Einkommentieren zur Programmtestung gut geeignet
<
Variable
String
Integer
Float
Variant
Variablen festlegen
Public
Deklariert eine globale Variable . Diese gilt in der Form. Nicht aber formübergreifend.
Beispiel:
PUBLIC Name AS String
PUBLIC Control AS Object
Es kann damit auch eine Funktion oder Procedure deklariert werden:
PUBLIC FUNCTION Calc(A AS Float, B AS Float) AS Float
PUBLIC SUB Button1_Click()
ME.Close
END
Private , Public oder Static Was soll das ?
Static
New
Constructor benutzen Sub _new()
Array Wieso funktionieren Arrays im Terminalmodus nicht ?
Doppelgänger aus dem Array entfernen
For Each Aufzählung der Elemente eines Arrays.
Farben QB
Farb Array QB
Farb Array RGB
FormFarbe
Confetti noch in vb
Doppelschleife Einmaleins in der Übersicht
Modische Schleife
GOTO vermeiden
Form_Open() Starten eines Programmes direkt beim Öffnen der Form
Den Namen einer Form ändern mit ME.text = „neuer Titel“
Schließt eine Form : Ende mit ME.Close
Form_Enter() Startet ein Programm wenn man mit der Maus darauf kommt
Von einer Form zur anderen
Von einer Form zur anderen unter Mitnahme von Variablen oder Daten
100 Formen
Ohne Rahmen noch in vb
Rechenausdrücke umwandeln
Wurzel Quadratwurzel
Andere Wurzeln
Hoch E
Teilen ohne Rest ( Mod Befehl) noch in vb
Binominalwert berechnen n über k
Logarithmus Funktion ganz einfach
Logarithmus Zahlentreppe
Logarithmus grafisch
Logarithmus Rechner noch in vb
Rechentrainer Addieren
Umrechnung binär ==> dezimal noch in vb
Umrechnung Binär,dezimal , hexadezimal noch in vb
Umrechnung Arabische in Römische Zahlen noch in vb
Sinus,Cosinus,Tangens
Cosh
Kreisender Sinus noch in VB
Fehler in den abgleiteten Mathefunktionen noch in vb
Sieb des Eratosthenes = Primzahlberechnung 1 noch in vb
Sieb des Eratosthenes = Primfaktorzerlegung
Fehler beim Rechnen noch in vb
FALSE
NULL
TRUE
Binärer Zahlenvergleich mit AND noch in VB
NOT
DEC
INC
NOT
Array0 Definieren und ausgeben
Array1 Definieren und neu besetzen
Array2 RGBFarbarray array16(rgb)
Welcher Wochentag war am 1.1.2000 ?
Tage Intervall
Zeit- und Datumsformate noch in VB
Zeit 1
Monatsschleife noch VB
Zeit 2 : Wie lange dauert es noch bis zur Geisterstunde noch VB
Zeit Intervall
Reaktionszeit messen ohne Wecker
Reaktionszeit mit Wecker
Datei speichern mit Dialog falls Datei existiert
Datei speichern mit Dialog falls Datei nicht existiert
Datei speichern ohne Dialog falls Datei existiert
Datei speichern ohne Dialog falls Datei nicht existiert
Hilfe wo bin ich ? Informationen über die aktuelle Anwendung Application
Binär Datei speichern
Primzahlen in Datei speichern
Kleine Minidatenbank
Datei teilen
Stat Befehl liefert Dateieigenschaften
Datei löschen
Das Inhaltsverzeichnis eines Ordners laden ' Get the content of a directory
COPY
KILL
MKDIR
RENAME
RMDIR
Input/Output
CLOSE
FLUSH
INPUT
LINE INPUT
OPEN
READ
SEEK
WRITE
Rein Zufällig Statistik und Stochastik
Randomize
Rnd
Zufallsgenerator genauer
01 Statistik noch in vb
Gausssche Normalverteilung 1 noch in vb
Gausssche Normalverteilung 2
Gausssche Normalverteilung 3
<
Mit Return ein Feld weiter
Mit Pfeil hoch ein Feld zurück
mit der Maus malen noch in vb
rechte Maustaste noch in vb
Drag and Drop mit der Maus
Drag und Drop aus den Beispielen
Bewegung
Bewegung0
Bewegung2
Setzt mehrere Punkte
DrawingArea Löschen
Drawingarea.Clear
Drawingarea.Refresh
Koordinaten der Maus anzeigen
Hausbau noch in vb
Bildschirmauflösung ermitteln noch in vb
Kreise in Farbe noch in vb
Olympische Ringe
Draw. text
From: Eilert <eilert-sprachen@t-...>
Draw.Text adapted to DrawingArea ?
2005-02-14 03:10
Hi all,
Just wondering how Draw.Text (and the text painting functions) could be
recalculated to fit to the size of the DrawingArea.
Yes, I know, if I say Draw.Font.Size = 12 it will be 12 pts, but
reference for it is the desktop"s resolution. I"m doing a preview, and
for this preview to show me an A4 page in real size I have to give 82
instead of Desktop.Resolution (which results in somewhat smaller
measures). This didn"t matter up to now. I"ve introduced some graphics
functions which show lines and stuff, all work ok because they use a
function to recalculate millimeters into screen pixels.
Now with fonts, as long as I keep the preview 1:1 with reality,
everything appeares correct. But what if I decide to have a preview of
1/2 or 1/4 size?
As all sizes are measured in points on the screen, my question is, what
can I do to evaluate the appearence of a font and resize it accordingly?
The Draw.Text() function has a width and height option, but I don"t
understand how it works (no examples in the help) and I don"t know if it
would be of any help here.
Rolf
From: Laurent Carlier <lordheavy@in...>
Re: Draw.Text adapted to DrawingArea ?
2005-02-14 04:23
Le Lundi 14 Février 2005 12:10, Eilert a écrit :
> The Draw.Text() function has a width and height option, but I don"t
> understand how it works (no examples in the help) and I don"t know if it
> would be of any help here.
draw.textHeight("my text") return the height of the text (my text) in pixels,
draw.textWidth("my text") return the width of the text (my text) in pixels.
--
Laurent Carlier
From: Eilert <eilert-sprachen@t-...>
Re: Draw.Text adapted to DrawingArea ?
2005-02-14 06:11
Ah Laurent, I think I didn"t explain clear enough what I want. Let me
say it this way:
When I start my preview, I call a function that recalculates millimeters
into screen pixels. The DrawingArea has to be adjusted in measures of
screen pixels. My little function take the Desktop.Resolution and
computes the necessary number of pixels to let the DrawingArea as wide
and as long as necessary for an A4 page.
The problem is that it miscalculates a bit (maybe 10 %) because
"Desktop.Resolution" says something like 76, and it would be 82 to make
a "real" A4 sheet (I compared it on the screen).
So everything appears somewhat smaller than A4. No problem, BUT WITH FONTS:
Fonts are sized in pts, i. e. points, and not screen pixels. The
function behind this in Qt recalculates my "Courier 12" into the
necessary number of screen pixels for a page with Desktop.Resolution 76,
not 82. So on my somewhat smaller page, all fonts appear slightly too big.
What I am looking for is an easy way to rescale the fonts to a size
which fits to the scale of my DrawingArea, maybe something like a
pts-to-screen-pixel ratio.
Rolf
Laurent Carlier schrieb:
> Le Lundi 14 Février 2005 12:10, Eilert a écrit :
>
>>The Draw.Text() function has a width and height option, but I don"t
>>understand how it works (no examples in the help) and I don"t know if it
>>would be of any help here.
>
>
> draw.textHeight("my text") return the height of the text (my text) in pixels,
> draw.textWidth("my text") return the width of the text (my text) in pixels.
>
From: Benoit Minisini <gambas@us...>
Re: Draw.Text adapted to DrawingArea ?
2005-02-14 06:17
On Monday 14 February 2005 15:11, Eilert wrote:
> Ah Laurent, I think I didn"t explain clear enough what I want. Let me
> say it this way:
>
> When I start my preview, I call a function that recalculates millimeters
> into screen pixels. The DrawingArea has to be adjusted in measures of
> screen pixels. My little function take the Desktop.Resolution and
> computes the necessary number of pixels to let the DrawingArea as wide
> and as long as necessary for an A4 page.
>
> The problem is that it miscalculates a bit (maybe 10 %) because
> "Desktop.Resolution" says something like 76, and it would be 82 to make
> a "real" A4 sheet (I compared it on the screen).
>
> So everything appears somewhat smaller than A4. No problem, BUT WITH FONTS:
>
> Fonts are sized in pts, i. e. points, and not screen pixels. The
> function behind this in Qt recalculates my "Courier 12" into the
> necessary number of screen pixels for a page with Desktop.Resolution 76,
> not 82. So on my somewhat smaller page, all fonts appear slightly too big.
>
> What I am looking for is an easy way to rescale the fonts to a size
> which fits to the scale of my DrawingArea, maybe something like a
> pts-to-screen-pixel ratio.
>
> Rolf
>
Font has its own resolution settings, that is used only when displaying on a
screen (not on a printer).
I mean there is a Font.Resolution property that can be different from
Desktop.Resolution. By default, Font.Resolution = 96. But you can change it
if you need.
Regards,
--
Benoit Minisini
mailto:gambas@us...
From: Eilert <eilert-sprachen@t-...>
Re: Draw.Text adapted to DrawingArea ?
2005-02-14 23:19
Thanks Benoit, that"s it:
Font.Resolution = Desktop.Resolution
When I let it size the preview according to Desktop.Resolution, this
will make the fonts appear in a natural way.
Benoit Minisini schrieb:
> On Monday 14 February 2005 15:11, Eilert wrote:
>
>>Ah Laurent, I think I didn"t explain clear enough what I want. Let me
>>say it this way:
>>
>>When I start my preview, I call a function that recalculates millimeters
>>into screen pixels. The DrawingArea has to be adjusted in measures of
>>screen pixels. My little function take the Desktop.Resolution and
>>computes the necessary number of pixels to let the DrawingArea as wide
>>and as long as necessary for an A4 page.
>>
>>The problem is that it miscalculates a bit (maybe 10 %) because
>>"Desktop.Resolution" says something like 76, and it would be 82 to make
>>a "real" A4 sheet (I compared it on the screen).
>>
>>So everything appears somewhat smaller than A4. No problem, BUT WITH FONTS:
>>
>>Fonts are sized in pts, i. e. points, and not screen pixels. The
>>function behind this in Qt recalculates my "Courier 12" into the
>>necessary number of screen pixels for a page with Desktop.Resolution 76,
>>not 82. So on my somewhat smaller page, all fonts appear slightly too big.
>>
>>What I am looking for is an easy way to rescale the fonts to a size
>>which fits to the scale of my DrawingArea, maybe something like a
>>pts-to-screen-pixel ratio.
>>
>>Rolf
>>
>
>
> Font has its own resolution settings, that is used only when displaying on a
> screen (not on a printer).
>
> I mean there is a Font.Resolution property that can be different from
> Desktop.Resolution. By default, Font.Resolution = 96. But you can change it
> if you need.
>
> Regards,
>
Ellipse
Scale - eigene Koordinaten sind leichter zu verstehen
Umrechnung der negativen y - Werte in positive y -Werte
beliebige Spreizung der x-Achse und y Achse vom Nullpunkt beginnend
beliebige Spreizung der x-Achse und y Achse von beliebigem Punkt beginnend
Sinuskurve mit scale
Farngrafik noch in vb
Seestern noch in vb
Foucaultsches Pendel noch in vb
01 Dateien
Ordnung muß sein noch in vb
01 Statistik noch in vb
Binäres Zählen
Münze mehrfach
Zwischenablage = Clipboard
Text in die Zwischenablage addieren
Ein Bild in der Zwischenablage ablegen und wieder zurückholen
Clipboard Eigenschaften
Töne
Beep noch in vb
Ein paar mehr Töne noch in vb
Wave Datei abspielen
Minidatenbank 1 noch in vb
Datensatz in der Anzeige speichern
Datenbank ohne mysql
Datenbank mit mysql
Ausdrucken 1 noch in vb
Ausdrucken 2
Ausdruck Testen
Fehler beim Ausdrucken
Printer.print mit Zeilenumbruch
Ausdrucken 3 noch in vb
Wie eine Function nicht funktioniert
zb Vokale aus einem Text holen
Seriennummer der Festplatte abfragen noch in vb
Angst vor Objekten, dann hilft dieser Link http://sepwww.stanford.edu/sep/josman/oop/oop1.htm
Vordefinierte Klassen in Gambas
Klasse 2
Objekt erschaffen, testen , löschen , Cthing
Miniemail
Neue Controls auf die Form setzen
GB Komponenten
Zusätzliche Komponenten laden
Zusätzliche Gambas Komponenten kann man über den Menüpunkt Projekt – Eigenschaften des Gambashauptbildschirmes erreichen. In der Komponentenanzeige wählt man die gewünschten Komponenten aus.
In der Werkzeugbox erscheint dann zb eine Schrift mit der Bezeichnung QT . Diese klickt man an und hat dann eine Reihe weiterer Steuerelemente zur Verfügung.
Liste der derzeitige Gambaskomponenten
gb
Gambas internal native classes
gb.compress
Compression library
gb.db
Database access component
gb.debug
Gambas application debugger helper
gb.eval
Gambas expression evaluator
gb.net
Networking component
Controls: DnsClient, ServerSocket, SerialPort, Socket, UdpSocket
gb.qt
Graphical QT toolkit component
Controls: Label, TextLabel, PictureBox, ProgressBar, Button, CheckBox, RadioButton, ToggleButton, ToolButton, TextBox, ComboBox, TextArea, ListBox, ListView, TreeView, IconView, GridView, ColumnView, HBox, VBox, HPanel, VPanel, Frame, Panel, TabStrip, ScrollView, DrawingArea, Timer
gb.qt.editor
Gambas editor with syntax highlighting
Controls: GambasEditor
gb.qt.ext
Graphical QT toolkit extension component
Controls: LCDNumber, Dial, SpinBox, ScrollBar, Slider, MovieBox, TableView, HSplit, VSplit, Workspace, TextView
gb.qt.kde
KDE integration and scripting
Controls: URLLabel, ColorBox, DatePicker
WARNUNG! Folgende Komponenten befinden sich noch im BETA Stadium und können sich daher jederzeit ändern.
gb.qt.kde.html
KDE web browser
gb.vb
Visual Basic compatibility
gb.xml.libxml
XML tools based on libxml
gb.xml.libxml.rpc
XML-RPC client based on libxml and libcurl
gb.xml.libxml.xslt
XSLT tools based on libxslt
Systeminfo mit der System Class
Application infos
FINALLY
TRY
Fehlermeldungen