From a09ff43560675812e506d6d425c6dd829911b990 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 3 Dec 2010 22:03:29 +0100 Subject: [PATCH] Cvar list dialog: hitting Enter on the listbox, or clicking a list item, transfers focus to the cvar value text box --- qcsrc/menu/xonotic/cvarlist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qcsrc/menu/xonotic/cvarlist.c b/qcsrc/menu/xonotic/cvarlist.c index d1116a70d..3eaf2677e 100644 --- a/qcsrc/menu/xonotic/cvarlist.c +++ b/qcsrc/menu/xonotic/cvarlist.c @@ -15,7 +15,9 @@ CLASS(XonoticCvarList) EXTENDS(XonoticListBox) ATTRIB(XonoticCvarList, columnValueOrigin, float, 0) ATTRIB(XonoticCvarList, columnValueSize, float, 0) + METHOD(XonoticCvarList, mouseRelease, float(entity, vector)) METHOD(XonoticCvarList, setSelected, void(entity, float)) + ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL) ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL) ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL) @@ -162,6 +164,8 @@ float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift) CvarList_Revert_Click(world, me); return 1; } + else if(scan == K_ENTER) + me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox); else if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift)) return 1; else if(!me.controlledTextbox) @@ -170,6 +174,13 @@ float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift) return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift); } +float XonoticCvarList_mouseRelease(entity me, vector pos) +{ + if(me.pressed == 2) + me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox); + return SUPER(XonoticCvarList).mouseRelease(me, pos); +} + void CvarList_Value_Change(entity box, entity me) { cvar_set(me.cvarNameBox.text, box.text); @@ -180,4 +191,5 @@ void CvarList_Revert_Click(entity btn, entity me) me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault); me.cvarValueBox.cursorPos = strlen(me.cvarDefault); } + #endif -- 2.39.2