diff --git a/src/include/sheet.cpp b/src/include/sheet.cpp index 835f1f67b..174db061d 100755 --- a/src/include/sheet.cpp +++ b/src/include/sheet.cpp @@ -1668,10 +1668,11 @@ bool TCursor_sheet::filter_dialog() { TRectype rec = _cursor->curr(); const RecDes& rd = rec.rec_des(); - const KeyDes& k0 = rd.Ky[0]; + const int keyNum = _cursor->key(); + const KeyDes& k0 = rd.Ky[keyNum - 1]; const int kfields = k0.NkFields; - TMask m(TR("Filtro"), 1, 78, kfields+5); + TMask m(TR("Filtro"), 1, 78, kfields+8); m.add_button_tool(DLG_OK, "", TOOL_OK); m.add_button_tool(DLG_CANCEL, "", TOOL_CANCEL); int max_len = 0; @@ -1710,7 +1711,7 @@ bool TCursor_sheet::filter_dialog() max_len += 10; } - for (int i = 0; i < kfields-1; i++) + for (int i = 0; i < kfields; i++) { const int nf = k0.FieldSeq[i] % MaxFields; const char * fname = rec.fieldname(nf);