UpDown Control with real numbers increment or decrement

Started by dancho, June 02, 2006, 04:34:53 PM

Previous topic - Next topic

dancho

.elseif eax==WM_NOTIFY
        mov edx,lParam
        mov eax,[edx].NMHDR.hwndFrom
        .if eax==hUpd9;handle of UpDown control
         .if [edx].NMHDR.code==UDN_DELTAPOS
             mov edx,lParam
             mov eax,[edx].NM_UPDOWN.iDelta
             .if eax==1
                invoke SendDlgItemMessage,hWin,IDC_EDT12,WM_GETTEXT,sizeof ipos_buff_9,addr ipos_buff_9
                invoke FpuAtoFL,addr ipos_buff_9,addr ipos_real9,DEST_MEM ; decimal string to real
                invoke FpuAdd,addr ipos_real9,addr icdc,addr ipos_sum9,SRC1_REAL or SRC2_REAL or DEST_MEM ; adding 0.250
                invoke FpuFLtoA,addr ipos_sum9,2,addr outpos_buff_9,SRC1_REAL or SRC2_DIMM ; writing back to decimal string
                .elseif eax==-1
                  invoke SendDlgItemMessage,hWin,IDC_EDT12,WM_GETTEXT,sizeof ipos_buff_9,addr ipos_buff_9
                    invoke FpuAtoFL,addr ipos_buff_9,addr ipos_real9,DEST_MEM
                    invoke FpuSub,addr ipos_real9,addr icdc,addr ipos_sum9,SRC1_REAL or SRC2_REAL or DEST_MEM
                    invoke FpuFLtoA,addr ipos_sum9,2,addr outpos_buff_9,SRC1_REAL or SRC2_DIMM
              .endif
             return TRUE
         .endif
        .endif

.elseif eax==WM_VSCROLL
invoke SendDlgItemMessage,hWin,IDC_EDT12,WM_SETTEXT,0,addr outpos_buff_9


like I said program is working , values in spinner control are going up or down by 0.250 , but  :dazzled:
the problem is when I add second spin control(same code like this) and new line for that control in WM_VSCROLL , like this

.elseif eax==WM_VSCROLL

invoke SendDlgItemMessage,hWin,IDC_EDT12,WM_SETTEXT,0,addr outpos_buff_9
invoke SendDlgItemMessage,hWin,IDC_EDT13,WM_SETTEXT,0,addr outpos_buff_10

when user click up or down arrow on one control ,
other control is automaticly empty...
I know thats because other control buff is empty ( there wasnt any clicking yet),
my question is how I can control that...


btw both controls getting their default values like this:
.if eax==WM_INITDIALOG
invoke SendDlgItemMessage,hWin,IDC_EDT12,WM_SETTEXT,0,addr df_spin12
invoke SendDlgItemMessage,hWin,IDC_EDT13,WM_SETTEXT,0,addr df_spin13

thx



raymond

Quotelike I said program is working , values in spinner control are going up or down by 0.250

Glad to hear that. (Also nice to see some use for the Fpulib.)

Quotemy question is how I can control that...

That is quasi-impossible to answer without seeing most of the code you used. Zip it up, including the resource file, and I will have a look at it.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

dancho

I find FpuLib very very helpful...

:U

this is download link for small program that shows exactly what is the problem,
btw I put all RadAsm project in it ( 8kb )...

Your Download-Link: http://rapidshare.de/files/22851628/SpinControl.7z.html

raymond

Please, what must I use to access the information inside that .7z file????? :dazzled: :dazzled: :dazzled:

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Tedd

No snowflake in an avalanche feels responsible.

dancho

I just notice some strange behavior of spin control in this program,
when you click up or down arrow ( I mean no clicking but one click and keep it press ) values want go
for their max or min but only for 3.75 points ( + or - , depends if you click up or down ) and it will
stop...
I dont see any limitations in program that can cause that ...!

@raymond
sry...
I'm using 7-Zip for a long time and I thought that newest versions of WinRar and WinZip
can open *.7z file...
If you have trouble with it I will post link with *.rar or *.zip file...
thx

raymond

Tedd:
Thanks for the link.

dancho:
Quotewhen user click up or down arrow on one control ,
other control is automaticly empty...
I know thats because other control buff is empty ( there wasnt any clicking yet),
my question is how I can control that...

Initialize your outpos_buff buffers with the default values when processing the WM_INITDIALOG message.

QuoteI just notice some strange behavior of spin control in this program,
when you click up or down arrow ( I mean no clicking but one click and keep it press ) values want go
for their max or min but only for 3.75 points ( + or - , depends if you click up or down ) and it will
stop...
I dont see any limitations in program that can cause that ...!

Instead of checking if EAX=1 or -1, try checking if EAX is positive or negative instead.

test eax,eax
.if !SIGN?     ;if positive
   ....
.else          ;if negative
   ....
.endif


I would also suggest you increase the size of the edit boxes so that the entire number can be displayed.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

dancho