` Printed Icetips Article

Icetips Article



Par2: Changing default button at runtime
1999-04-01 -- Lee White
 
Try ThisWindow.TakeSelected, 2800 using something like:

IF FIELD() <> ?Browse:3
  ?Change:4{PROP:Default} = FALSE
  ?Ok{PROP:Default} = TRUE
ELSE
  ?Ok{PROP:Default} = FALSE
  ?Change:4{PROP:Default} = TRUE
END

From my experience you ALWAYS need to turn off the default attribute on one
control before setting on another.

RJ Miller adds:
For anyone interested have found out how things work.

The final code to accomplish this is as follows and was placed in 
ThisWindow.TakeSelected/2800.

    Case field()
      Of ?Browse:3
          Loc:DefaultButton{prop:default} = FALSE
          Loc:DefaultButton = ?Change:4
          ?Change:4{prop:default} = TRUE
      Of ?Ok
      OrOf ?Cancel
      OrOf ?Insert:4
      OrOf ?Change:4
      OrOf ?Delete:4
      Else
          Loc:DefaultButton{prop:default} = FALSE
          Loc:DefaultButton = ?Ok
          ?Ok{prop:default} = TRUE
    End

It seems that you MUST reset the default button PRIOR to setting a new
default button or the setting will be ignored.  Also individual buttons are
managed SOMEWHERE.  Not sure where but attempting to manage them does not
work... best just ignored and let Clarion manage them.

It would seem that since the default button is a window based setting it
would be a property of the window object... just a thought thrown out
without much insight into why things are the way they are.  Also would be
good to have a default button based on the tab structure as generally the
user's focus has changed when entering the sheet/tab structure.  But anyway
I learned a lot fighting this small battle.



Printed November 21, 2024, 11:15 am
This article has been viewed/printed 35208 times.