1. Don: Radio Button slight correction

Hi Don,

I've found a correction for the Radio buttons in WinClass which make
them work better.

In "Radio.ew" the window style 'line' should be this:

  LLF:OR({Style,BS_AUTORADIOBUTTON,WS_VISIBLE,WS_CHILD}),-- window style

This then allows creation of radio buttons in groups, using
WS_GROUP style at the beginning of each group of radio buttons for
a given window.

Here's an example of four radio buttons where the first two form the
first group and the second two form the second group (ie the first two
work together and the second two work together)...

CODE:

constant
  Radio1=Radio:Create(
  0, --StyleEx,
  WS_GROUP, --Style,
  "RB1", --sequence Caption,
  0, --object font,
  350,150,50,20,--atom xpos,atom ypos,atom width,atom height,
  MainAppWindow,--atom idParent,
  0 )--object events)

constant
  Radio2=Radio:Create(
  0, --StyleEx,
  0, --Style,
  "RB2", --sequence Caption,
  0, --object font,
  350,200,50,20,--atom xpos,atom ypos,atom width,atom height,
  MainAppWindow,--atom idParent,
  0 )--object events)

constant
  Radio3=Radio:Create(
  0, --StyleEx,
  WS_GROUP, --Style,
  "RB3", --sequence Caption,
  0, --object font,
  350,240,50,20,--atom xpos,atom ypos,atom width,atom height,
  MainAppWindow,--atom idParent,
  0 )--object events)

constant
  Radio4=Radio:Create(
  0, --StyleEx,
  0, --Style,
  "RB4", --sequence Caption,
  0, --object font,
  350,270,50,20,--atom xpos,atom ypos,atom width,atom height,
  MainAppWindow,--atom idParent,
  0 )--object events)


Note Radio's 1 and 3 get the WS_GROUP style while the 2 and 4 get zero.
Also note that the order of creation can't be swapped because that's
part of how Windows determines which radios are in which groups.



Take care,
Al

And, good luck with your Euphoria programming!

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

new topic     » topic index » view message » categorize

2. Re: Don: Radio Button slight correction

Hello Al ,
I really haven't really read you Radio button post yet (I will) because 
CheckBox is good enough for my purposes right now.

However I do have another question.
I read somewhere that it best to use integers rather than atoms when decimal
points are not needed because integer program execution runs faster.
I noticed in your winClass that you declare every control as an atom.
Why?
\
Don Cole
 A Bug is an un-documented feature.
A Feature is a documented Bug.

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

3. Re: Don: Radio Button slight correction

don cole wrote:
> 
> I noticed in your winClass that you declare every control as an atom.
> Why?

I think it's because integers can't hold as high a number as is required
sometimes for control IDs.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

4. Re: Don: Radio Button slight correction

don cole wrote:
> 
> Hello Al ,
> I really haven't really read you Radio button post yet (I will) because 
> CheckBox is good enough for my purposes right now.
> 
> However I do have another question.
> I read somewhere that it best to use integers rather than atoms when decimal
> points are not needed because integer program execution runs faster.
> I noticed in your winClass that you declare every control as an atom.
> Why?
> \
> Don Cole
>  A Bug is an un-documented feature.
> A Feature is a documented Bug.

atoms are not just for floating point numbers.

Max integer value: 2,147,483,647

Max atom value: 4,294,967,295

Many times a control ID is larger than 2,147,483,647.

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

5. Re: Don: Radio Button slight correction

Evan Marshall wrote:
> atoms are not just for floating point numbers.
> 
> Max integer value: 2,147,483,647
> 
> Max atom value: 4,294,967,295
> 
> Many times a control ID is larger than 2,147,483,647.

Actually Evan, the largest whole number that Euphoria can use is 2^53 or 
9007199254740992. At least on my AMD system. YMMV.

There's a program in the archive under simple demos - 'Find Largest Eu Whole
Number'
<href>http://www.rapideuphoria.com/largestwhole.ex</href>

Lonny

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

6. Re: Don: Radio Button slight correction

don cole wrote:
> 
> Hello Al ,
> I really haven't really read you Radio button post yet (I will) because 
> CheckBox is good enough for my purposes right now.
> 
> However I do have another question.
> I read somewhere that it best to use integers rather than atoms when decimal
> points are not needed because integer program execution runs faster.
> I noticed in your winClass that you declare every control as an atom.
> Why?
> \
> Don Cole
>  A Bug is an un-documented feature.
> A Feature is a documented Bug.

Hi there Don,

Well, in some apps it's not going to matter because the ratio of
the time spent using an atom is extremely small compared to the
time spent in the code that uses the atom.  This means most apps 
will only use maybe 1/1000 extra time using an atom instead of
an integer.  This amounts to a piece of code taking 1.001 seconds
instead of 1.000 seconds using an integer.  Even with many calls
like this, the total time only increases by the same (1/1000)^th factor.
The exception to that rule of thumb is when the piece of code is
very short and it's in a loop that has to repeat many times.

The main reason i started using atoms for "id's" is because originally
i was going to use the extra storage capacity of the atom (over the
Eu integer) to keep track of something major about the control being
created (such as whether it's a menu, window, or neither) but i dropped
the idea, at least for now, because it requires (at least) one subtraction
extra before the id can be used for anything.

Also, the word "atom" is much faster to type then the word "integer"
when im declaring lots of var's for later use in the program.

I hope you dont mind using an atom instead of an integer, and
you'll find it's faster to type too :)

If at some point "types" get better in Euphoria i'll declare a type
for all the id's such as:

  type ID(integer x)
    return integer(x)
  end type

or something to that effect.



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