Associating a CComboBox with a CRadioButton option on a CTaskDialog - mfc

I have been playing around with the CTaskDialog. At the moment I have this:
The code at the moment is quite simple:
CTaskDialog dlg(_T("Reminder 1.\n\nReminder 2."),
_T("Important! Please read!"),
_T("Reminder"), TDCBF_YES_BUTTON | TDCBF_NO_BUTTON);
dlg.SetMainIcon(TD_INFORMATION_ICON);
dlg.AddRadioButton(12345, _T("Delete reminder"));
dlg.AddRadioButton(12346, _T("Repeat reminder"));
dlg.SetFooterIcon(TD_INFORMATION_ICON);
dlg.SetFooterText(_T("This is footer text"));
dlg.DoModal();
I would like to get the Repeat reminder command line to have a drop-down combo associated with it so that the user can specify the number of weeks before repeating.
I don't know if this is possible with task dialog's.

Related

How to add a separator to Gio::Menu

I'm writing an application using GTK3 and gtkmm. I'm adding a menu button to the header bar. So far, I got items to show up, but I can't add a separator.
Here's where I create the menu:
auto main_menu = Gio::Menu::create();
...and add some items:
main_menu->append("Export to WAV", "app.exportToWav");
main_menu->append("About", "app.about");
And here's what I get:
But I want to add a horizontal line between the two items. There seems to be no obvious way to do this with Gio::Menu, and I want that popover. I tried adding an item with "-" as its content, but that did nothing. Gtk::SeparatorMenuItem exists, but it doesn't seem to be compatible. Is this even doable with this kind of menu?
I've figured it out. Turns out, with Gio::Menu, you don't specify "separators," per se. Instead, you specify sections.
Essentially, what this means is creating multiple menus, and then grouping them all together in a single menu using the append_section(Gio::MenuModel) function.
Here's what I ended up doing:
// Create master menu
auto main_menu = Gio::Menu::create();
// Create menu sections
auto main_menu_section1 = Gio::Menu::create();
auto main_menu_section2 = Gio::Menu::create();
// Add item(s) to first section
main_menu_section1->append("Export to WAV", "app.exportToWav");
// Add item(s) to second section
main_menu_section2->append("About", "app.about");
// Append the new sections to the master menu
main_menu->append_section(main_menu_section1);
main_menu->append_section(main_menu_section2);
Then, each section is separated by a horizontal line:
It's faint, but it's there

MFC MDI Designing user preferences dialog GUI layout functionality

In this instance I am not "stuck" but looking for some 'guidance' on how to perform a GUI layout mechanism that makes sense and easy to construct. I am using a TreeControl that visually "matches" Winamp's options/preferences dialog for all the settings and program options.
TO BE CLEAR: This is not something I've ever attempted and looking for user input to help me get across the finish line.
I have 6 items in the 'tree' (the 'parent') and 5 'subitems'. I have it fully constructed and I can get the data from whatever node is selected (which I'll post below images).
I am using a "do.Modal dialog" and, when I click on the tree node, I want the right side of the dialog to update to the needed controls for that node function. The execution of controls through "show" and "hide" to me seems pretty easy. The issue I have is the how to do the visual "static" controls in the resource editor when each "node paged" controls may or may not sit on top of each other visually during design time. During run time, when each node is selected on the nodes controls will be active but during design time, I may have controls sitting on top of each other and will be a logistical nightmare trying to sort out their positions etc.
How do I resolve that aspect of building it? I think of it as a select: 'node' show: 'option page controls' so I get the logic; I'm just wondering if I should have separate "popup" pages and call those … or deal with the controls directly. Does that makes sense?
I've done some searching on how to do this, but the examples are all over the place and I figured asking here makes the most sense. I'm sure there are multiple ways to do this, I'm just looking for the shortest path and easiest to maintain and possibly expand on the options in the future.
The examples of the dialog and the source code I'm using:
Here is the initialization code:
BOOL CSettingsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
HTREEITEM hParent, hToolbars, hColorScheme, hTabStyles, hPowerUser,
hResetApp;
//HTREEITEM hCompany, hLevel, hLevelNext; // Used in core example, not needed here
hParent = m_TreeCtrl.InsertItem((L"Preferences"), TVI_ROOT);
hToolbars = m_TreeCtrl.InsertItem((L"Toolbars"), hParent);
hColorScheme = m_TreeCtrl.InsertItem((L"Color Scheme"), hParent);
hTabStyles = m_TreeCtrl.InsertItem((L"Tab Styles"), hParent);
hPowerUser = m_TreeCtrl.InsertItem((L"Power User"), hParent);
hResetApp= m_TreeCtrl.InsertItem((L"Reset All Options"), hParent);
m_TreeCtrl.Expand(hParent, TVE_EXPAND);
m_TreeCtrl.SelectItem(hParent);
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Preferences Settings"));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Here is the dialog framework that I'm starting from scratch with just to arrive here:
void CSettingsDlg::OnTvnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
//LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
//SetDlgItemInt(IDC_TXT_TREE1, m_TreeCtrl.GetItemData(pNMTreeView->itemNew.hItem));
//*pResult = 0;
HTREEITEM sel = m_TreeCtrl.GetSelectedItem();
CPoint point;
CString str;
GetCursorPos(&point);
m_TreeCtrl.ScreenToClient(&point);
UINT flags = 0;
HTREEITEM hitItem = m_TreeCtrl.HitTest(point, &flags);
if (hitItem && sel != hitItem)
{
sel = hitItem;
m_TreeCtrl.SelectItem(sel);
str = m_TreeCtrl.GetItemText(sel);
//MessageBox((LPCTSTR)str); // Just to verify.
}
if (str == "Preferences")
{
this->SetWindowText(_T("Preferences Settings"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Preferences Settings"));
}
if (str == "Toolbars")
{
this->SetWindowText(_T("Toolbars Settings"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Toolbars Settings"));
}
if (str == "Color Scheme")
{
this->SetWindowText(_T("Color Scheme"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Color Scheme Settings"));
}
if (str == "Tab Styles")
{
this->SetWindowText(_T("Tab Styles Settings"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Tab Styles Settings"));
}
if (str == "Power User")
{
this->SetWindowText(_T("Power User Settings"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Power User Settings"));
}
if (str == "Reset All Options")
{
this->SetWindowText(_T("Reset All Settings"));
GetDlgItem(IDC_SETTINGS_CAPTION)->SetWindowText(_T("Reset All Settings"));
}
*pResult = 0;
}
So as shown, you can see that I have the ability to change the static caption to the "active" page node that is selected from the tree. I'm looking to solve the best way to handle the GUI elements that will go on the right side....
Some controls for example will be:
Color scheme Node: 5 check boxes for theme changing
Toolbars Node: Radio button for Docked or Floating
Power User Node: Checkbox to disable user warning within program operation
Tab Styles Node: Radio buttons to select flat, 3d, whatever.
and when the user "selects" whatever it writes it to the registry and then I call the function to read the data blah blah blah...
So that is where I'm at. Does anyone have any suggestions on a course of action, so I don't paint myself into a corner?
Although I can't actually speak for how the authors of the "Winamp" software implemented their UI, I would suggest that you consider using a property sheet for your case, where each set of controls can be implemented as separate property pages, each of which will be defined (both in the resource script and in the C++ code) in ways very similar to individual modal dialog boxes.
The 'classic' property sheet has a horizontal row of tabs (normally, at the top of the sheet) to select each page, as shown in the sample below. Indeed, some sources/platforms refer to a property sheet as a "tabbed dialog".
However, the new(ish) CMFCPropertySheet class allows you to replace that tab control with one of several other options, which will show as separate 'panes' (on the left-hand side of the sheet). To use one of these alternative styles, call the SetLook() member function in your constructor override with the CMFCPropertySheet::PropSheetLook_Tree enum value. The example shown in the link is not exactly what you have shown in your question, but the CMFCPropertySheet and CMFCPropertyPage classes allow many, many customizations to their appearance and style.
I have never actually used the PropSheetLook_Tree style, but the image below shows "one I made earlier" with the PropSheetLook_OutlookBar style.

Acumatica - How to change the page opened by the edit button (pencil)

I'm trying to customize a page so that the edit button (the pencil icon one) directs the user to a specific page. In my case, the edit button is linked to a BAccountID field :
By default, it opens the Business Account's page (page CR303000):
I would like it to open a different page that I created that has a similar BAccount view (page AR303001) :
Can this be done ? And how ? I can't seem to find the code behind this logic.
The target graph is declared in the PXPrimaryGraph attribute decorating the DAC.
BAccount DAC is a special case that uses a more complex attribute (CRCacheIndependentPrimaryGraphList) that inherits from PXPrimaryGraph.
[CRCacheIndependentPrimaryGraphList(new Type[]{
typeof(CR.BusinessAccountMaint),
typeof(EP.EmployeeMaint),
typeof(AP.VendorMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(AR.CustomerMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(CR.BusinessAccountMaint)},
new Type[]{
typeof(Select<CR.BAccount, Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
And<Current<BAccount.viewInCrm>, Equal<True>>>>),
typeof(Select<EP.EPEmployee, Where<EP.EPEmployee.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.VendorR, Where<AP.VendorR.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.Vendor, Where<AP.Vendor.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.vendorType>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.customerType>>>),
typeof(Select<CR.BAccount,
Where2<Where<
CR.BAccount.type, Equal<BAccountType.prospectType>,
Or<CR.BAccount.type, Equal<BAccountType.customerType>,
Or<CR.BAccount.type, Equal<BAccountType.vendorType>,
Or<CR.BAccount.type, Equal<BAccountType.combinedType>>>>>,
And<Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
Or<Current<BAccount.bAccountID>, Less<Zero>>>>>>)
},
VerifyRightsBy = new [] { typeof(CR.BusinessAccountMaint) })]
There is no way to easily customize this attribute. To change it would you need to replace the BAccount DAC with another one. The preferred method for your use case is to avoid usage PXPrimaryGraph attribute by using a regular action button.
The action button can be configured to show the pencil icon:
Make PXButton appear as pencil icon
And it can be displayed beside the field using PXLayout Merge property or you can use LinkCommand to redirect:
https://stackoverflow.com/a/60446714/7376238

QCompleter not support up and down key

I use setEditable(true) to make QComboBox editable, when I input cy, then the completer's popup view will be visible and lists all possible results like: cyan, cyana, liecyan ... But when I press Down in keyboard (Qt::Key_Down), the first one cyan will be selected and QComboBox's lineedit's text will be set cyan , meanwhile, completer's popup view updates, only cyan shows. How can I customize it to make it behave like web's select component.
I have solved this question.
1.class MyListView : public QListView
2.MyListView's bool event(...) need to be implemented to concern about type is QEvent::ShortcutOverride
3.based on QEvent::ShortcutOverride, when user press Qt:Key_Up or Qt::Key_Down,setfalg false, when user release key,set flag true
3.QCompleter use setPopup(MyListView's instance) to override default listview
4. set QCompleter's regexp to work when falg is true
5.I got what I want

how to clear textbox text in C++/XAML

im new to C++/XAML, using VS2012, working on my first Windows 8 app.
I have created a textbox1 that take a number, another textbox2 that display the results, another button that once it is clicked, it does the calculation. everything works, my question is when user want to do the calculation again, he will need to click on textbox1, press the backspace to erased the last entered number, how can i make it when textbox1 is clicked and tapped, it will auto clear the previously entered text? or how do i use/make a "CLEAR" button to handle the text clearing for textbox1 and textbox2? Thank You!
With button:
<Button Content="Clear" Name="button1" Click="button1_Click" />
Code behind:
void YourClass::button1_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ args)
{
textBox1->Text = "";
textBox2->Text = "";
}
If you want to use some logic when you tap or something else you should take a look at Tapped event. I'd do it another way: Whenever it got focus(GotFocus event) then select all the text in text box(textBox1->SelectAll(); in GotEvent handler).
You can use
SetWindowText is a function to set the contents of a Edit Control
m_myEditCtrl.SetWindowText(_T("")); // if using MFC
SetWindowText(hWndMyEditCtrl,_T("")); // When using plain Win32 API
myEditCtrl.Text = ""; // When using C++CLI
You can use it from the "On Click" handler also if needed!
I think that could be useful, if you just add in the end of the program that apply to your textboxes a new button with:
textBox2->Text = String::Empty;
textBox1->Text = String::Empty;
OR
…you could add these code lines before start the procedure of the program, just in the beginning of the program. Each time it would start over with blank.
Cheers.