Skip to content
ExamplesOpen editor ↗

pebaEKonyilwe

→ mouseClicked()

Runs once after a mouse button has been pressed and released.

tiro pebaEKonyilwe() { ... }

Declare pebaEKonyilwe as a function with tiro. It runs after pebaEGolotswe — it is the completed click: down and back up again.

konya, not tobetsa. Setswana uses one word, tobetsa, for two English ones: press and click. Bopa splits them with konya — to touch and lift off — because there are two distinct events: pebaETobeditswe when the button merely goes down, and pebaEKonyilwe when the whole click has happened. To konya is to press and release a mouse button once, which is exactly what pebaEKonyilwe means.

On a phone, a finger does the mouse’s job — which makes the name truer, not looser: to konya is to put a finger on the screen and lift it off, and that is how most sketches in Botswana will be used.

On a page element, use dirisaMoGo(e, pebaEKonyilwe, handler) to register a click callback; pass maaka to remove it. The callback receives the native event and element this binding.

A button that counts clicks
diri palo = 0;

tiro setaLoeto() {
  thalaKanefase(400, 240);
  tlhalosa('Khutlonne e e mo bogareng le palo e e okelediwang nako nngwe le nngwe fa e konyiwa.');
}

tiro tshwantsha() {
  bokamorago(238);
  tlogelaMothalo();
  tlatsaMmala(80, 150, 200);
  thalaKhutlonne(130, 70, 140, 70);

  tlatsaMmala(255);
  bogoloJwaMokwalo(28);
  rulaganyaMokwalo(BOGARE);
  thalaMokwalo(palo, 200, 115);
}

tiro pebaEKonyilwe() {
  fa (pebaX > 130 && pebaX < 270 && pebaY > 70 && pebaY < 140) {
    palo = palo + 1;
  }
}

pebaETobeditswe, pebaEGolotswe, pebaEKonyilweGabedi