News:

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

Main Menu

Way to autoalign and autoresize (MASM32+Win32API)

Started by demondoido, April 11, 2013, 11:15:38 AM

Previous topic - Next topic

demondoido

I'm working on a simple program to diet control... I'm searching for a way to autoalign and autoresize elements... A theoretical example:
-> The user opens the software
-> Two buttons side by side: |--B1--| |--B2--|
-> The user resizes the software
-> The buttons grow like this: |----B1----| |----B2----|

Other example:

-> The user opens the software
-> A button: (WindowLeftEdge) [space] Button [space] (WindowRightEdge)
-> The user resizes the software
-> The button keeps the center position: (WindowLeftEdge) [space] [space] Button [space] [space] (WindowRightEdge)

My question is: is there anyway to do this using the Windows API (something using constants of style...) or I would have to do this by hand (writing codes to autoalign and autoresize)?

Sorry for my poor english :s (I'm Brazilian)

qWord

There are no container controls in the WinAPI, thus you need to do it by hand.
MREAL macros - when you need floating point arithmetic while assembling!

dedndave

as qWord said - by hand

a while back, Edgar (Donkey) showed me how to use BeginDeferWindowPos, DeferWindowPos, EndDeferWindowPos
it makes for smoother resizing of multiple child windows
it's a little more advanced, but worth the extra effort

dedndave


demondoido

Well, I'm loving Assembly, in this level of software development there aren't frills, but it's a great way to work, you have absolute control...

I need a hint... I know that the main function of DLLs is to facilitate the reuse of codes... But, is it a good idea to create DLLs to implement functions such as autoresize and autoalign, to insert elements (buttons, textboxes...), tables and other operations?

dedndave

a static library is probably better for what you are talking about
an example of one is the masm32 library (\masm32\lib\masm32.lib)
the source files for the functions that are inside that library are in the \masm32\m32lib folder
and, it has an include file that accompanies it, \masm32\include\masm32.inc

DLL's can be used that way, but are typically used a little differently
for example, i might have a set of DLL's for a program
i might load and unload DLL's for different operations in order to reduce memory usage
or, i might use different DLL's, depending on the CPU and/or OS

i don't manage a large collection of functions or large programs, so i do things a little simpler
i just have the source for functions in several files, and grab them as required   :P

demondoido

I understood, and moreover, I read about DLLs and static libs, thanks for the hints Dave!  ;)

MichaelW

Auto-align and auto-resize code would be much easier to implement in a high-level language.
Well Microsoft, here's another nice mess you've gotten us into.