LongPress implementiert
This commit is contained in:
parent
f0c2bcb6c3
commit
2021f3774c
@ -25,6 +25,9 @@ namespace Deckungsbeitrag.AA_Forms
|
|||||||
public Kunde kunde;
|
public Kunde kunde;
|
||||||
public Auftrag auftrag;
|
public Auftrag auftrag;
|
||||||
private Screen screen = Screen.PrimaryScreen;
|
private Screen screen = Screen.PrimaryScreen;
|
||||||
|
private Timer longPressTimer;
|
||||||
|
private const int LongPressMs = 400; // Unter Windows-Standard (500ms)
|
||||||
|
private bool isLongPress;
|
||||||
|
|
||||||
public FormAuftragAuswahl()
|
public FormAuftragAuswahl()
|
||||||
{
|
{
|
||||||
@ -38,6 +41,11 @@ namespace Deckungsbeitrag.AA_Forms
|
|||||||
case var t when t.Contains("spannleintuch"): Abteilung = ArtikelKategorie.Spannleintuch; break;
|
case var t when t.Contains("spannleintuch"): Abteilung = ArtikelKategorie.Spannleintuch; break;
|
||||||
default: break; //TODO: Default Zuweisung löschen bevor in Echtbetrieb.
|
default: break; //TODO: Default Zuweisung löschen bevor in Echtbetrieb.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Timer für Lang-Drücken
|
||||||
|
longPressTimer = new Timer();
|
||||||
|
longPressTimer.Interval = LongPressMs;
|
||||||
|
longPressTimer.Tick += OnLongPressTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void FormAuftragAuswahl_Load(object sender, EventArgs e)
|
private async void FormAuftragAuswahl_Load(object sender, EventArgs e)
|
||||||
@ -76,11 +84,36 @@ namespace Deckungsbeitrag.AA_Forms
|
|||||||
lbl.Click += LabelAuftrag_Click;
|
lbl.Click += LabelAuftrag_Click;
|
||||||
lbl.MouseEnter += LabelAuftrag_MouseEnter;
|
lbl.MouseEnter += LabelAuftrag_MouseEnter;
|
||||||
lbl.MouseLeave += LabelAuftrag_MouseLeave;
|
lbl.MouseLeave += LabelAuftrag_MouseLeave;
|
||||||
|
lbl.MouseDown += LabelAuftrag_MouseDown;
|
||||||
panelAuswahl.Controls.Add(lbl);
|
panelAuswahl.Controls.Add(lbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LabelAuftrag_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Label lbl = sender as Label;
|
||||||
|
|
||||||
|
isLongPress = false;
|
||||||
|
|
||||||
|
// Timer starten für Lang-Drücken-Check
|
||||||
|
longPressTimer.Stop();
|
||||||
|
longPressTimer.Tag = lbl;
|
||||||
|
longPressTimer.Start();
|
||||||
|
}
|
||||||
|
private void OnLongPressTick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Lang gedrückt gehalten → kein Click, kein Contextmenü
|
||||||
|
isLongPress = true;
|
||||||
|
longPressTimer.Stop();
|
||||||
|
Label lbl = (Label)longPressTimer.Tag;
|
||||||
|
View_Auftrag_Expedit exAuftrag = (View_Auftrag_Expedit)lbl.Tag;
|
||||||
|
|
||||||
|
if (MessageBox.Show($"Möchtest du den Auftrag mit Liefertag {exAuftrag.Liefertag} auswählen?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Cancel) return;
|
||||||
|
else LabelAuftrag_Click(lbl, e);
|
||||||
|
// Optional: Dein eigenes Lang-Drücken-Feature ausführen
|
||||||
|
// MessageBox.Show("Lang gedrückt!");
|
||||||
|
}
|
||||||
private void LabelAuftrag_MouseLeave(object sender, EventArgs e)
|
private void LabelAuftrag_MouseLeave(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Label lbl = sender as Label;
|
Label lbl = sender as Label;
|
||||||
@ -120,6 +153,7 @@ namespace Deckungsbeitrag.AA_Forms
|
|||||||
{
|
{
|
||||||
TextBox textbox = sender as TextBox;
|
TextBox textbox = sender as TextBox;
|
||||||
textbox.Clear();
|
textbox.Clear();
|
||||||
|
textbox.ForeColor = Color.Black;
|
||||||
|
|
||||||
if (Program.istTouch & Screen.PrimaryScreen.WorkingArea.Width > 0 & Screen.PrimaryScreen.WorkingArea.Width < 2000)
|
if (Program.istTouch & Screen.PrimaryScreen.WorkingArea.Width > 0 & Screen.PrimaryScreen.WorkingArea.Width < 2000)
|
||||||
{
|
{
|
||||||
@ -140,7 +174,7 @@ namespace Deckungsbeitrag.AA_Forms
|
|||||||
private void FormAuftragAuswahl_Shown(object sender, EventArgs e)
|
private void FormAuftragAuswahl_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Width = screen.WorkingArea.Width;
|
this.Width = screen.WorkingArea.Width;
|
||||||
this.Height = (int)(screen.WorkingArea.Height * 0.70);
|
this.Height = (int)(screen.WorkingArea.Height * 0.60);
|
||||||
this.Location = new Point(0, 0);
|
this.Location = new Point(0, 0);
|
||||||
|
|
||||||
this.panelAuswahl.Height = this.Bottom - this.panelSuchen.Bottom - 20;
|
this.panelAuswahl.Height = this.Bottom - this.panelSuchen.Bottom - 20;
|
||||||
|
|||||||
@ -72,5 +72,5 @@ Build-Info:
|
|||||||
|
|
||||||
Keine Install-Reminder vorhanden ✅
|
Keine Install-Reminder vorhanden ✅
|
||||||
|
|
||||||
Installation: 12.06.2026 13:26
|
Installation: 12.06.2026 13:54
|
||||||
=====================================
|
=====================================
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user