filebox->column_of_type(FILEBOX_NAME), 0);
if(item) {
- char path[BCTEXTLEN];
- strcpy(path, item->get_text());
- filebox->textbox->update(path);
- filebox->fs->extract_dir(filebox->directory, path);
- filebox->fs->extract_name(filebox->filename, path);
- filebox->fs->complete_path(path);
- strcpy(filebox->current_path, path);
- strcpy(filebox->submitted_path, path);
+ filebox->textbox->update(item->get_text());
+ filebox->update_paths(item->get_text());
}
return 1;
}
int BC_FileBoxTextBox::handle_event()
{
- int result = 0;
- if(get_keypress() != RETURN)
- {
+ int key = get_keypress(), result = 1;
+ if( !key || key == RETURN ) // not a text update
+ filebox->update_paths(filebox->textbox->get_text());
+ else
result = calculate_suggestions(&filebox->list_column[0]);
- }
return result;
}
}
+void BC_FileBox::update_paths(const char *text)
+{
+ char path[BCTEXTLEN];
+ strncpy(path, text, sizeof(path)-1);
+ fs->extract_dir(directory, path);
+ fs->extract_name(filename, path);
+ fs->complete_path(path);
+ strcpy(current_path, path);
+ strcpy(submitted_path, path);
+}
+
void BC_FileBox::move_column(int src, int dst)
{
if(src != dst)
char* BC_FileBox::get_path(int selection)
{
if(selection == 0)
- {
return get_submitted_path();
- }
- else
- {
- BC_ListBoxItem *item = listbox->get_selection(
- column_of_type(FILEBOX_NAME), selection - 1);
- if(item)
- {
- fs->join_names(string, directory, item->get_text());
- return string;
- }
+ BC_ListBoxItem *item = listbox->get_selection(
+ column_of_type(FILEBOX_NAME), selection - 1);
+ if( item ) {
+ fs->join_names(string, directory, item->get_text());
+ return string;
}
return 0;
}
char* BC_FileBox::get_submitted_path()
{
+ update_paths(textbox->get_text());
return submitted_path;
}