[PR #216] [MERGED] CtrlLib: WhenLeftUp event added to DocEdit/LineEdit/RichEdit #239

Closed
opened 2026-05-05 03:43:39 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ultimatepp/ultimatepp/pull/216
Author: @ismail-yilmaz
Created: 11/30/2024
Status: Merged
Merged: 1/29/2025
Merged by: @mirek-fidler

Base: masterHead: WhenLeftUp


📝 Commits (6)

  • e68755c CtrlLib: WhenLeftUp event added to DocEdit/LineEdit/RichEdit
  • 1e2169a RichEdit: WhenLeftUp made public.
  • 924af5a Merge branch 'ultimatepp:master' into WhenLeftUp
  • bd0e6f3 Merge branch 'ultimatepp:master' into WhenLeftUp
  • 9534e1a Merge branch 'ultimatepp:master' into WhenLeftUp
  • db94681 Merge branch 'ultimatepp:master' into WhenLeftUp

📊 Changes

7 files changed (+16 additions, -0 deletions)

View changed files

📝 uppsrc/CtrlLib/DocEdit.cpp (+1 -0)
📝 uppsrc/CtrlLib/LineEdit.cpp (+1 -0)
📝 uppsrc/CtrlLib/TextEdit.h (+3 -0)
📝 uppsrc/CtrlLib/src.tpp/DocEdit_en-us.tpp (+4 -0)
📝 uppsrc/CtrlLib/src.tpp/LineEdit_en-us.tpp (+4 -0)
📝 uppsrc/RichEdit/Mouse.cpp (+1 -0)
📝 uppsrc/RichEdit/RichEdit.h (+2 -0)

📄 Description

Patch Introduction: New Event: WhenLeftUp

Objective:
This patch introduces the WhenLeftUp event to enhance customization options for client code.

Purpose:
The event enables developers to implement contextual actions for selected text, akin to the behavior seen in modern text editors and word processors like Microsoft Word. For instance, upon selecting text, a small menu can be triggered and displayed immediately when the left mouse button is released. Of course, it is not limited to this usage. But the real rationale behind it is this.

Immediately available in:

  • DocEdit
  • LineEdit (and its derivatives, e.g. CodeEditor)
  • RichEdit

A simple example:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	TopWindow w;
	DocEdit   e;
	e <<= "Hello world;";
	e.WhenLeftUp = [&] { if(e.IsSelection()) MenuBar::Execute([&](Bar& menu) { e.StdBar(menu); }, GetMousePos()); };
	w.Sizeable().Zoomable().SetRect(0, 0, 800, 600);
	w.Add(e.SizePos());
	w.Run();
}

In the above example I used DocEdit::StdBar, but the real purpose is to allow setting up other types of menus and "tool" bars.

This patch is proposed for the next release cycle.

Please review.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ultimatepp/ultimatepp/pull/216 **Author:** [@ismail-yilmaz](https://github.com/ismail-yilmaz) **Created:** 11/30/2024 **Status:** ✅ Merged **Merged:** 1/29/2025 **Merged by:** [@mirek-fidler](https://github.com/mirek-fidler) **Base:** `master` ← **Head:** `WhenLeftUp` --- ### 📝 Commits (6) - [`e68755c`](https://github.com/ultimatepp/ultimatepp/commit/e68755cd13dfbd9b0d5e10b429b332ad1654a294) CtrlLib: WhenLeftUp event added to DocEdit/LineEdit/RichEdit - [`1e2169a`](https://github.com/ultimatepp/ultimatepp/commit/1e2169af368c9ae8564c7a758349a81a4c103698) RichEdit: WhenLeftUp made public. - [`924af5a`](https://github.com/ultimatepp/ultimatepp/commit/924af5af65f58a8d63b37c369ebbf3e715679b84) Merge branch 'ultimatepp:master' into WhenLeftUp - [`bd0e6f3`](https://github.com/ultimatepp/ultimatepp/commit/bd0e6f3a4e071ef3a77fa0bfa7e5a99fd8f9a2fe) Merge branch 'ultimatepp:master' into WhenLeftUp - [`9534e1a`](https://github.com/ultimatepp/ultimatepp/commit/9534e1a3af322af9614e3391fad0a9bc674f7b4e) Merge branch 'ultimatepp:master' into WhenLeftUp - [`db94681`](https://github.com/ultimatepp/ultimatepp/commit/db946816feb51035790e3ad1499fdc387039457b) Merge branch 'ultimatepp:master' into WhenLeftUp ### 📊 Changes **7 files changed** (+16 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `uppsrc/CtrlLib/DocEdit.cpp` (+1 -0) 📝 `uppsrc/CtrlLib/LineEdit.cpp` (+1 -0) 📝 `uppsrc/CtrlLib/TextEdit.h` (+3 -0) 📝 `uppsrc/CtrlLib/src.tpp/DocEdit_en-us.tpp` (+4 -0) 📝 `uppsrc/CtrlLib/src.tpp/LineEdit_en-us.tpp` (+4 -0) 📝 `uppsrc/RichEdit/Mouse.cpp` (+1 -0) 📝 `uppsrc/RichEdit/RichEdit.h` (+2 -0) </details> ### 📄 Description Patch Introduction: New Event: WhenLeftUp Objective: This patch introduces the WhenLeftUp event to enhance customization options for client code. Purpose: The event enables developers to implement contextual actions for selected text, akin to the behavior seen in modern text editors and word processors like Microsoft Word. For instance, upon selecting text, a small menu can be triggered and displayed immediately when the left mouse button is released. Of course, it is not limited to this usage. But the real rationale behind it is this. *Immediately available in:* - `DocEdit` - `LineEdit` (and its derivatives, e.g. `CodeEditor`) - `RichEdit` A simple example: ``` #include <CtrlLib/CtrlLib.h> using namespace Upp; GUI_APP_MAIN { TopWindow w; DocEdit e; e <<= "Hello world;"; e.WhenLeftUp = [&] { if(e.IsSelection()) MenuBar::Execute([&](Bar& menu) { e.StdBar(menu); }, GetMousePos()); }; w.Sizeable().Zoomable().SetRect(0, 0, 800, 600); w.Add(e.SizePos()); w.Run(); } ``` In the above example I used `DocEdit::StdBar`, but the real purpose is to allow setting up other types of menus and "tool" bars. This patch is proposed for the next release cycle. Please review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 03:43:39 -06:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#239
No description provided.