From: Rudolf Polzer Date: Fri, 3 Dec 2010 21:03:29 +0000 (+0100) Subject: Cvar list dialog: hitting Enter on the listbox, or clicking a list item, transfers... X-Git-Tag: xonotic-v0.1.0preview~73^2^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a09ff43560675812e506d6d425c6dd829911b990;p=xonotic%2Fxonotic-data.pk3dir.git Cvar list dialog: hitting Enter on the listbox, or clicking a list item, transfers focus to the cvar value text box --- 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