TextAlgin if style is Edit Field Only
TextAlgin if style is Edit Field Only
Hi Timo!
Is it possible set TextAlign for combobox if style is set to Edit Field Only?
I'v tested with SetTextAlgin API, but this doesnt work
Alles gute;
Meelis
Is it possible set TextAlign for combobox if style is set to Edit Field Only?
I'v tested with SetTextAlgin API, but this doesnt work
Alles gute;
Meelis
Re: TextAlgin if style is Edit Field Only
It should work if you call GetWindowLong(GWL_STYLE) for the hWndEdit window, set/remove the ES_CENTER/ES_LEFT/ES_RIGHT styles and call SetWindowLong(GWL_STYLE) to apply the changes.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
Hi again
Dim lngStyle As Long
lngStyle = GetWindowLong(ComboBox1.hWndEdit, GWL_STYLE)
SetWindowLong ComboBox1.hWndEdit, GWL_STYLE, lngStyle Or ES_RIGHT
Does not work. Am i doing something wrong?
BR;
Mex
Dim lngStyle As Long
lngStyle = GetWindowLong(ComboBox1.hWndEdit, GWL_STYLE)
SetWindowLong ComboBox1.hWndEdit, GWL_STYLE, lngStyle Or ES_RIGHT
Does not work. Am i doing something wrong?
BR;
Mex
Re: TextAlgin if style is Edit Field Only
Hmm i think if control is created i cant change style anymore at runtime ?
Re: TextAlgin if style is Edit Field Only
For a normal Edit control the alignment styles may be set and removed after window creation. The combo box uses a normal edit control, so it should work. But it might be that the combo box prevents such changes to the edit control. If this is the case, you are out of luck.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
Ha! I tried it myself. All you need is to force a redraw of the control after you changed the styles.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
Hi
What you mean with "force redraw"?
SendMessage and WM_PAINT?
Mex
What you mean with "force redraw"?
SendMessage and WM_PAINT?
Mex
Re: TextAlgin if style is Edit Field Only
Calling Refresh should be enough.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
Refresh does not help
Is my code correct in first post?
Is my code correct in first post?
Re: TextAlgin if style is Edit Field Only
Assuming that you defined the constants and API functions correctly, it is correct, yes.
When I tried it myself on Tuesday, all I needed was to move another window over the control so that it will redraw. I thought that Refresh would be sufficient. Obviously it is not sufficient. Try this:
If this does not help, try this:
If this also does not help, you could toggle the Visible property twice, but then the control will flicker.
When I tried it myself on Tuesday, all I needed was to move another window over the control so that it will redraw. I thought that Refresh would be sufficient. Obviously it is not sufficient. Try this:
Code: Select all
Call SetWindowPos(ComboBox1.hWndEdit, 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOOWNERZORDER Or SWP_NOZORDER)
Code: Select all
Call SetWindowPos(ComboBox1.hWndEdit, 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED)
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
Nope, nothing works
Re: TextAlgin if style is Edit Field Only
Does your application have Windows skins enabled? I tried on Windows 7 x64 with skins enabled. Maybe it works only if skinning is enabled (Windows loads a newer version of comctl32.dll then).
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: TextAlgin if style is Edit Field Only
OK
It works with Win 7 but not XP
It works with Win 7 but not XP