Open ajtruckle opened 2 months ago
Yes, that would be a very good feature!
Ideally a global search feature:
@cengizu that is a nice idea. Although I have never used other controls in a toolbar. I am using the CMFCToolBar
control and it seems that this kind of thing is possible:
https://learn.microsoft.com/en-us/cpp/mfc/walkthrough-putting-controls-on-toolbars?view=msvc-170
I am not sure if it is compatible with CDialog
derived applications. We will have to investigate! 🥽
@cengizu I am not sure how the mechanics of this approach would work. In Public Talks we had:
And, the scope was specific to the database in question and the type of fields in question:
I appreciate that MSA which a different set of databases to search, but we have to flesh out the logic for doing a search from a single edit box. This is why I would prefer a Find dialog where we have control over the data the user inputs and therefore know which fields to examine etc. I am open to suggestions.
@cengizu Hi, have you given thought to how the GUI would be implemented for this feature? I know you mentioned a text box on the toolbar, but we do have several types of data to search:
@ajtruckle I can only advise on the GUI, but the most important part is what will happen in the background: which databases the search function will search in and writing the appropriate algorithm for it. Determining what kind of data files to include in the search : xml, binary files etc. The last thing is to decide on the GUI implentetion. But the fact is, if you can achieve it, it will be a huge plus to MSA.
Here is how AI lays it out:
Recommended Approach
If the search results are relatively simple and short (e.g., file names, IDs), use a CComboBox
in the main dialog or a toolbar.
If the results are more complex or require showing more details (e.g., metadata from XML or binary files), use a separate modeless dialog with a CListCtrl
.
Backend Implementation for Searching Files Here’s how you can implement the backend logic:
a. Search Functionality:
Reading XML Databases:
CMarkup
or MSXML) to parse XML files.Searching Binary Files:
ifstream
, CFile
) to read binary files.Storing and Filtering Results:
std::vector<CString>
).Populating the UI with Results:
CComboBox
, use AddString
to populate results.CListCtrl
, use InsertItem
and SetItemText
to display details.b. Event Handling:
Conclusion:
For simpler searches: A CComboBox
drop-down list within the main dialog works well.
For complex results: A modeless dialog with a CListCtrl
provides more flexibility and a better user experience.
@cengizu Thanks. I think that we should add a Search toolbar icon. This will show a Find window similar to the PTS one. But, it will have a Search Scope radio option:
We could possibly add other scopes. The window will be modeless. When it finds a match it displays the window with that entry selected.
The window becomes the parent of the Find window. So finding next entry just shows it in this window.
Closing the window will cause Find window to have main window as parent again.
We could add Search toolbar icon menu on the respective windows. This will show the Find window (if not visible) and set the scope automatically.
Hitting Find will always show first match. Hitting Find Next will iterate through the matches.
This is how I think we should do it. And the data it searches matches the fields that PTS searched. But, we would factor for new info that only MSA has that PTS didn't.
Oh, I need to decide if Congregation includes Speaker, or if it should be separate radio choice.
Is your feature request related to a problem? Please describe. In Public Talks it has a Find window:
The Congregations database in MSA is missing this feature. So it is tricky when you want to find a speaker, and don't know which congregation he is in.
Describe the solution you'd like I suggest that we add a Find menu item here:
This way we should be able to allow the user to cycle through all possible matches (in theory) and would behave in a similar way to PTS.