News Ticker

Get the name of the day today!

June 22, 2019

Here is an example of what the function returns: ‘The day today is ‘ + daytoday+’.’ Returns on a monday: The day today is Monday. Here is the function: function daytoday: string; begin Result:=”; {Can […]

Better moving form

June 22, 2019

unit Unit1; interface uses   Windows,   Messages,   Forms; type   TForm1 = class(TForm)   protected     procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;   end; var   Form1: TForm1; implementation {$R *.DFM} procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest); begin   // Call default procedure   inherited; […]

Change String To Proper Case

June 22, 2019

NOTE:Make sure to add “StrUtils” to your Uses section function properCase(sBuffer: string):string; var iLen, iIndex: integer; begin iLen := Length(sBuffer); sBuffer:= Uppercase(MidStr(sBuffer, 1, 1)) + Lowercase(MidStr(sBuffer,2, iLen)); for iIndex := 0 to iLen do begin […]

Delphi TextFile tutorial for beginners

June 22, 2019

Right. Well, as I explained in the purpose section, this file is meant for beginners who want to learn about text file management and routines, so, if you’re an experienced Delphi programmer, you might just […]

Understanding the Basics of Delphi Programming

June 22, 2019

Beginner developers eager to master the Delphi programming language should already be familiar with the basics of Microsoft Windows. Learning Delphi is easiest if you approach it from a guided, tutorial-based frame of reference. Foundational Concepts Get started […]

get different background color of DBGrid for odd and even rows (2)?

March 3, 2019

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //source for main form : //… uses // … Grids, DBGrids, db //… procedure artgrid(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); //… implementation //… procedure TForm1.artgrid(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if ((Sender as tdbgrid).DataSource.DataSet.RecNo mod 2) = 0 then (Sender as tdbgrid).Canvas.Brush.Color := clblue; //or any color (Sender as tdbgrid).DefaultDrawColumnCell(rect, datacol, column, state); end; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // for all DrawColumnCell event of DBGrid in any Form (here “Form2”): procedure TForm2.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin Form1.artgrid(Sender, Rect, DataCol, Column, State); end;

get different background color of DBGrid for odd and even rows

March 3, 2019

{ Um in einem DBGrid die Übersicht zu behalten, ist es sehr angenehm, die Zeile abwechselnd einzufärben. Folgender Code soll Euch die näher bringen. Viel Erfolg beim Programmieren! Malte } procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var test1: Real; RowNo: Integer; begin with (Sender as TDBGrid) do begin if (gdSelected in State) then begin // Farbe für die Zelle mit dem Focus // color of the focused row Canvas.Brush.Color := clblue; end else begin // Zeile erfahren // get the actual row number rowno := Query1.RecNo; // gerade und ungerade Zeilen ermitteln // odd or even ? test1 := (RowNo / 2) – trunc(RowNo / 2); // Zeile gerade… // If it’s an even one… if test1 = 0 then begin farbe := clWhite […]

create an Access Database From Delphi

March 3, 2019

uses ComObj; procedure TForm1.Button1Click(Sender: TObject); var AccessApp: Variant; begin AccessApp := CreateOleObject(‘Access.Application’); AccessApp.NewCurrentDatabase(‘c:\111.mdb’); AccessApp := Unassigned; end;

create a table including an AutoInc field (ADO/MSSQL)?

March 3, 2019

// Erzeugt eine Tabelle mit dem Namen MYTABLENAME, mit den Spalten ID, // MYTEXT1, MYTEXT2. // (Der Name der ID Spalte kann natürlich frei gewählt werden.) // ID ist der Primärschlüssel der Tabelle. Er ist ein Integer, der sich // automatisch für jede Zeile // der Tabelle erhöht. ID wird nie doppelt vorkommen. // MYTEXT1 und 2 sind vom Typ String. // Ich verwende die ADOConnection um mit Jet 4.0 auf eine Access- // datenbank (*.mdb) zuzugreifen. // Der Syntax ist MSSQL, wenn ihr das für PHP oder so verwenden wollt, // muss man das ein bissel umformulieren 😉 // Creates a Table called MYTABLENAME with a unique identifier called // “ID”. ID increases with every new row automatically. MYTEXT1 and 2 // are Strings. Name the colums as you want to. // I used the ADOConnection to access a MS-Access Database (*.mdb) // via Jet 4.0. // The Syntax is MSSQL, you have to transform it to use it in PHP or so. uses AdoDB; var q: TAdoQuery; db: TAdoConnection; begin // Initialize db here q := TADOQuery.Create(nil); q.Connection := db; q.Close; q.SQL.Clear; q.SQL.Add(‘Create Table MYTABLENAME (ID COUNTER PRIMARY KEY, MYTEXT1 String, MYTEXT2 String);’); q.Prepared := True; try q.ExecSQL; except end; q.Free; end;

MikroTik RoMON Feature

May 9, 2017

 MikroTik Newsletter announced a new feature added to MikroTik RouterOS, RoMON.  This was first discussed at the Mikrotik Miami MUM held earlier this year but is apparently now a part of RouterOS since version 6.38.  So […]

IPv6 over PPPoE – RouterOS v5.10

May 9, 2017

IPv6 prefix delegation support comes to PPPoE in RouterOS version v5.10* so for those of you ready to jump onboard this release, here’s my attempt at a best-practice way to set it all up. IPv6 […]

Arduino – Keyboard Serial

April 25, 2017

This example listens for a byte coming from the serial port. When received, the board sends a keystroke back to the computer. The sent keystroke is one higher than what is received, so if you […]

Arduino – Mouse Button Control

April 25, 2017

Using the Mouse library, you can control a computer's onscreen cursor with an Arduino Leonardo, Micro, or Due. This particular example uses five pushbuttons to move the onscreen cursor. Four of the buttons are directional […]

Arduino – Keyboard Message

April 25, 2017

In this example, when the button is pressed, a text string is sent to the computer as keyboard input. The string reports the number of times the button is pressed. Once you have the Leonardo […]

Arduino – Keyboard Logout

April 25, 2017

This example uses the Keyboard library to log you out of your user session on your computer when pin 2 on the ARDUINO UNO is pulled to ground. The sketch simulates the keypress in sequence […]

Arduino – LED Bar Graph

April 25, 2017

This example shows you how to read an analog input at analog pin 0, convert the values from analogRead() into voltage, and print it out to the serial monitor of the Arduino Software (IDE). Components […]

Arduino – Reading Analog Voltage

April 25, 2017

This example will show you how to read an analog input on analog pin 0. The input is converted from analogRead() into voltage, and printed out to the serial monitor of the Arduino Software (IDE). […]

Arduino – Fading LED

April 25, 2017

This example demonstrates the use of the analogWrite() function in fading an LED off. AnalogWrite uses pulse width modulation (PWM), turning a digital pin on and off very quickly with different ratios between on and […]

Arduino – Blinking LED

April 25, 2017

LEDs are small, powerful lights that are used in many different applications. To start, we will work on blinking an LED, the Hello World of microcontrollers. It is as simple as turning a light on […]

Arduino – Serial Peripheral Interface

April 25, 2017

A Serial Peripheral Interface (SPI) bus is a system for serial communication, which uses up to four conductors, commonly three. One conductor is used for data receiving, one for data sending, one for synchronization and […]

Arduino – Inter Integrated Circuit

April 25, 2017

Inter-integrated circuit (I2C) is a system for serial data exchange between the microcontrollers and specialized integrated circuits of a new generation. It is used when the distance between them is short (receiver and transmitter are […]

Arduino – Communication

April 25, 2017

Hundreds of communication protocols have been defined to achieve this data exchange. Each protocol can be categorized into one of the two categories: parallel or serial. Parallel Communication Parallel connection between the Arduino and peripherals […]

Arduino – Interrupts

April 25, 2017

Interrupts stop the current work of Arduino such that some other work can be done. Suppose you are sitting at home, chatting with someone. Suddenly the telephone rings. You stop chatting, and pick up the […]

Arduino – Random Numbers

April 25, 2017

To generate random numbers, you can use Arduino random number functions. We have two functions − randomSeed(seed) random() randomSeed (seed) The function randomSeed(seed) resets Arduino’s pseudorandom number generator. Although the distribution of the numbers returned […]

Arduino – Pulse Width Modulation

April 25, 2017

Pulse Width Modulation or PWM is a common technique used to vary the width of the pulses in a pulse-train. PWM has many applications such as controlling servos and speed controllers, limiting the effective power […]

Arduino – Due & Zero

April 25, 2017

The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU. It is the first Arduino board based on a 32-bit ARM core microcontroller. Important features − It has 54 digital […]

Arduino – Trigonometric Functions

April 25, 2017

You need to use Trigonometry practically like calculating the distance for moving object or angular speed. Arduino provides traditional trigonometric functions (sin, cos, tan, asin, acos, atan) that can be summarized by writing their prototypes. […]

Arduino – Math Library

April 25, 2017

The Arduino Math library (math.h) includes a number of useful mathematical functions for manipulating floating-point numbers. Library Macros Following are the macros defined in the header math.h − Given below is the list of macros […]

Arduino – Character Functions

April 25, 2017

All data is entered into computers as characters, which includes letters, digits and various special symbols. In this section, we discuss the capabilities of C++ for examining and manipulating individual characters. The character-handling library includes […]

Arduino – Advanced I/O Function

April 25, 2017

In this chapter, we will learn some advanced Input and Output Functions. analogReference() Function Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options […]

Arduino – I/O Functions

April 25, 2017

The pins on the Arduino board can be configured as either inputs or outputs. We will explain the functioning of the pins in those modes. It is important to note that a majority of Arduino […]

Arduino – Arrays

April 25, 2017

An array is a consecutive group of memory locations that are of the same type. To refer to a particular location or element in the array, we specify the name of the array and the […]

Arduino – Time

April 25, 2017

arduino provides four different time manipulation functions. They are − S.No. Function & Description 1 delay () function The way the delay() function works is pretty simple. It accepts a single integer (or number) argument. This number […]

1 2 3