Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculator
#11
Hi Ken,

I tested putting a _delay .2 right after you detect the _MouseButton(1)

While _MouseInput: Wend ' poll mouse
mousex = _MouseX
mousey = _MouseY
mouseLeftButton = _MouseButton(1)


If mouseLeftButton Then
' mouseLeftButton = 0 ' this does no good that I can tell
_delay .2 ' so everyone knows, this is to allow user to release the mouse so it doesn't act like you clicked that key 2 or more times

you only need the delay once, right after you detect it should be OK


Yes there is a way to do this that waits for _Mousebutton(1) to clear, Old Moses had a nice little sub, but Ken doesn't recall I don't think, I saved it but on my hard drive that I lost.

Maybe @OldMoses could remind us?

I learned the simple _delay trick from Pete.
b = b + ...
Reply
#12
(07-25-2022, 09:53 PM)SierraKen Wrote: Thanks! Wow I never really got into C much myself, mostly always stuck with different variations of BASIC since the 80's. Although I did make many websites in html and a little bits of C, Visual Basic, etc.

Yes, I once created my largest program in C, this financial program - around 12,000 to 14,000 lines.

In HTML, a page of it looked something like this. There is a "Call" call.

I remember handing the HTML page input to a Java program via VBScribt. That performed the calculation and returned the result. - One shouldn't see the code for the calculations. Was just like that.

Code: (Select All)
<!-- Höhe von Jahresraten bei bekanntem Endwert, vor- nachschüssig. - 1.10.1997 -->

<HTML>
<HEAD>
    <TITLE>Rentenrechnung</TITLE>
    
<SCRIPT LANGUAGE="VBScript">
<!-- Option Explicit    
Dim ZinsForm
     
'Radiobutton initialisieren
ZinsForm = "Nach"
Sub ZahlungsForm(NeuWahl)
   ZinsForm = NeuWahl
End Sub
        
Sub cmdBerechnen_Click()
    Dim ZahlungsWeise

    If ZinsForm = "Nach" Then
        ZahlungsWeise = "NA"
    Else
        ZahlungsWeise = "VR"
    End If
    
    If txtEndwert.Value = "" OR txtNominalZins.Value = ""  OR txtDauer.Value = "" Then
        MsgBox "Es fehlen Daten für eine Berechnung!", vbCritical, "Fehlermeldung"
        Exit Sub
    ElseIf IsNumeric(txtEndwert.Value) = False OR IsNumeric(txtNominalZins.Value) = False OR IsNumeric(txtDauer.Value) = False Then
        MsgBox "Eine Eingabe war kein numerischer Wert!", vbCritical, "Hinweis"            
        Exit Sub
    Else        
        Call document.ratenbetrag.berechnen(txtEndwert.Value, txtNominalZins.Value, ZahlungsWeise, txtDauer.Value)
    End If
End Sub
-->
</SCRIPT>            

</HEAD>
<BODY BGCOLOR="#C0C0C0">
<CENTER>
<TABLE width="50%" align="center" BORDER=4 BGCOLOR="#FFFFFF" BORDERCOLORDARK="#800080" BORDERCOLORLIGHT="#8000F0">
    <TR>
        <TD ALIGN=CENTER>
        <FONT SIZE="5"><FONT COLOR=#0000FF>
        Ermittlung der Höhe von Rentenraten bei feststehendem Renten(Spar-)endwert
        </FONT></FONT>        
        </TD>
    </TR>    
</TABLE>
</CENTER>

<p>
<CENTER>
<TABLE>
    <TR>
        <TD>
        <b><font color="#FFF8DC">   
    <input type="radio" name="optPeriodenzins" checked OnClick="ZahlungsForm('Nach')">
        Nachschüssig
    </font></b>   
        </TD>
        <TD><FONT COLOR="#C0C0C0">----</FONT></TD>
        <TD>
        <b><font color="#00FF00">
    <input type="radio" name="optPeriodenzins" OnClick="ZahlungsForm('Vor')">
        Vorschüssig
        </font></b>
        </TD>
    </TR>
</TABLE>
</CENTER>

<P>
<FORM NAME=Annu>
<TABLE  width="50%" align="center" BORDER=1 BGCOLOR="#00">
    <TR>
        <TD><FONT COLOR=#00FFFF>
      <B>Der angestrebte Rentenendbetrag beträgt
            <FONT COLOR=#00>--</FONT>:</B>
            </FONT>
        </TD>        
        <TD>
            <INPUT class="richt" TYPE="TEXT" NAME="txtBetrag" VALUE="" SIZE="20">        
        </TD>
        <TD ALIGN=LEFT><FONT COLOR=#00>-</FONT><FONT COLOR=#00FFFF><B>DM</B></FONT></TD>
        <TD ALIGN=CENTER><FONT COLOR=#>--</FONT>
        <BUTTON id="cmdBerechnen"
         style="width=90pt; background:black; font-family:arial; font-size:10pt; font-style:italic; font-weight:bold; color:#FC143C">
        <P ALIGN=CENTER>Berechnen</P>        
        </BUTTON>
        <FONT COLOR=#>--</FONT>
        </TD>
        <TD ALIGN=CENTER><FONT COLOR=#>--</FONT>
        <BUTTON id="cmdInfo"
         style="width=90pt; background:yellow; font-family:arial; font-size:10pt; font-style:italic; font-weight:bold; color:blue">
        <P ALIGN=CENTER>Information</P>        
        </BUTTON>
        <FONT COLOR=#>--</FONT>
        </TD>
    </TR>        
    <TR>
        <TD><FONT COLOR=#00FFFF>
      <B>Dieser Betrag wird verzinst zu
            <FONT COLOR=#00>----------------</FONT>:</B>
            </FONT>
        </TD>        
        <TD>
            <INPUT class="richt" TYPE="TEXT" NAME="txtZins" VALUE="" SIZE="20">
        </TD>
        <TD ALIGN=LEFT><FONT COLOR=#00>-</FONT><FONT COLOR=#00FFFF><B>%</B></FONT></TD>                
    </TR>    
    <TR>
        <TD><FONT COLOR=#00FFFF>
      <B>Geben Sie den Einzahlungszeitraum an
            <FONT COLOR=#00>-----</FONT>:</B>
            </FONT>
        </TD>        
        <TD>
            <INPUT class="richt" TYPE="TEXT" NAME="txtZeitraum" VALUE="" SIZE="20">
        </TD>
        <TD ALIGN=LEFT><FONT COLOR=#00>-</FONT><FONT COLOR=#00FFFF><B>Jahr(e)</B></FONT></TD>        
        <TD ALIGN=CENTER><FONT COLOR=#>--</FONT>
        <BUTTON id="cmdLoeschen"
         style="width=90pt; background:#FC143C; font-family:arial; font-size:10pt; font-style:italic; font-weight:bold;
                color:white">
        <P ALIGN=CENTER>Löschen</P>        
        </BUTTON>
        <FONT COLOR=#>--</FONT>
        </TD>
        <TD ALIGN=CENTER><FONT COLOR=#>--</FONT>
        <BUTTON id="cmdPost"
         style="width=90pt; background:blue; font-family:arial; font-size:10pt; font-style:italic; font-weight:bold;
                color:yellow">
        <P ALIGN=CENTER>e-mail</P>        
        </BUTTON>
        <FONT COLOR=#>--</FONT>
        </TD>
    </TR>                
</TABLE>

<p>
<TABLE width="50%" align="center" BORDER=1 BGCOLOR="#00">
    <TR>
        <TD width="392pi"><FONT COLOR=#FFFFA0>
      <B>Die Höhe der jährlich zu zahlenden Raten beträgt
            <FONT COLOR=#00>--</FONT>:</B>
            </FONT>
        </TD>        
        <TD width="190pi">
            <INPUT class="richt" TYPE="TEXT" NAME="txtZeitraum" VALUE="" SIZE="20">
        </TD>
        <TD width="53pi" ALIGN=LEFT><FONT COLOR=#00>-</FONT><FONT COLOR=#FFFFA0><B>DM</B></FONT></TD>        
        <TD ALIGN=CENTER colspan="2"><HR SIZE=3 WIDTH="170pi" COLOR="#FFFFA0"></TD>
    </TR>
</TABLE>
</FORM>

<P>
<TABLE><TR><TD></TD></TR></TABLE>
<TABLE><TR><TD></TD></TR></TABLE>

<table width="50%" align="center">
<tr><td>
    <ADDRESS>
    <FONT SIZE=3><FONT COLOR="#000000">
        &#169Copyright 1998: <B>Cyberjunkies</B><BR>
    </FONT>            
    </ADDRESS>
    <HR SIZE=4 COLOR="#800080">
    </td></tr>
</table>

<SCRIPT LANGUAGE="VBScript">
<!-- Option Explicit    
    Sub cmdInfo_Click()
        MsgBox "Beispiel:" & vbCrLf & "Jemand beschließt an seinem 18. Geburtstag, " &_
           "daß er an seinem 65. Geburtstag 1.000.000,- DM durch jährlich " &_
                     "nachschüssige Raten bei 6% Zinsen zusammengespart haben will. Er möchte " &_
                     "wissen, wie hoch die Jahresraten sein müssen, um das angestrebte Ziel " &_
                     "zu erreichen."  & vbCrLf & "Ergebnis: " &_
                     "4147,68 DM" & vbCrLf & "------------------" &_
                     "------------------------------------------------------------------" &_
                     "----------------------" & vbCrLf & "** SEHR WICHTIG! **" & vbCrLf & "Benutzen " &_
                     "Sie bei der Eingabe von Werten bitte ein " &_
               "Dezimalpunkt. Also z.B.: 12.55 und nicht! 12,55 " &_
                     "Das Ergebnis ist sonst nicht korrekt.", vbInformation, "Wichtige Programm-Information"
    End Sub
    
    Sub cmdLoeschen_Click()
        txtEndwert.Text = ""
        txtNominalZins.Text = ""     
      txtDauer.Text = ""        
    End Sub    
    
    Sub cmdZurueck_Click()
        Window.Location.Href="../HTMLHpSeiten/AxFinanzBsp.html#X"
    End Sub
-->
</SCRIPT>

</BODY>
</HTML>

Oh ho, I forget it!   Confused

[Image: Rentenraten2022-07-25.jpg]
Reply
#13
And if anyone thinks I'm just kidding, . . .

It started with three external files as an exercise, and then I went through the whole book: 92 external files for each calculation. Here is one of them:

Code: (Select All)
/* 'krratmon.c' wird von 'KREDITEX.C' aufgerufen.                          */
/* Monatliche Ratentilgung (unterjährliche Tilgung).                       */
/* Bei der Ratentilgung ist die Tilgungsrate fest. Tilgungsrate und Zinsen */
/* ergeben die Annuität. Bei der unterj. Ratentilgung ist es üblich, pro   */
/* Tilgungsperiode einen periodisch anteiligen Zins zu zahlen. Dieser er-  */
/* gibt sich aus der Verzinsung der Restschuld mit dem relativen Zinssatz. */
/*                                                            - 17. 2.1996 */
/* An übrige Programmgestaltung angepaát.                     - 15. 3.1996 */
/*=========================================================================*/

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <graph.h>
#include <math.h>
#include <time.h>
#include <dos.h>
#include <bios.h>

#define LPT1 0              //Reihenfolge der Drucker: 0, 1, 2, ...
#define CURSOR_AUS 0x2000
#define CURSOR_NORMAL 0x0707

int seite;

extern void annuitaeten_menu( void );
extern void monat_tilgung( void );

void titel( void );
void menueLeiste( void );
double rueckBetrag( double kredit, double zins, int monate );
void betragsLeiste( double betrag, double zins, double rueckzahlungsWert );
char tilgungBerechnen( double kredit, double zins, int monate );
void tabellenKopfDrucken( double kredit, double zins, double rueckzahlung, int azeile, int aspalte, int ezeile, int espalte );
void tabelleDrucken( double kredit, double zins, int monate, int azeile, int aspalte, int ezeile, int espalte );
void druckAnzeige( int monate );

void monat_tilgung( void )
{
    int azeile, aspalte, ezeile, espalte;
    int vg_farbe, monate;
    int orginal_seite;
    long int hg_farbe;
    double betrag, zins;
    char antwort, wahl;

    hg_farbe = _getbkcolor();
    vg_farbe = _gettextcolor();
    _gettextwindow( &azeile, &aspalte, &ezeile, &espalte );

    titel();
    _settextwindow( 4, 2, 24, 79 );
    _setbkcolor( 1L );
    _clearscreen( _GWINDOW );

    _settextposition( 2, 4 );
    printf("Geben Sie die H”he des Kreditbetrags ein (in DM)    : ");
    scanf("%lf", &betrag);
    _settextposition( 3, 4 );
    printf("Geben Sie den vereinbarten Zinssatz ein (in %%)      : ");
    scanf("%lf", &zins);
    _settextposition( 4, 4 );
    printf("Geben Sie den Rckzahlungszeitraum ein (in Monaten) : ");
    scanf("%d", &monate);
    _settextcursor( CURSOR_AUS );

    menueLeiste();
    betragsLeiste( betrag, zins, rueckBetrag( betrag, zins, monate ) );
    if ( tilgungBerechnen( betrag, zins, monate ) == 'J' )
    {
        tabellenKopfDrucken( betrag, zins, rueckBetrag( betrag, zins, monate ), azeile, aspalte, ezeile, espalte );
        tabelleDrucken( betrag, zins, monate, azeile, aspalte, ezeile, espalte );
        druckAnzeige( monate );
    }
    //'seite ' muß vor Verlassen der Funktion wieder auf 0 gebracht werden,
    //sonst wird, solange das Gesamtprogramm läuft, einfach weiter gezählt
    //egal aus welchem Programmteil man druckt.
    seite = 0;

    _settextwindow( azeile, aspalte, ezeile, espalte );
    _settextcursor( CURSOR_NORMAL );
    _settextcolor( vg_farbe );
    _setbkcolor( hg_farbe );
    _clearscreen( _GCLEARSCREEN );
    annuitaeten_menu();
}

void titel( void )
{
    int spalte;
    char ch[2];

    _setbkcolor( 15L );
    _clearscreen( _GCLEARSCREEN );
    _settextposition( 2, 18 );
    _settextcolor( 14 );
    _outtext( "Tilgungsplan einer monatlichen Ratentilgung" );
    for ( spalte = 18; spalte < 61; spalte++ )
    {
        _settextposition( 3, spalte );
        _settextcolor( 10 );
        _outtext( "þ" );
    }
}

double rueckBetrag( double kredit, double zins, int monate )
{
    int j;
    double ir, tilgung, restSchuld;
    double monatsZins, annuitaet;
    double rueckzahlung = 0;

    tilgung = kredit / (double) monate;
    restSchuld = kredit;

    //Relativer Zinssatz
    ir = (zins / 100) / monate;

    for ( j = 1; j <= monate; j++ )
    {
        monatsZins = (restSchuld * ir * monate) / 12;
        annuitaet = tilgung + monatsZins;
        restSchuld -= tilgung;
        rueckzahlung += annuitaet;
    }
    return( rueckzahlung );
}

void betragsLeiste( double kredit, double zins, double rueckzahlungsWert )
{
    char puffer[64];

    _settextwindow( 4, 2, 6, 79 );
    _setbkcolor( 11L );
    _clearscreen( _GWINDOW );
    _settextcolor( 15 );
    _settextposition( 1, 40 );
    sprintf(puffer, "Kreditbetrag       : %13.2f DM", kredit);
    _outtext( puffer );
    _settextposition( 2, 40 );
    sprintf(puffer, "Jahreszins         : %13.2f %%", zins);
    _outtext( puffer );
    _settextposition( 3, 40 );
    sprintf(puffer, "Rckzahlungsbetrag : %13.2f DM", rueckzahlungsWert);
    _outtext( puffer );
}

void menueLeiste( void )
{
    _settextwindow( 7, 2, 7, 79 );
    _setbkcolor( 13L );
    _clearscreen( _GWINDOW );

    _settextcolor( 15 );
    _settextposition( 1, 3 );
    _outtext( "Jahr" );
    _settextposition( 1, 7 );
    _outtext( "/Monat" );
    _settextposition( 1, 20 );
    _outtext( "Zinsen" );
    _settextposition( 1, 36 );
    _outtext( "Tilgung" );
    _settextposition( 1, 51 );
    _outtext( "Annuit„t" );
    _settextposition( 1, 67 );
    _outtext( "Restschuld" );
}

char tilgungBerechnen( double kredit, double zins, int monate )
{
    int j, x, zeile, zp;
    unsigned int jahres_zahl;
    char puffer[64], antwort;
    double monatsZins, restSchuld, tilgung;
    double annuitaet, dummy, i;
    struct dosdate_t datum;

    _settextwindow( 8, 2, 24, 79 );
    _setbkcolor( 0L );
    _clearscreen( _GWINDOW );

    //Datum holen
    _dos_getdate( &datum );

    //Jahreszahl der Tilgung holen (Tilgungsbeginn)
    jahres_zahl = datum.year;

    //Restschuld initialisieren
    restSchuld = kredit;
    dummy = kredit;

    tilgung = kredit / (double) monate;

    //Relativer Zinssatz
    i = (zins / 100) / monate;

    zeile = 2;
    zp = 1;                          //Regelt die Jahreszahl
    x = 1;                           //Steht fr die Monatszahl
    for ( j = 1; j <= monate; j++, zp++, x++ )
    {
        //Nur '... /12', da 'zins/100' schon in i enthalten ist
        monatsZins = (restSchuld * i * monate) / 12;

        //Nur Annuit„t und Zins „ndern sich ensprechend der Restschuld
        annuitaet = tilgung + monatsZins;

        //Vermindert sich nach jeder Rckzahlung
        restSchuld -= tilgung;

        //Eine Jahreszahl fr 12 Monate
        if ( zp == 1 )
        {
            _settextcolor( 13 );
            _settextposition( zeile, 3 );
            sprintf(puffer, "%u", jahres_zahl++);
            _outtext( puffer );
        }
        _settextcolor( 15 );
        _settextposition( zeile, 8 );
        sprintf(puffer, "%3d", x);
        _outtext( puffer );
        _settextcolor( 11 );
        _settextposition( zeile, 14 );
        sprintf(puffer, "%12.2f", monatsZins);
        _outtext( puffer );
        _settextcolor( 12 );
        _settextposition( zeile, 31 );
        sprintf(puffer, "%12.2f", tilgung);
        _outtext( puffer );
        _settextcolor( 9 );
        _settextposition( zeile, 47 );
        sprintf(puffer, "%12.2f", annuitaet);
        _outtext( puffer );
        _settextcolor( 14 );
        _settextposition( zeile, 64 );
        sprintf(puffer, "%13.2f", dummy);
        _outtext( puffer );
        zeile++;
        dummy = restSchuld;

        if ( monate <= 12 || monate > 12 )
        {
            _settextposition( 16, 28 );
            _settextcolor( 10 );
            _outtext( "Drcken Sie eine Taste" );
            if ( j % 12 == 0 )
            {
                do
                    getch();
                while ( kbhit() );

                //Hier muá es sein, sprach der HERR !
                zp = 0;
                x = 0;

                //Sofortiges Ende, wenn Monatszahl erreicht
                if ( j == monate )
                    { goto ENDE; }
                    //Sonst n„chste Seite anzeigen
                _clearscreen( _GWINDOW );
                zeile = 2;
            }
        }
    }
    do            //Um die Ausgabe bei 12 <= Monaten festzuhalten
        getch();
    while ( kbhit() );

ENDE:
    _settextcolor( 0 );
    _settextposition( 16, 28 );
    _outtext( "                          " );
    _setbkcolor( 15L );
    _settextcolor( 0 );
    _settextposition( 16, 28 );
    _outtext( "Tilgungsplan ausdrucken? : " );
    antwort = toupper( getche() );

    return( antwort );
}

void tabellenKopfDrucken( double kredit, double zins, double rueckzahlung, int azeile, int aspalte, int ezeile, int espalte )
{
    int spalte, vg_farbe, z = 1;
    unsigned int status, hg_farbe;
    struct dosdate_t datum;
    struct dostime_t zeit;

    //Prfen ob Drucker bereit ist. Nach 2. Versuch Abbruch
    SCHLEIFE:
    status = _bios_printer( _PRINTER_STATUS, LPT1, 0 );
    if ( status & 8 )   //Nicht an
    {
        do
        {
            printf("\n\n\a   Schalten Sie den Drucker ein, und ");
            printf("drcken Sie anschlieáend eine Taste.");
            getch();
            if ( status & 8 && z++ < 2 )
                goto SCHLEIFE;
            else
            {
                _settextwindow( azeile, aspalte, ezeile, espalte );
                _settextcursor( CURSOR_NORMAL );
                _settextcolor( vg_farbe );
                _setbkcolor( hg_farbe );
                _clearscreen( _GCLEARSCREEN );
                annuitaeten_menu();
            }
        } while ( !status & 8 );
    }

    //Datum und Zeit holen
    _dos_getdate( &datum );
    _dos_gettime( &zeit );

    fprintf(stdprn, "\n");
    fprintf(stdprn, "      *** TILGUNGSPLAN EINER MONATLICHEN RATENTILGUNG BEI PERIODISCH ***\n");
    fprintf(stdprn, "                         (MONATLICH) ANTEILIGEM ZINS\n\n");
    fprintf(stdprn, "\t\t\t\t\t  Kreditbetrag       : %13.2f DM", kredit);
    fprintf(stdprn, "\n\t\t\t\t\t  Zinssatz           : %13.2f %%", zins);
    fprintf(stdprn, "\n\t\t\t\t\t  Rckzahlungsbetrag : %13.2f DM", rueckzahlung);

    fprintf(stdprn, "\n\n\t\t\t   Erstellt am: ");
    fprintf(stdprn, "%2d.%2d.%4d  um: %2d:%2d Uhr", datum.day, datum.month,
                                       datum.year, zeit.hour, zeit.minute);
    fprintf(stdprn, "     Seite: %2d\n ", ++seite);
    for ( spalte = 3; spalte <= 80; spalte++ )
        fprintf( stdprn, "%c", 220);

    fprintf(stdprn, "\n\n    %s%s      %s      %s      %s        %s\n\n",
          "Jahr", "/Monat", "  Zinsen", "  Tilgung", "   Annuit„t",
          "Restschuld");
}

void tabelleDrucken( double kredit, double zins, int monate, int azeile, int aspalte, int ezeile, int espalte )
{
    int y, j, x, zp;
    unsigned int jahres_zahl;
    double monatsZins, restSchuld, tilgung;
    double annuitaet, dummy, i;
    struct dosdate_t datum;

    _dos_getdate( &datum );
    jahres_zahl = datum.year;

    restSchuld = kredit;
    dummy = kredit;

    tilgung = kredit / (double) monate;
    i = (zins / 100) / monate;

    zp = 1;
    x = 1;
    for ( j = 1; j <= monate; j++, zp++, x++ )
    {
        monatsZins = (restSchuld * i * monate) / 12;
        annuitaet = tilgung + monatsZins;
        restSchuld -= tilgung;

        if ( zp == 1 )
            fprintf(stdprn, "    %4u", jahres_zahl++);
        else
            fprintf(stdprn, "        ");

        fprintf(stdprn, "  %2d", x);
        fprintf(stdprn, "    %12.2f", monatsZins);
        fprintf(stdprn, "   %12.2f", tilgung);
        fprintf(stdprn, "     %12.2f", annuitaet);
        fprintf(stdprn, "     %13.2f", dummy);
        fprintf(stdprn, "\n");
        dummy = restSchuld;

        if ( j % 12 == 0 )
        {
            fprintf(stdprn, "    ");
            for ( y = 4; y < 80; y++ )
                fprintf(stdprn, "%c", 196);

            fprintf(stdprn, "\n");
            zp = 0;
            x = 0;
        }
        //Nach 48 Zeilen neue Seite, wenn noch mehr kommt
        if ( j % 48 == 0 && j < monate )
        {
            fprintf(stdprn, "\n\t\t\t\t\t*");
            fprintf(stdprn, "\f");
            tabellenKopfDrucken( kredit, zins, rueckBetrag( kredit, zins, monate ), azeile, aspalte, ezeile, espalte );
        }
    }
    fprintf(stdprn, "\n\t       ");
    for ( j = 1; j <= 50; j++ )
        { fprintf(stdprn, "%c", 42); }

    fprintf(stdprn, "\n\t\t     ");
    for ( j = 1; j <= 38; j++ )
        { fprintf(stdprn, "%c", 42); }
    fprintf(stdprn, "\f");
}

void druckAnzeige( int monate )
{
    int vg_farbe;
    long int hg_farbe;
    time_t gegenw_zeit, start_zeit;

    _settextwindow( 13, 22, 15, 58 );
    _setbkcolor( 5L );
    _clearscreen( _GWINDOW );
    time( &start_zeit );
    do
    {
        time( &gegenw_zeit );
        _settextcolor( 15 );
        _settextposition( 2, 4 );
        _outtext( "TILGUNGSPLAN WIRD AUSGEDRUCKT !" );
    } while ( gegenw_zeit - start_zeit < monate / 4 );

    _settextcursor( CURSOR_NORMAL );
    _settextcolor( vg_farbe );
    _setbkcolor( hg_farbe );
    _clearscreen( _GCLEARSCREEN );
}
Reply
#14
(07-25-2022, 10:45 PM)Kernelpanic Wrote: And if anyone thinks I'm just kidding, . . .
:

ROFLMAO M$QuickC!!! You're better than me. I created exactly one useful program with it just before I graduated from high school. It was a boring text-mode arcade game.
Reply
#15
Ah found it in OldMoses Button Rack:
Code: (Select All)
Sub Clear_MB (var As Integer)

    Do Until Not _MouseButton(var)
        While _MouseInput: Wend
    Loop

End Sub 'Clear_MB

Sorry I thought it was less loopy!
b = b + ...
Reply
#16
Thanks B+! The Sub works perfectly with it and I changed the _delay from .2 to .03 like you all suggested. I still needed the .03 because it still would double the number on a click. But it works tons faster now! I also got rid of that MouseLeftButton=0 line. Thanks also to OldMoses for that Sub code. Smile I'm also saving all of the mouse code that I learned today to its own app so I can use it from now on.

Here is the update: 

(Code deleted because of a small problem. Get fixed code below.)
Reply
#17
Sorry guys, I found one more problem in my last code. I had the Paste digit limit 2 numbers lower than the regular output limit which could mess it up if you copied the maximum 19 digits and tried to paste it. So I set both to 19 digits now. 

(Code deleted again, added features posted below.)
Reply
#18
Code: (Select All)
While _MouseInput:
        mousex = _MouseX
        mousey = _MouseY
        mouseLeftButton = _MouseButton(1)
        Clear_MB 1
    Wend

Nope! I give up. Sad
b = b + ...
Reply
#19
B+, nope what? It does work a lot faster than it did. I'm happy the way it is, unless you have a problem on your computer?

I added 2 more buttons today, the Back Space button (which also can be used with the back key), and the RND button which gives a random number between 0 and 1.

(Deleted again to fix.)
Reply
#20
I think I see what you mean B+, I put the Clear_MB 1 in the wrong place. I deleted it and put it right after "If mouseLeftButton then". 
Was a stupid mistake, sorry about that. 

Here is the fix and hopefully the last version: 

(And of course, nope, I figured out that my Mouse code was wrong with the help of B+.)

(I will post the fixed version below.)
Reply




Users browsing this thread: 1 Guest(s)