News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

editbox won't update

Started by chipbug, June 17, 2010, 02:14:36 PM

Previous topic - Next topic

chipbug

Hello,

I am new to ASM and have been working on the attached code for days. It works but HumaCarbDose editbox and BGcarb editbox update from the calculation the first time the button is pushed. Then they won't update anymore after that unless I manually edit the text in one of those 2 boxes and press the button, then they will update. Am I missing something?

David

Tedd

Something's not right there :dazzled:

I would guess at some kind of value dependency type thing (a value getting set after the first time, screwing up any following calculations), but I don't see it.

It probably doesn't help that you're not actually checking whether the text boxes contain anything before you use their values. So you're retrieving an empty string and trying to convert that to a floating-point value. And it seems the only way to get it to update is to clear the 'BGcarbMsg' box. Which is a little strange when you're not using that in the calculation.
No snowflake in an avalanche feels responsible.

Gunner

If you are going to use SetDlgItemText with the control ID, why are you getting the handles to the controls on init?  Since you have the handle to the control just use sendmessage... Sometimes SetDlgItemText doesn't work for me so I just use SendMessage...
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

chipbug

OK, I figured out my problem.

I put all these variables in this section and they had no values in them so they were getting assigned small areas in memory and all my variables were overwriting each other:

    .data?
        BGdropMsg   dd ?
        BGupCarbMsg dd ?
        LantusDoseMsg dd ?
        BGMsg       dd ?
        BGcarbMsg   dd ?
        CarbMsg     dd ?
        HumaCarbDoseMsg dd ?
        HumaDoseMsg dd ?
        HumaMealDoseMsg dd ?


Soon as I took them out of that section and put them in this section and gave them values it all ran smoothly:

    .data
        BGdropMsg   dd "46.5",0
        BGupCarbMsg   dd "5.2",0
        LantusDoseMsg   dd "08",0
        BGMsg       dd "08",0
        BGcarbMsg   dd "08",0
        CarbMsg     dd "08",0
        HumaCarbDoseMsg dd "08",0
        HumaDoseMsg dd "08",0
        HumaMealDoseMsg dd "08",0

I'm not exactly certain why but it works.

David

Farabi

.data? is only for uninitialized data, I guess it was generated on the runtime.
.data is for initialized data, I guess it was writted on your application somewhere.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

jj2007

Quote from: chipbug on June 17, 2010, 11:07:23 PM
    .data?
        BGdropMsg   dd ?

This is one dword, that you could use to store a pointer to your string

Quote
    .data
        BGdropMsg   dd "46.5",0

This is the string itself, to be used as offset BGdropMsg