1. WinClass Help (Al)

From Radio.ew

global function Create(
  atom StyleEx,
  atom Style,
  sequence Caption,
  object font,
  atom xpos,atom ypos,atom width,atom height,
  atom idParent,
  object events)

atom ID,hButton,hParent sequence Info,hFont

ID=Track:GetNextID() hParent=GetHandle(idParent)

if and_bits(Style,WS_TABSTOP) then Track:Event(onTab,ID,1) end if hButton= win:CreateWindowEx( StyleEx, extended window style "BUTTON", window class nameyou show text but it should be an atom Caption, window caption LLF:OR({Style,BS_PUSHBUTTON,BS_RADIOBUTTON,WS_VISIBLE,WS_CHILD}), window style xpos, initial x position ypos, initial y position width, initial width height, initial height hParent, parent window handle ID, control id instance(), program instance handle NULL creation parameters )

Track:Event(onCLASS,ID,Radio) Track:SetHandle(ID,hButton) Assert:AboveZero(hButton,"Couldnt create Checkbox: "&Caption) Track:SetParentID(ID,idParent) Track:AddEvents(events,ID)

CCID=GetNextCID() Track:SetWinClassCtl(ID,CCID) hFont=Font:GetHOF(font) Info=DefaultClassCtl Info[HFONT]=hFont[1] Info[FONTSPEC]=hFont[3] win:SetFont(ID,hFont[1])

ClassCtl[CCID]=Info

this=ID return ID end function

myline

global constant Radio3=RB: Create( Radio,?,"Random After", CWindow, 25, 188, 120, 20, 0,0)

I've tried everything but I get type check failure or Couldn't create checkbox.

I'm at my wits end please help.

Don Cole A Bug is an un-documented feature. A Feature is a documented Bug. }}}

new topic     » topic index » view message » categorize

2. Re: WinClass Help (Al)

don cole wrote:
> 
> From Radio.ew
> 
> }}}
<eucode>
> global function Create(
>   atom StyleEx,
>   atom Style,
>   sequence Caption,
>   object font,
>   atom xpos,atom ypos,atom width,atom height,
>   atom idParent,
>   object events)
> 
>   atom ID,hButton,hParent
>   sequence Info,hFont
> 
>   ID=Track:GetNextID()
>   hParent=GetHandle(idParent)
> 
>   if and_bits(Style,WS_TABSTOP) then
>     Track:Event(onTab,ID,1)
>   end if
>   hButton=
>       win:CreateWindowEx(
>       StyleEx,   -- extended window style
>       "BUTTON",  -- window class name--you show text but it should be an atom
>       Caption,   -- window caption
>       LLF:OR({Style,BS_PUSHBUTTON,BS_RADIOBUTTON,WS_VISIBLE,WS_CHILD}),  --
>       window style
>       xpos,     -- initial x position
>       ypos,     -- initial y position
>       width,    -- initial width
>       height,   -- initial height
>       hParent,  -- parent window handle
>       ID,       -- control id
>       instance(),   -- program instance handle
>       NULL          -- creation parameters
>      )
> 
>   Track:Event(onCLASS,ID,Radio)
>   Track:SetHandle(ID,hButton)
>   Assert:AboveZero(hButton,"Couldnt create Checkbox: "&Caption)
>   Track:SetParentID(ID,idParent)
>   Track:AddEvents(events,ID)
> 
>   CCID=GetNextCID()
>   Track:SetWinClassCtl(ID,CCID)
>   hFont=Font:GetHOF(font)
>   Info=DefaultClassCtl
>   Info[HFONT]=hFont[1]
>   Info[FONTSPEC]=hFont[3]
>   win:SetFont(ID,hFont[1])
> 
>   ClassCtl[CCID]=Info
> 
> 
>   this=ID
>   return ID
> end function
> 
> --myline
> 
> global constant Radio3=RB: Create( Radio,?,"Random After", CWindow,     25,
> 188, 120, 20, 0,0)
> 
> I've tried everything but I get type check failure or Couldn't create
> checkbox.
> 
> I'm at my wits end please help.
> 
> Don Cole
>  A Bug is an un-documented feature.
> A Feature is a documented Bug.

Hi there Don,


Did you by any chance try using "Checkbox.ew" instead?
Geeze, im terribly sorry for this...i think i forgot to put the file
name in the "Filelist.txt" file, which lists all the 'class objects'.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

3. Re: WinClass Help (Al)

> 
> 
> Did you by any chance try using "Checkbox.ew" instead?
> Geeze, im terribly sorry for this...i think i forgot to put the file
> name in the "Filelist.txt" file, which lists all the 'class objects'.
> 
> 
> Take care,
> Al

> 
Hi Al thanks for the quick response,

I,m looking at Cherckbox.ew and it looks pretty much the same as Radio.ew.

I think I will have the same problem.

I guess what I want to ask is cou;ld you give me some examples of exceptable 

2nd elements [style]--window class name

      StyleEx,   -- extended window style
      "BUTTON",  -- window class name---HERE what do I put here?
                 -- "BUTTON" does not work because it's supposed tp be an atom
      Caption,   -- window caption

Don Cole
 A Bug is an un-documented feature.
A Feature is a documented Bug.

new topic     » goto parent     » topic index » view message » categorize

4. Re: WinClass Help (Al)

don cole wrote:
> 
> 
> > Did you by any chance try using "Checkbox.ew" instead?
> > Geeze, im terribly sorry for this...i think i forgot to put the file
> > name in the "Filelist.txt" file, which lists all the 'class objects'.
> > 
> > 
> > Take care,
> > Al
> 
> > 
> Hi Al thanks for the quick response,
> 
> I,m looking at Cherckbox.ew and it looks pretty much the same as Radio.ew.
> 
> I think I will have the same problem.
> 
> I guess what I want to ask is cou;ld you give me some examples of exceptable
> 
> 
> 2nd elements [style]--window class name
> 
>       StyleEx,   -- extended window style
>       "BUTTON",  -- window class name---HERE what do I put here?
>                  -- "BUTTON" does not work because it's supposed tp be an atom
>       Caption,   -- window caption
> 
> Don Cole
>  A Bug is an un-documented feature.
> A Feature is a documented Bug.

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

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".



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

5. Re: WinClass Help (Al)

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.

new topic     » goto parent     » topic index » view message » categorize

6. Re: WinClass Help (Al)

don cole wrote:
> 
> 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.

Hi Don,


Oh, so you're saying that you wanted to create a radio button,
not a checkbox?


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu