CEdit in CDockablePane won't scroll - visual-c++

Im using W7, VS2010: create an MDI app with the visual studio look so it has a COutputWnd inherited from CDockablePane at the bottom. Copying the default I've made a new tab, but inherited from CEdit. The tabs inherited from CListBox work great with the following styles:
const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
But the CEdit with the following does not scroll vertically:
const DWORD dwStyle2 = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL;// | ES_READONLY;
I've tried all combinations of the above styles and read tons of websites, but nothing works :(
Oh - and I do have ShowWindow(SW_SHOW);
Thanks for any help you can offer.

Ta-da! Got it sorted. In COutputWnd::OnCreate I had used this as the parent window:
m_wndVehicle->Create(dwStyle2, rectDummy, this, 3);
It should have been &m_wndTabs:
m_wndVehicle->Create(dwStyle2, rectDummy, &m_wndTabs, 3);
Works a treat now!
Hope it saves someone else 2 hours!

Related

Hide navigation bar in android tablet with API level 19 and above

My question is in android programming in android studio.
I can hide navigation bar but when dropdown spinner , it show again.
Besides that when i tap on EditText , revealing the softkeyboard will cause the navigation bar to reappear.
how can solve it?
(I searched a lot but could not find the correct answer)
call this method in onCreate , onResume and onWindowFocusChanged
private void hideNavigationBar() {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(uiOptions);
}

How to create a frame less Dialog box?

My goal is to create a frame-less dialog box using MFC, which are plain rectangle like shown in the image,i have basic knowledge of MFC applications.and dialog box,can you please provide some links for the same.
Copy this code
//Oninitdialog()
LONG lStyle = GetWindowLong(m_hWnd, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLong(m_hWnd, GWL_STYLE, lStyle);
Second way
Select you Dialog->properties->Border->None

Adding Minimize box to MFC Property Sheet system menu

How could I Add Minimize and Maximize box to the system menu of CMFCPropertySheet.
I have tried modifying the style by
CMFCPropertySheet::ModifyStyle(NULL, WS_SYSMENU);
but nothing happened.
Assuming you have a class derived from CPropertySheet, let's call it MySheet:
// Capture the WM_NCREATE message
BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
ON_WM_NCCREATE()
END_MESSAGE_MAP()
BOOL CMySheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
if (!CPropertySheet::OnNcCreate(lpCreateStruct))
return FALSE;
// Modify the window style
LONG dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | WS_WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
return TRUE;
}
Note that you could do this in the OnInitDialog, but even though the Minimize/Maximize boxes will show, they won't do anything.
doing just this in the "OnInitDialog:" worked for me.
LONG dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | WS_WS_MINIMIZEBOX | WS_MAXIMIZEBOX);

uimenucontroller in uiwebview with custom menu items without MORE menu

In my iPad app, there is a UIWebview that displays text content. When I tap hold and select a text, a menu should popup with 2 custom menu.
say, | MENU1 | MENU2 |
But it seems the COPY menu will also accompany, which I couldn't disable. Is there any possibilities to disable it? I tried around the forum and no solutions worked out.
so itz okay to keep the COPY menu along with the other 2. which should now look like
| Copy | MENU1 | MENU2 |
But unfortunately, I 'm getting it displayed with a MORE menu as follows :
| Copy | More... |
Clicking the More... menu is showing the other 2 menu.
But I need all those 2 items to be displayed in the first attempt itself. either just the 2 menus alone, or atleast along with the copy menu.
| Copy | MENU1 | MENU2 |
OR
| MENU1 | MENU2 |
Get me some solution please.... Trying it out in many ways.. But nothing is working out...
Plz help me out...
Thanks,
Brian
It doesn't appear that there is a way to do this without replacing the UIMenuController. One option is to handle your own UILongPressGestureRecognizer (see How to remove th COPY UIMenuItem in UIMenuController). I've seen proposals where you override canPerformAction, but this does not work. Interestingly, the "copy:" action is never called, though it seems that everything else (cut:,select:,etc.) is.
- (BOOL) canPerformAction:(SEL)action withSender:(id)sender
{
if (action == #selector(defineSelection:))
{
return YES;
}
else if (action == #selector(translateSelection:))
{
return YES;
}
else if (action == #selector(copy:))
{
return NO;
}
return [super canPerformAction:action withSender:sender];
}
`

CSpinButtonCtrl drawing problem with small CEdit control

I'm trying to draw a CSpinButtonCtrl as a buddy of an edit box in Windows 7. When my CEdit window is 12 dialog units high, the spin buttons are scaled really badly and the top border is clipped off.
This looks pretty ugly. How can I get around this, or must I restrict my CEdit controls to be 14 dialog units high?
My controls are declared thusly:
EDITTEXT IDC_LOWER_EDIT,51,20,63,12,ES_MULTILINE | ES_WANTRETURN,WS_EX_RIGHT
CONTROL "",IDC_LOWER_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,104,17,11,12
I've tried resizing using MoveWindow, but that doesn't help. Any ideas?
I found the code for changing the width
CWnd* pWnd = GetDlgItem( IDC_SPIN1 );
CRect rect;
pWnd->GetWindowRect( &rect );
ScreenToClient( &rect );
rect.right += 5 ; // make 5 pixels wider
pWnd->MoveWindow(&rect) ;
Put it in the OnInitDialog().
I think I would go for #2 - are you that pressed for screen space?
Another option is: leave it unattached (remove UDS_ALIGNRIGHT) and place it right next to the edit control.

Resources