Re: WinClass Help (Al)
- Posted by don cole <doncole at pacbell.net> Nov 19, 2005
- 496 views
Al Getz wrote: > Hi there Don, > > Well, if you look at the define for CreateWindowEx in the WinClass file > "WinCalls.ew" > you'll find that that particular argument ("BUTTON") is the class name, and > that function wraps a sequence to the class name so you can use a > sequence (text) rather than have to look up the actual class name constant. > If you like, you can still use an atom (winapi class name constant) because > that argument is defined as an object, although since there is a class > already defined for Checkboxes you shouldnt have to be bothered. > This means that "BUTTON" will work ok for this. > > Note there are some differences between the 'raw' windows api calls > and the wrappers for WinClass -- when there will be some advantage > to doing it another way it's done 'better' but if you call the function > via "c_func(cc:CreateWindowEx..) (in CFuncs.ew) you'll get the raw > WinAPI function. > > Apparently you uncovered a secondary problem however, and that is that > there is an error in CheckBox.ew and can be corrected as follows: > > At the end of the file the error is: > > global procedure SetCheck(atom ID,atom state) > return IDSendMessage(ID,BM_SETCHECK,state,0) > end procedure > > Obviously this is a procedure trying to return something, so it must > be changed to: > > global procedure SetCheck(atom ID,atom state) > atom void > void=IDSendMessage(ID,BM_SETCHECK,state,0) > end procedure > > in order for Checkboxes to work correctly without an Eu error. > That's one of the few files that got updated without being tested > and i rarely do this, but it happens :( > > After correcting that one file here's the code i used to create > a checkbox: > > > include CheckBox.ew as Checkbox > > constant > Checkbox1=Checkbox:Create( > 0, --StyleEx > 0, --Style > "CB1", --sequence Caption > 0, --object font > 380,20,20,20, --atom xpos,atom ypos,atom width,atom height > MainAppWindow, --atom idParent > 0 ) --object events > Thank you very much Al, I Did get that error in SetCheck() in CheckBox.ew. And you Fix fixed it. Using your above model I was able to create a CheckBox, Which is close enough to the RadioButton I was tring for. > Just a note: the 'Caption' doesnt get used unless there is an error, > so there is something useful to report such as "couldnt create CB1". > I read your next post and that's good I can use that Caption. I'll save me a StaticText. Don Cole A Bug is an un-documented feature. A Feature is a documented Bug.