Can I have Vertical Buttons instead of Horizontal in a Message Box

Hi Jeff,

No I don’t want to replace all message boxes.
Only in some very specific cases with my one.

Thanks for the suggestion.
I will take a dive into this and see how it will work.

Regards

Johan de Klerk

Hi,

One more thing I am trying to get working but my code does not seem to work.

I have the size/width of the button with the most text

I am setting my window width as follows:
0{Prop:Width} = MaxButtonWidth# + 6 ! Does not Work
0{Prop:Center} = TRUE
Resizer.Resize
Resizer.Reset

However the windows width does not get set.
My original window width is 250.
Even after I set it it stay at 250.

What am I doing wrong?

Regards

Johan de Klerk

I believe you know why you wrote above lines :grinning:

Hi Mike,

Because I could not get the: 0{Prop:Width} = MaxButtonWidth# + 6
to work I just kept on beating it with a bigger hammer in the hope that at some stage I can get it to work.

So far no luck.

Regards

Johan de Klerk

just added this line and it works:
0{PROP:Width} = 0{PROP:Width} * 2

Hi Mike,

I must have done something wrong.
I copied yours and now it works.

Regards

Johan de Klerk

I currently currently have 13 of these: ?Button1{Prop:Hide} = FALSE

CASE Button#
OF 1
?Button1{Prop:Hide} = FALSE
OF 2
?Button2{Prop:Hide} = FALSE
END

How can I replace the 1,2,3,4,5,6,7,8,9,10,11,12,13 in ?Button1
with the value of Button#

Try this way:
LOOP
CONTROL# = 0{PROP:NextField, CONTROL#}
IF CONTROL# = 0
BREAK
END
IF CONTROL# < 0
CYCLE
END
!Set CURSOR:HAND for each button
IF CONTROL#{PROP:Type}=CREATE:BUTTON THEN
CONTROL#{PROP:CURSOR}=’<0FFH,01H,8AH,7FH>’
END
!Set custom icon for each Combo Box
IF CONTROL#{PROP:Type}=CREATE:COMBO THEN
(CONTROL#{PROP:ButtonFeq}){PROP:ICON}=’~Downarrow32.ICO’
END
END

You can walk through all window controls (see FIRSTFIELD and LASTFIELD in the help), and change control properties if its is of button type (see PROP:Type in the help). Below is the code to center horizontally all buttons.

Routine::Center               ROUTINE
  DATA
feq     SIGNED, AUTO
winW    SIGNED, AUTO
  CODE
  winW = 0{PROP:Width}
  
  LOOP feq = FIRSTFIELD() TO LASTFIELD()
    IF feq{PROP:Type} = CREATE:button
      feq{PROP:Xpos} = (winW - feq{PROP:Width}) / 2
    END
  END

Man, the support, help and advice on this group is great.
I am constantly learning something new on this group.

I am getting there slowly but surely.
I have almost everything working/done that I wanted it to do.

I will post my app here once I am happy with it, maybe it can help others as well.

Thanks for all the help and advice.

Regards

Johan de Klerk

1 Like

Hi Mike,

There is no guarantee that all controls will be from FIRSTFIELD() to LASTFIELD(). There can be gaps and controls created with CREATE can fall out of that range.
I recommend using Prop:NextField, this will loop through all fields on the window. On caveat, it does not guarantee that the loop will process the controls in order.

Routine::Center               ROUTINE
  DATA
feq     SIGNED, AUTO
winW    SIGNED, AUTO
  CODE
  winW = 0{PROP:Width}
  feq     = 0
  LOOP 
    feq = 0{Prop:NextField, feq}
    if feq = 0
      break
    end
    IF feq{PROP:Type} = CREATE:button
      feq{PROP:Xpos} = (winW - feq{PROP:Width}) / 2
    END
  END
3 Likes

Hi Rick,

Thank you very much for the tip.

Regards

Johan de Klerk

Hi,

What command will give me the USE value?
For instance my Buttons USE is: ?Button1

Prop:Text gives me the Text part.

Regards

Johan de Klerk

FIELD() will return the FEQ

I tried but can not figure it out.

If I have this code:
LOOP feq = FIRSTFIELD() TO LASTFIELD()
IF feq{Prop:Type} = Create:button ! Centre everything on the window
Message('Use Value of button = '&This is where i am stuck)
feq{Prop:Xpos} = (winW - feq{Prop:Width}) / 2
END
END

feq is USE value in this case.

Look at the prototype and usage for cla$fieldname on Mark Goldberg’s post. How to Alter the Icon of a COMBO drop control

Hi everyone,

Attached is what I have achieved with the message box.

It works great for me.
I have created it with 28 buttons in my apps so I have enough options available.

Thanks for everyone’s help.

I am sure it can be made more generic and much cleaner code but that is beyond my capability.
If anyone improves on it please post it back here.

TestOwnMessageBox.zip (503.9 KB)

Regards

Johan de Klerk

2 Likes

Got a screenshot of it in action? :selfie:

1 Like