Skip to content
ExamplesOpen editor ↗

taetsiEKwadilwe

→ keyTyped()

Runs once when a key that types a character is pressed.

tiro taetsiEKwadilwe() { ... }

Declare taetsiEKwadilwe as a function with tiro. It is like taetsiETobeditswe, except that it skips keys that do not type anything: SHIFT, CONTROL and the arrow keys.

It is what you want when you are collecting text — a reader’s name, or a word to be drawn on the canvas. For every key, use taetsiETobeditswe.

kwadilwe is “has been written” — ordinary Setswana.

Click the sketch first. It reaches the sketch only while the preview pane holds the keyboard focus.

Type onto the canvas
diri mafoko = '';

tiro setaLoeto() {
  thalaKanefase(400, 200);
  tlhalosa('Kanefase e e bosetlha e e bontshang ditlhaka tse o di kwalang. Tobetsa setshwantsho pele.');
}

tiro tshwantsha() {
  bokamorago(242);
  tlatsaMmala(40, 60, 90);
  bogoloJwaMokwalo(26);
  rulaganyaMokwalo(BOGARE);
  thalaMokwalo(mafoko, 200, 110);

  tlatsaMmala(140);
  bogoloJwaMokwalo(13);
  thalaMokwalo('Tobetsa setshwantsho, mme o bo o kwala', 200, 175);
}

tiro taetsiEKwadilwe() {
  mafoko = mafoko + taetsi;
}

taetsiETobeditswe, taetsiEGolotswe, taetsi