If you don't get an nsIFileWidget, don't just go ahead and call methods on it.

This commit is contained in:
sfraser%netscape.com 1999-05-07 04:54:43 +00:00
Родитель 78190756bd
Коммит 9b1a2f8d7e
2 изменённых файлов: 32 добавлений и 26 удалений

Просмотреть файл

@ -154,25 +154,28 @@ void nsFileControlFrame::MouseClicked(nsIPresContext* aPresContext)
textView->GetParent(parentView);
nsIWidget* parentWidget = GetWindowTemp(parentView);
nsIFileWidget *fileWidget;
nsIFileWidget *fileWidget = nsnull;
nsString title("File Upload");
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
if (fileWidget)
{
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
}
NS_RELEASE(fileWidget);
}
NS_RELEASE(fileWidget);
NS_RELEASE(parentWidget);
NS_RELEASE(textWidget);
NS_RELEASE(widget);

Просмотреть файл

@ -154,25 +154,28 @@ void nsFileControlFrame::MouseClicked(nsIPresContext* aPresContext)
textView->GetParent(parentView);
nsIWidget* parentWidget = GetWindowTemp(parentView);
nsIFileWidget *fileWidget;
nsIFileWidget *fileWidget = nsnull;
nsString title("File Upload");
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
if (fileWidget)
{
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
}
NS_RELEASE(fileWidget);
}
NS_RELEASE(fileWidget);
NS_RELEASE(parentWidget);
NS_RELEASE(textWidget);
NS_RELEASE(widget);