|
|
I have some funny behavior with a spin control on a dialog. I'm beginning to think I have a bad implementation for this type of control.
The behavior is that the values returned from GetPos() seem to lag what the user is doing. E.g., if the user presses the up arrow twice, then the down arrow twice, the user will see (maybe)3 ups followed by a down. This is what I see in the debugger also.
I am very suspicious of how I'm using the control. When I use the class wizard and select the spin control, there are only two messages I can react to: NM_OUTOFMEMORY and UDN_DELTAPOS. I chose to handle the DELTAPOS message. In that handler I have the following code:
void cTabGeneral::OnDeltaposSpinState(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
int val;
static bool FirstTime = true;
if (FirstTime)
{
FirstTime = false;
m_StateSpinner.SetRange(Initialization, TotalNumberOfStates-1);
}
val = ( 0x0000ffff & m_StateSpinner.GetPos() );
DisplaySimState(val); // display new text based on spin control
UpdateData(false); // cause refresh of display
*pResult = 0;
}
Also in the class wizard, I created a member variable (m_StateSpinner) of type CSpinButtonCtrl.
Any ideas on where I've gone astray? I don't like the DELTAPOS message, perhaps mainly because I don't understand what its doing.
|
|
|
|
|
Perhaps first thing you should do is to set the range of the control in your
OnInitDialog()
instead of here.
Nextto get the correct positition you will need to determine whether the which has is being pressed, the up or the down. This can be found in
pNMUpDown->iDelta
and the current position can be found in
pNMUpDown->iPos
So to determine the next position you can do something like this
current_pos = pNMUpDown->iDelta + pNMUpDown->iPos;
Hope this helps, and hope that i'm correct
|
|
|
|
|
I'm using WTL 7.0 and I can't find a way of changing the default timeout for the treeviews custom tooltips that are displayed with the TVS_INFOTIP style.
As soon as you hover over the treeview, the tip is displayed.
I want it to come up after about 1/2 a second.
I've got a treeview created like this:
HWND tree = m_tree.Create(m_hWnd,NULL,NULL,
TVS_SHOWSELALWAYS | TVS_HASBUTTONS |
TVS_LINESATROOT | TVS_HASLINES |
TVS_DISABLEDRAGDROP | TVS_INFOTIP |
WS_CHILD | WS_VISIBLE);
and I have a MESSAGE_MAP that contains this:
NOTIFY_CODE_HANDLER(TVN_GETINFOTIP, OnTVNGetInfoTip);
and I have a function which sets the tool tip text, and the tooltip is displayed correctly when I hover over it.
If, after i create the treeview, i were to do this:
CToolTipCtrl pToolTip = m_tree.GetToolTips();
if (pToolTip)
{
pToolTip.Activate(TRUE);
int n;
n = pToolTip.GetDelayTime(TTDT_INITIAL);
n = pToolTip.GetDelayTime(TTDT_AUTOPOP);
n = pToolTip.GetDelayTime(TTDT_RESHOW);
}
n would be set to the following values:
500
4000
80
Which is right, but these values are not used.
Why not ? and how do i make them do what i want.
Note, that if I don't specify TVS_INFOTIP the tooltips are only displayed when the treeview item under the mouse pointer is not fully displayed, and even then my custom tool tip is NOT displayed (e.g. it doesn't call my "OnTVNGetInfoTip()" via the message map.)
|
|
|
|
|
Hi all.
Something strange is going on with my app. It runs fine, until I try to step through code. As soon as I step over or into an API call, it throws up an Unhandled Exception: 0xC0000005: Access Violation.
I guess this means I'm linking into the wrong libraries?
This is wierd cos it hasn't done anything like this in about 9 months, then all of a sudden - bang! I must have inadvertently changed something, but I can't figure out what.
Any ideas?
TIA,
Pete
|
|
|
|
|
I doubt that anybody can help you unless you provide some more information.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi
I found code on codeproject "Implementing an autocompleting Combobox By Chris Maunder".I wanted to have droplist when users write text in combobox. Iam working in Win2K Prof and here is OK but in Win98 is some problem when you write e.g. "App". When you push letter "A" droplist is showed but wenn you write 2. letter ... and after you click outside its seleted first item which has first letter "A" and has smallest index. If you hide droplist each oven press and show each odd press its OK but is absurdity to do this in release version
I think that when is droplist visibled and you call SelectString etc. is not applied..
void CMyComboBox::OnEditupdate()
{
if (!m_bAutoComplete)
return;
CString str;
GetWindowText(str);
int nLength = str.GetLength();
ShowDropDown();
DWORD dwCurSel = GetEditSel();
WORD dStart = LOWORD(dwCurSel);
WORD dEnd = HIWORD(dwCurSel);
int found = SelectString(-1, str);
if (found == CB_ERR)
{
SetWindowText(m_strPrev); // select last valid string
SetEditSel(nLength, -1);
return;
}
else {
m_strPrev = str;
GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CBN_SELCHANGE), (LPARAM)m_hWnd);
}
if (dEnd < nLength && dwCurSel != CB_ERR)
SetEditSel(dStart, dEnd);
else
SetEditSel(nLength, -1);
}
I dont how to catch it
Could you help me ?
Thanx
LiborB.
|
|
|
|
|
Hi,
I using a OCX component ( AVPHone.ocx )
It have a function .. that function returns a VARIANT variable ..
this variable contains a pointer to a memory adress .. byte *
I need to send this memory data using a socket ... How can I know
the size of this memory area if I have only the pointer ..
The component doesn´t have any function that returns the size ..
obs: it is strange but If I use the same component ocx in VB ... it return a Object
do you have any suggestions ?
|
|
|
|
|
If you know what kind of data type that pointer points to, you can use sizeof() to obtain the memory allocated size.
|
|
|
|
|
RaphaelBr wrote:
VARIANT variable ..
this variable contains a pointer to a memory adress .. byte *
What is the VARIANT's VT type. Is it VT_VOID? Most of the times people use VT_ARRAY | VT_UI1. In that case you can use SafeArray APIs to find out the length.
|
|
|
|
|
My application needs to run in a specific screen resolution, instead of making the user change the setting manually, I would like to do it programmatically. Is it possible to accomplish this with the Windows API?
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Use ChangeDisplaySettings or ChangeDisplaySettingsEx.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
It is possible, but I would be really, really annoyed if an application changed my screen resolution. What effect would it have on all the other apps I'm running? Also, Win 9X/ME require a system reboot to change resolution. That could be annoying as well.
|
|
|
|
|
Someone please delete Raffi's post.
And Raffi, please change your signature (if it is indeed your sig - if not, my apologies).
Jon Sagara
"I am in a race. I'm weening!"
|
|
|
|
|
It wont let me delete it or modify it cause it says my pw is invalid. I didn't mean to do it. Im really really sorry.
-Raffi, no longer uses an html sig.
|
|
|
|
|
-Raffi, no longer uses an html sig.
Sniff. That's so sad.
|
|
|
|
|
Man, what have done with your formatting? The whole window appears like gone mad!
As for your question, angle brackets are reserved for standard libraries (be it standard as native to C/C++ or standard relative to a vendor, like <windows.h> .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I know this is a C++ forum.
I don't see a javascript forum here at codeproject, and I like this site alot. I looked through the javascript articles, but don't see an answer to this, probabl simple, question.
If someone would be willing and able to answer this question, I would appreciate it.
I would like to be able to change the "value" of a form field based on the contents of a variable. Like, for example, an element of an array.
Example form element:
I don't know how to have "value" be set to the contents of a variable. What I have there doesn't work.
thanks for any help you can provide.
craigk
dakotaknut@yahoo.com
|
|
|
|
|
Try this:
<form name="form1">
<input type="textbox" readonly name="phototitle01"
Value=""
STYLE="background-color:#ecd4b4;">
</form>
<script language="javascript">
document.form1.phototitle01.value=myVarArray[0]
</script>
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks much!
I kind of stumbled into this, (in a way), a little bit ago. I ended up deciding to try using the
|
|
|
|
|
I'm kinda surprised you didn't find anything about this on the net. There are tons of sites devoted to JavaScript with myriads of snippets and tutorials. So many of them, programming in JavaScript is usually just a matter of copying and pasting.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yeah, maybe I didn't look hard enough for this specific answer.
It seemed to me that most examples were directed at more interesting "problems".
I did though run across a cooler solution to what I wanted to do. I'm an "old guy" software developer, but I'm not a javascript, or an HTML guy yet. I had "picked" a solution to what I wanted to do, because it was the only way I could think to do it.
But the div solution appears to be prettier. So I'm heading down that trail now. Although, it is a little annoying that Netscape has to do some of this stuff seemingly so clunky. Especially Netscape 4.
Y'all on codeproject though are cool because you take the time to answer simple stuff like this. THANKS MUCH!
craigk
craigk
|
|
|
|
|
In IE, when you got to Tools | Internet Options, then select the Advanced tab, you have a control with displays a list of item with children, along with checkboxes and radios. How do you do that? Is that a control that comes with IE?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Check PJ Naughter's CTreeOptionsCtrl.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|