Page 2 of 2

RadioGroup can be MULTILINE

Posted: Mon Feb 06, 2017 9:18 pm
by Pablo César
Hi Krzysztof and Eduardo.

Sorry, Krzysztof. Nothing missing is the same code I have, but... now I remembered that I had left more this BS_MULTILINE style in the functions: INITRADIOGROUP, INITRADIOBUTTON and SETRADIOSTYLE of the HMG source code. It had done in test character and ended up staying.
 
Screen86.png
Screen86.png (64.5 KiB) Viewed 4597 times
 
But now even removing and in trying to set style with BS_MULTILINE does not work the same way as when the RadioGroup is started. :|

I have no idea how to solve it. All tests I just done, doesn't work as being native of HMG function with plus this BS_MULTILINE.

Here's the executable file to be tested at yours:
Demo1.rar
Executable Demo with MULTINE in the HMG core
(1.24 MiB) Downloaded 229 times
 
It may would be solved if Claudio would accept BS_MULTILINE as more one property in the RadioGroup Style.

Anyway with ITEM_HEIGHT as 28 or handled higher, MULTILINE remains a necessary property and without prejudice.

Could it be done this Claudio ?

RadioGroup can be MULTILINE

Posted: Mon Feb 06, 2017 11:05 pm
by Pablo César
Another strange thing is the SETRADIOSTYLE C function that is never been used in HMG...

RadioGroup can be MULTILINE

Posted: Mon Feb 06, 2017 11:52 pm
by Pablo César
@ Claudio
Resumiendo, quiero preguntarte:
  1. Que es lo que contiene (sé que es valor numérico) pero a que se refiere _HMG_SYSDATA [ 183 ]  ?
    _HMG_ActiveFrameRow based _HMG_FrameLevel, qué seria esto ? Un orden herarquico de los objetos ?
     
  2. Cuando un RadioGroup puede alcanzar a tener un valor diferente a: _HMG_SYSDATA [ 23 ] [x] == -1 ?
     
  3. Ya que el comportamiento es estraño al intentar colocar BS_MULTILINE (no obedece como deberia o al menos no sé si estoy haciendo algo mal) al estilo del RadioGroup.
    Por lo tanto sugiero incluir más un estilo (BS_MULTILINE) fijo en las funcion en C del RadioGroup, puede ser ?
 
Googled
In short, I want to ask you these questions Claudio:
  1. What does it contain (I know it is numerical value) but what does _HMG_SYSDATA [183] refer to ?
     
  2. When a RadioGroup can reach a value other than: _HMG_SYSDATA [23] [x] == -1 ?
     
  3. Since the behavior is strange when trying to put BS_MULTILINE (does not obey as I should or at least I do not know if I'm doing something wrong) in the style of RadioGroup.
    So I suggest including more a style (BS_MULTILINE) fixed in the C function of the RadioGroup, can it be ?
 
@ Krzysztof

I found it fantastic to use STATIC in your source code. In fact I hardly ever use it.
I need to better understand how it works and what is the benefit of using it.

I need to learn and much ... thank you for sharing.

Re: RadioGroup can be MULTILINE

Posted: Tue Feb 07, 2017 9:03 pm
by KDJ
Pablo

About STATIC variables you can read in Clipper documentation: http://www.itlnet.net/programming/progr ... 0ec05.html

The general rule: do not use PUBLIC and PRIVATE variables unless it is necessary.
Instead of PUBLIC and PRIVATE, use STATIC and LOCAL.

STATIC variables most commonly are used in GET/SET functions, example:

Code: Select all

#define GETSET_COLOR   1
#define GETSET_YEAR    2
#define GETSET_VISIBLE 3

FUNCTION Main()

  MsgBox("Color is: " + GetSet(GETSET_COLOR))        //get color
  GetSet(GETSET_COLOR, "Yellow")                     //set color
  MsgBox("Now color is: " + GetSet(GETSET_COLOR))    //get color

  MsgBox("Year is: " + Str(GetSet(GETSET_YEAR)))     //get year
  GetSet(GETSET_YEAR, 2018)                          //set year
  MsgBox("Now year is: " + Str(GetSet(GETSET_YEAR))) //get year

RETURN NIL

FUNCTION GetSet(nParam, xNewValue)
  STATIC cColor   := "Red"
  STATIC nYear    := 2017
  STATIC lVisible := .T.
  LOCAL  xOldValue

  SWITCH nParam
    CASE GETSET_COLOR
      xOldValue := cColor

      IF HB_IsString(xNewValue)
        cColor := xNewValue
      ENDIF
      EXIT

    CASE GETSET_YEAR
      xOldValue := nYear

      IF HB_IsNumeric(xNewValue)
        nYear := xNewValue
      ENDIF
      EXIT

    CASE GETSET_VISIBLE
      xOldValue := lVisible

      IF HB_IsLogical(xNewValue)
        lVisible := xNewValue
      ENDIF
      EXIT
  ENDSWITCH

RETURN xOldValue

RadioGroup can be MULTILINE

Posted: Tue Feb 07, 2017 10:01 pm
by Pablo César
Nice one ! I liked much and I confess that I have not taken the real care of it. Very important and useful.

Thank you Krzysztof for your explanation. I have shared this experience in another forum denoting the STATIC importance.

Have you got any other successful result with RadioGroup (horizontal) using original source of c_radio.c function with my last demo code ?

Re: RadioGroup can be MULTILINE

Posted: Tue Feb 07, 2017 10:27 pm
by KDJ
In my opinion what could be changed/added/improved in RadioGroup:

#1
While initialization of the control, WS_TABSTOP style should be set for the selected item (VALUE). Now is set for the first item.

#2
Add GAP parameter in control definition as alternative to SPACING (SPACING | GAP)
GAP will be the gap between items.

#3
Add HEIGHT parameter.
It can be numeric type for fixed height of items or an array for variable height of items.
If HEIGHT is not specified, the items should be adjusted to the text height.

#4
Change WIDTH parameter.
It can be numeric type for fixed width of items (as now) or an array for variable width of items.

#5
Add MULTILINE parameter (lMultiLine | alMultiLine).

RadioGroup can be MULTILINE

Posted: Wed Feb 08, 2017 12:13 am
by Pablo César
Good ideas for a very versatile RadioGroup.

I will try to do it.

Thank you Krzysztof for your recommendantions. :)

Re: RadioGroup can be MULTILINE

Posted: Wed Feb 08, 2017 11:21 am
by mol
Very smart ideas in my opinion!

Dzięki, Krzysztof

Re: RadioGroup can be MULTILINE

Posted: Thu Feb 09, 2017 8:29 am
by bpd2000
+1