News:

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

Moving child windows, revisited

Started by NoCforMe, October 16, 2011, 10:11:00 AM

Previous topic - Next topic

dedndave

a while back, i wrote a little program to find out which style bits the MessageBox function uses for different controls...

;     button style = 50030001

WS_CHILD                             equ 40000000h
WS_VISIBLE                           equ 10000000h
WS_GROUP                             equ 00020000h ;control
WS_TABSTOP                           equ 00010000h ;control
BS_DEFPUSHBUTTON                     equ 00000001h

;static icon style = 50020003

WS_CHILD                             equ 40000000h
WS_VISIBLE                           equ 10000000h
WS_GROUP                             equ 00020000h ;control
SS_RIGHT                             equ 00000002h
SS_CENTER                            equ 00000001h

;static text style = 50022080

WS_CHILD                             equ 40000000h
WS_VISIBLE                           equ 10000000h
WS_GROUP                             equ 00020000h ;control
SS_EDITCONTROL                       equ 00002000h
SS_NOPREFIX                          equ 00000080h


the WS_GROUP and WS_TABSTOP bits are used to control how the tab key moves around

jj2007

The border was just to demonstrate that the window is there. To see the text, make a little change around line 200:
ChildClassName DB "OneShouldNotUseReservedWords", 0
BtnClassName DB "button", 0
EditClassName DB "edit", 0
StaticClassName DB "static", 0

NoCforMe

jj, thank you for delving so deeply into my n00b code. That fixed it.

The problem wasn't using "reserved words" so much as mis-using them. I don't know why I made the class of the child window "static", but that was boogering up the whole class thing. Class warfare, dontcha know. Static text works just fine.

See, I told you it was just a stupid mistake on my part!

One more question, if you don't mind: What's the easiest way to change the font of  the static text? Do I need to change it at the class ("static") level, or on a per-control basis, or what? Don't like that ugly blocky font.

dedndave

that makes no sense   :(

if he used a class name string of...
StaticClassName  DB "static"
StaticText DB "Some text", 0


i.e., the class name is actually
StaticClassName  DB "staticSome text", 0

then it seems like CreateWindowEx should have returned an error telling you the class name is not registered

jj2007

@Dave: it's ChildClassName :thumbu

MOV ControlHandle, EAX
; INVOKE UpdateWindow, EAX not needed
invoke SendMessage, STHandle, WM_SETTEXT, 0, chr$("Hey, why not another text?")
invoke SendMessage, STHandle, WM_SETFONT, rv(GetStockObject, ANSI_VAR_FONT), 0


rv and chr$ are Masm32 macros that you'll get if you replace the boring stuff between
; UNSOLVED PROBLEMS:
and
; Defines, macros, prototypes, etc.
with
include \masm32\include\masm32rt.inc
or, much better,
include \masm32\MasmBasic\MasmBasic.inc

NoCforMe

Thank you, jj, you're what they used to call a gentleman and a scholar.

Keep bugging me. One day I might even change my old ways and use that cover-all include file.

dedndave


jj2007

Quote from: NoCforMe on October 19, 2011, 08:08:32 PM
Thank you, jj, you're what they used to call a gentleman and a scholar.

That is very kind but incorrect. Dave is a gentleman, and MichaelW, Donkey, Vortex, Tedd (to name a few) are scholars. I am just a cantankerous old hobby programmer who tries to give Hutch a helping hand :thumbu :toothy

oex

Quote from: jj2007 on October 19, 2011, 08:19:55 PM
I am just a cantankerous old hobby programmer who tries to give Hutch a helping hand :thumbu :toothy

Yes.... jj is the handy man
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv