News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Ghost edit controls

Started by raymond, February 06, 2013, 12:19:00 PM

Previous topic - Next topic

raymond

I'm in the process of writing a program where I need to place edit controls in various cells of a grid in the main window. Some of the cells are gray, others are white. I use the CreateWindow function for creating and placing the controls.

Later, I need to redraw the grid and need to place the controls generally in different cells of the grid. I use the DestroyWindow function to get rid of all the existing controls before starting to redraw the grid and add the required controls.

However, the white footprint of any previous edit controls (which have been destroyed) does not get covered by any gray filling using the FillRect function.

Has anyone ever experienced such a situation or know any remedy?
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

qWord

Do you invalidate the control's regions after deleting them? Also, did you draw that rectangles in context to WM_PAINT?
MREAL macros - when you need floating point arithmetic while assembling!

dedndave

hi Ray
maybe you could make a small example ?

raymond

QuoteDo you invalidate the control's regions after deleting them?

No. I just tried to paint over them. They are supposed to have been DESTROYED.

QuoteAlso, did you draw that rectangles in context to WM_PAINT?

No. I've got several dozens of those control to create and position.

However, I've just found a solution. :eusa_clap: :eusa_clap: :eusa_clap:
I was looking for some function which would modify their size to 0x0 and didn't find one. But using the MoveWindow function to move them to a dead area of the main window before destroying them works like a charm.

It's amazing how often we can't see solutions until we start asking for help. I must have spent numerous hours last night trying to find some way out!!! A little more patience on my part may have avoided this silly post. :eusa_boohoo:
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

dedndave

yes - sizing them to 0,0 does the trick - lol
if you do that, the position doesn't usually matter
i sometimes set the pos to 0,0, as well as the size

you may be able to use ShowWindow with SW_HIDE in a similar manner

maybe you don't have to destroy them - make them "reusable"

raymond

Quotemaybe you don't have to destroy them - make them "reusable"

That may be easy to do when you have only a few of them. It could be a nightmare trying to manage some 5 dozens of those windows. :dazzled:
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

hutch--

Ray,

In the distant past I have seen the logic where the grid is done with an array of static controls and the editing is done with a single edit control superimposed over the static control at a given location. On completion entering the data the content is copied to the memory of the static control at that location.

raymond

I guess you all deserve to have a look at what I was working on. The attached zip is a folder containing the .exe, an .ini file and two "data" files. If you want to know what its purpose might be, visit http://krazydad.com/.

BTW, I tried e-mailing this zip file to the author of that site and gmail simply refused to deliver it. Part of the returning message was: ::) ::)

hostgmail-smtp-in.l.google.com[74.125.25.27] said: 552-5.7.0 Our systemdetected an illegal attachment on your message. Please 552-5.7.0 visit http://support.google.com/mail/bin/answer.py?answer=6590 to 552 5.7.0review our attachment guidelines.

:icon13: :eusa_boohoo: :eusa_boohoo: :icon13: :dazzled: :dazzled:
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

jj2007

Quote from: raymond on February 06, 2013, 04:50:36 PMBTW, I tried e-mailing this zip file to the author of that site and gmail simply refused to deliver it

Ray,
After downloading the message Firefox said "Scanning for viruses...". That was five minutes ago, it's still scanning, but MSE had no problems to let me open it, and it looks really nice :t

MichaelW

I downloaded it with IE8 no problem, and MSE found no problems, but if I drag the client area of the window off screen and then back, the contents of the edit controls on the right side are erased, and the GO and CHECK buttons don't redraw correctly.
Well Microsoft, here's another nice mess you've gotten us into.

qWord

raymond,
to avoid that the controls are paint over (see MichaelW's post), use the WS_CLIPCHILDREN style for the main window.  If you destroy a window, you should invalidate the region that was covered by it. The parent window then receives a WM_PAINT message to redraw that region:

1. GetWindowRect,hEdit,addr rect -> ScreenToClient,hParent,addr rect.left / rect.rigth
2. DestroyWindow,hEdit
3. InvalidateRect,hParent,addr rect,...

Alternatively, you can invalid the whole client are after destroying the controls by using InvalidateRect(hParent,0,...).
MREAL macros - when you need floating point arithmetic while assembling!

Tedd

I'd go the other way and suggest drawing the grid and values yourself, and then dynamically create a single edit control on top of the selected cell for editing. The result could be much nicer and more flexible, though obviously a little more work too.
Potato2

hfheatherfox07

Quote from: raymond on February 06, 2013, 04:50:36 PM

BTW, I tried e-mailing this zip file to the author of that site and gmail simply refused to deliver it. Part of the returning message was: ::) ::)

hostgmail-smtp-in.l.google.com[74.125.25.27] said: 552-5.7.0 Our systemdetected an illegal attachment on your message. Please 552-5.7.0 visit http://support.google.com/mail/bin/answer.py?answer=6590 to 552 5.7.0review our attachment guidelines.

:icon13: :eusa_boohoo: :eusa_boohoo: :icon13: :dazzled: :dazzled:

Hello,
G mail does not allow sending any exe' dll's period !
Nothing to do with your particular app
I used to use " copy b " in the command prompt to copy the archive into a pic and send it that way,
The person reciving it can extract it with winrar or any archive extractor !
Not sure if they wised up to that trick ... :(
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

raymond

Yes. I did see afterwards their list of no-no's to be attached to e-mails, whether zipped or not. One option is to rename it with any acceptable extension (such as .txt, or .abc, etc.) before zipping it and let the receiver know which file to rename with the proper extension.
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

dedndave

i use hotmail for that   :P

if you really wanna obfuscate things
RAR or 7Z it, then stick that inside a zip
you can even password protect these compressed files if you like