Search Results

Search found 9 results on 1 pages for 'getopenfilename'.

Page 1/1 | 1 

  • QT QFileDialog how to hide hidden/backup folders (".folder")

    - by Alberto Toglia
    Basically when browsing folders inside a QFileDialog I find very annoying to have everything bloated with hidden or backup folders (don't know how to call them really); specially on home. Is there a way to prevent these type of folders from showing by default on a QFileDialog? I'm using Qt4.6 and getOpenFileName. P.D.: I'm starting to think this might be an ubuntu thing...?

    Read the article

  • How to customize file dialog in wpf

    - by ManjuAnoop
    In Windows7 I am using a customized Open File Dialog( WPF application). My Open File dialog is derived from Microsoft.Win32.CommonDialog. The dialog have old look, how to change this to new look (windows7 file dialog look(Explorer style)). Code portion: private const int OFN_ENABLESIZING = 0x00800000; private const int OFN_EXPLORER = 0x00080000; private const int OFN_ENABLEHOOK = 0x00000020; protected override bool RunDialog(IntPtr hwndOwner) { OPENFILENAME_I.WndProc proc = new OPENFILENAME_I.WndProc(this.HookProc); OPENFILENAME_I ofn = new OPENFILENAME_I(); this._charBuffer = CharBuffer.CreateBuffer(0x2000); if (this._fileNames != null) { this._charBuffer.PutString(this._fileNames[0]); } ofn.lStructSize = Marshal.SizeOf(typeof(OPENFILENAME_I)); ofn.hwndOwner = hwndOwner; ofn.hInstance = IntPtr.Zero; ofn.lpstrFilter = MakeFilterString(this._filter, this.DereferenceLinks); ofn.nFilterIndex = this._filterIndex; ofn.lpstrFile = this._charBuffer.AllocCoTaskMem(); ofn.nMaxFile = this._charBuffer.Length; ofn.lpstrInitialDir = this._initialDirectory; ofn.lpstrTitle = this._title; ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_ENABLEHOOK; ofn.lpfnHook = proc; ofn.FlagsEx = 0x1000000 ; NativeMethods.GetOpenFileName(ofn); // } [SecurityCritical, SuppressUnmanagedCodeSecurity, DllImport("comdlg32.dll", CharSet = CharSet.Unicode, SetLastError = true)] internal static extern bool GetOpenFileName([In, Out] OPENFILENAME_I ofn);

    Read the article

  • Making File Dialog only accept directories

    - by matt
    I want to have a file dialog only allow directories, here's what I've been trying: fileDialog = QtGui.QFileDialog() fileDialog.setFileMode(QtGui.QFileDialog.ShowDirsOnly) filename = fileDialog.getOpenFileName(self, 'Select USB Drive Location')) Thank You

    Read the article

  • Separating null byte separated UNICODE C string.

    - by Ramblingwood
    First off, this is NOT a duplicate of: http://stackoverflow.com/questions/1911053/turn-a-c-string-with-null-bytes-into-a-char-array , because the given answer doesn't work when the char *'s are Unicode. I think the problem is that because I am trying to use Unicode and thus wchar_t instead of char, the length of each character is different and thus, this doesn't work (it does in non-unicode): char *Buffer; // your null-separated strings char *Current; // Pointer to the current string // [...] for (Current = Buffer; *Current; Current += strlen(Current) + 1) printf("GetOpenFileName returned: %s\n", Current); Does anyone have a similar solution that works on Unicode strings? I have been banging my head on the this for over 4 hours now. C doesn't agree with me.

    Read the article

  • C++ GUI using QT

    - by user1488019
    I want to build a c++ GUI using Qt plaform. this a part of my code which is about opening an image file. i used this method to open the image, but when i choose it from a specific folder nothing is shown (no image). void MainWindow::openI() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::currentPath()); if (!fileName.isEmpty()) { QImage image(fileName); if (image.isNull()) { QMessageBox::information(this, tr("Image Viewer"), tr("Cannot load %1.").arg(fileName)); return; } } } Please help me!! this is a small part of my project

    Read the article

  • Form wont stay on top. How do I keep my excel form from hiding behind other windows after I browse

    - by ScottK
    I have a vb.net program that opens up an excel workbook and runs a macro ("Report") in that workbook when a button is clicked. //Workbook with macro and form xlWorkbook = xlApp.Workbooks.Open("W:Data\Excel Program.xls") //Macro: xlApp.Run("Report") //Macro opens form from workbook. I browse for my two .csv files //and then click a button to run code that creates my reports. //form closes, show the excel report after its created xlApp.Visible = True After I browse my first file and select it so that its location is displayed in my text box, the excel form then hides behind any open windows. I want this form to stay on top. It is after this code executes that the form will hide behind all other open windows: Private Sub btnBrowseFile1_Click() Dim fileName1 As String fileName1 = Application.GetOpenFilename("CSV file (*.csv), *.csv") If fileName1 <> "False" Then Me.txtFileName1.text = fileName1 End If End Sub EDIT: I still have no luck with this problem. When the excel macro is opened from a vb program I have this hiding issue...but only after browsing for a file. Why does the focus leave the form and go to Windows after browsing a file? Any one have any suggestions?

    Read the article

  • Excel VBA: Error Handling with Case Statement

    - by AME
    I am trying to validate a file that is uploaded by the user using the code below. The error handler checks the top row of the uploaded file for three specific column names. If one or more of the column names is not present, the program should return a prompt to the user notifying them which column(s) are missing from the file that they uploaded and then close the file. There are a couple issues with my current VBA code that I am seeking help with: The prompt doesn't specify which column(s) are missing to the user. The error handler is triggered even when all required columns are present in the uploaded file. Code: Sub getworkbook() ' Get workbook... Dim ws As Worksheet Dim filter As String Dim targetWorkbook As Workbook, wb As Workbook Dim Ret As Variant Set targetWorkbook = Application.ActiveWorkbook ' get the customer workbook filter = ".xlsx,.xls" caption = "Please select an input file " Ret = Application.GetOpenFilename(filter, , caption) If Ret = False Then Exit Sub Set wb = Workbooks.Open(Ret) On Error GoTo ErrorLine: 'Check for columns var1 = ActiveSheet.Range("1:1").Find("variable1", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column var2 = ActiveSheet.Range("1:1").Find("variable2", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column var3 = ActiveSheet.Range("1:1").Find("variable3", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column ErrorLine: MsgBox ("The selected file is missing a key data column, please upload a correctly formated file.") If Error = True Then ActiveWorkSheet.Close wb.Sheets(1).Move Before:=targetWorkbook.Sheets("Worksheet2") ActiveSheet.Name = "DATA" End Sub

    Read the article

  • Merge Mutliple Excel Workbooks

    - by IRHM
    I wonder whether someone may be able to help me please. I'm trying to use the code below to allow the user to select multiple Excel Workbooks, amalgamating the data into one 'Summary' sheet. Sub Merge() Dim DestWB As Workbook, WB As Workbook, WS As Worksheet, SourceSheet As String Set DestWB = ActiveWorkbook SourceSheet = "Input" startrow = 7 FileNames = Application.GetOpenFilename( _ filefilter:="Excel Files (*.xls*),*.xls*", _ Title:="Select the workbooks to merge.", MultiSelect:=True) If IsArray(FileNames) = False Then If FileNames = False Then Exit Sub End If End If For n = LBound(FileNames) To UBound(FileNames) Set WB = Workbooks.Open(Filename:=FileNames(n), ReadOnly:=True) For Each WS In WB.Worksheets If WS.Name = SourceSheet Then With WS If .UsedRange.Cells.Count > 1 Then dr = DestWB.Worksheets("Input").Range("C" & Rows.Count).End(xlUp).Row + 1 lastrow = .Range("C" & Rows.Count).End(xlUp).Row For j = lastrow To startrow Step -1 Select Case .Range("E" & j).Value Case "Manager", "Lead", "Technical", "Analyst" 'do nothing Case Else .Rows(j).EntireRow.Delete End Select Next lastrow = .Range("C" & Rows.Count).End(xlUp).Row If lastrow >= startrow Then .Range("B" & startrow & ":AD" & lastrow).Copy DestWB.Worksheets("Input").Cells(dr, "B").PasteSpecial xlValues .Range("AF" & startrow & ":AQ" & lastrow).Copy DestWB.Worksheets("Input").Cells(dr, "AF").PasteSpecial xlValues .Range("AS" & startrow & ":AS" & lastrow).Copy DestWB.Worksheets("Input").Cells(dr, "AS").PasteSpecial xlValues End If End If End With Exit For End If Next WS WB.Close savechanges:=False Next n End Sub The code works fine except for one issue which I've been trying to solve for the last few weeks. The following line of code looks in column E of the Source file, and if any of the entries match the values shown in the code it copies that row of data to paste into the Destination file. If Range("E" & j) <> "Manager" And Range("E" & j) <> "Lead" And Range("E" & j) <> "Technical" And Range("E" & j) <> "Analyst" Then Rows(j).Delete The problem I have is that if none of these values are found in the Source file, I receive the following error: Run time error '1004': Delete method of range class failed and in Debug mode it highlights this part of the line as the source of the error, but I've no idea why. Rows(j).Delete I just wondered whether someone may be able to look at this please and let me know where I'm going wrong, or perhaps even suggest a more efficient process of allowing the user to merge the workbooks. Many thanks and kind regards

    Read the article

  • Issue Parsing File with YAML-CPP

    - by Andrew
    In the following code, I'm having some sort of issue getting my .yaml file parsed using parser.GetNextDocument(doc);. After much gross debugging, I've found that the (main) issue here is that my for loop is not running, due to doc.size() == 0; What am I doing wrong? void BookView::load() { aBook.clear(); QString fileName = QFileDialog::getOpenFileName(this, tr("Load Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if(fileName.isEmpty()) { return; } else { try { std::ifstream fin(fileName.toStdString().c_str()); YAML::Parser parser(fin); YAML::Node doc; std::map< std::string, std::string > entry; parser.GetNextDocument(doc); std::cout << doc.size(); for( YAML::Iterator it = doc.begin(); it != doc.end(); it++ ) { *it >> entry; aBook.push_back(entry); } } catch(YAML::ParserException &e) { std::cout << "YAML Exception caught: " << e.what() << std::endl; } } updateLayout( Navigating ); } The .yaml file being read was generated using yaml-cpp, so I assume it is correctly formed YAML, but just in case, here's the file anyways. ^@^@^@\230--- - address: ****************** comment: None. email: andrew(dot)levenson(at)gmail(dot)com name: Andrew Levenson phone: **********^@ Edit: By request, the emitting code: void BookView::save() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if (fileName.isEmpty()) { return; } else { QFile file(fileName); if(!file.open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } std::vector< std::map< std::string, std::string > >::iterator itr; std::map< std::string, std::string >::iterator mItr; YAML::Emitter yaml; yaml << YAML::BeginSeq; for( itr = aBook.begin(); itr < aBook.end(); itr++ ) { yaml << YAML::BeginMap; for( mItr = (*itr).begin(); mItr != (*itr).end(); mItr++ ) { yaml << YAML::Key << (*mItr).first << YAML::Value << (*mItr).second; } yaml << YAML::EndMap; } yaml << YAML::EndSeq; QDataStream out(&file); out.setVersion(QDataStream::Qt_4_5); out << yaml.c_str(); } }

    Read the article

1