Ejemplo n.º 1
0
void DataExportDlg::on_widget_change()
{
    wxString s = (only_a_cb->GetValue() ? wxT("if a: ") : wxT("all: "));
    for (size_t i = 0; i < list->GetCount(); ++i) {
        if (list->IsChecked(i)) {
            if (!s.EndsWith(wxT(": ")) && !cv[i].empty())
                    s += wxT(", ");
            s += cv[i];
        }
    }
    text->ChangeValue(s);
    FindWindow(wxID_OK)->Enable(true);
}
Ejemplo n.º 2
0
void DataExportDlg::OnTextChanged(wxCommandEvent&)
{
    //if (!text->IsModified())
    //    return;
    string s = wx2s(text->GetValue());
    size_t colon = s.find(':');
    bool parsable = (ftk->check_syntax("print " + s) && colon != string::npos);
    FindWindow(wxID_OK)->Enable(parsable);
    if (parsable) {
        only_a_cb->SetValue(s.substr(0, colon) == "if a");
        vector<string> v = split_string(s.substr(colon + 1), ',');
        vm_foreach (string, i, v)
            *i = strip_string(*i);
        for (size_t i = 0; i < list->GetCount(); ++i)
            list->Check(i, contains_element(v, wx2s(cv[i])));
    }
}