Module Prmpbtmx.pkg

     1//************************************************************************
     2// Confidential Trade Secret.
     3// Copyright (c) 1997 Data Access Corporation, Miami Florida
     4// as an unpublished work.  All rights reserved.
     5// DataFlex is a registered trademark of Data Access Corporation.
     6//
     7//************************************************************************
     8//************************************************************************
     9//
    10// $File name  : PrmpBtMx.Pkg
    11// $File title : Prompt buttom mixin class
    12// Notice      :
    13// $Author(s)  : John Tuohy
    14//
    15// $Rev History
    16//
    17// 12/19/97 JJT - changed order of setting form_button_Value and form_button so value
    18//                is set first. After button is paged, value does not change (fixed IDE problem)
    19// 8/13/97  JJT - Changed interface for prompt button
    20// ?/??/??  JJT - File Created
    21//************************************************************************
    22
    23// Public mixin interface:
    24//
    25// Get/Set Prompt_Button_Mode to PB_PromptAuto | PB_PromptOn | PB_PromptOff
    26// Get/Set Prompt_Button_Value to String default="..."
    27// Get/Set Prompt_Button_Bitmap to BitmapName
    28Use VDFBase.pkg
    29
    30Enumeration_list
    31    define PB_PromptAuto for 0
    32    define PB_PromptOn   for 1
    33    define PB_PromptOff  for 2
    34End_enumeration_list
    35
    36Class Prompt_Button_Mixin is a Mixin
    37
    38     { MethodType=Event Visibility=Private }
    39     Procedure Define_Prompt_Button_Mixin
    40        { Category=Appearance }
    41        Property String Prompt_Button_Value        '...'
    42        { Visibility=Private }
    43        Property String Prompt_Button_BitMap       ''
    44        { Visibility=Private }
    45        Property Integer m_Prompt_Button_Mode      PB_PromptOff
    46     End_Procedure // Define_Prompt_Button_Mixin
    47
    48     { MethodType=Property }
    49     { EnumList="PB_PromptAuto, PB_PromptOn, PB_PromptOff" }
    50     { InitialValue=PB_PromptOff }
    51     { Category=Appearance }
    52     Procedure Set Prompt_Button_Mode integer iMode
    53        Set m_prompt_Button_mode to iMode
    54        If (iPrompt<>PB_PromptAuto OR Active_State(self)) ;
    55            Send Create_Prompt_Button iMode
    56     End_Procedure
    57
    58     { MethodType=Property }
    59     Function Prompt_Button_Mode Returns integer
    60        Function_Return (m_prompt_button_mode(self))
    61     End_Function
    62
    63     // These two messages are maintained for backwards compatibility. Avoid
    64     // using these. Use Prompt_Button_Mode instead
    65     { MethodType=Property Visibility=Private Obsolete=True }
    66     Procedure Set Auto_Create_Prompt_Button integer bState
    67        Set Prompt_Button_Mode to (if(bstate,PB_PromptAuto,PB_PromptOff))
    68     End_Procedure
    69
    70     { MethodType=Property Visibility=Private Obsolete=True }
    71     Function Auto_Create_Prompt_Button Returns integer
    72        Function_Return (Prompt_Button_Mode(self)=PB_PromptAuto)
    73     End_Function
    74
    75     // Create a prompt Button. This was created so the process of creating
    76     // a prompt button object can be augmented. This will normally get
    77     // called if a prompt object id exists for this object. However, you
    78     // can send this message yourself.
    79     // Avoid using this message - use the property Prompt_Button_Mode
    80     Procedure Create_Prompt_Button Integer CreateMode // 0=auto, 1=make, 2=remove
    81        Integer Obj
    82        Integer Fg tsz sz Create
    83        If Num_Arguments eq 0 Move 1 to Create
    84        Else                  Move CreateMode to Create
    85        If CreateMode eq PB_PromptAuto begin // 0 = if auto-create and prompt object
    86//           If Not (Auto_Create_Prompt_Button(self)) ;
    87//              Procedure_Return
    88           Move (Prompt_Object(self,0) AND ;
    89                 Shadow_State(self,0)=0 ) to Fg
    90//           If Fg Begin
    91//              Get text_extent (prompt_button_Value(self)) to tsz
    92//              Get GuiSize to sz
    93//              Set GuiSize to (Hi(sz)) (low(sz)+(Low(tsz)*2))
    94//              Send Adjust_logicals
    95//           End
    96        end
    97        Else ;                  // 1 = make an object, 2= remove object
    98           Move (Create=PB_PromptOn) to fg
    99        If Fg Begin
   100           Set Form_Button_Value item 0 To (Prompt_Button_Value(self))
   101           Set Form_Button item 0 To FORM_BUTTON_PROMPT
   102        End
   103        Else ;
   104           Set Form_Button item 0 To FORM_BUTTON_NONE
   105     End_Procedure // Create_Prompt_Button
   106
   107     //  Send prompt if object can be made the focus (or is the focus)
   108     //
   109     { MethodType=Event }
   110     Procedure Form_Button_Notification integer Item# integer Dummy
   111        integer rval
   112        If (Focus(desktop)<>self) ;
   113            get msg_Activate to rval
   114        If (Focus(desktop)=self) ;
   115            Send Prompt
   116     End_Procedure
   117
   118     { MethodType=Event  NoDoc=True }
   119    // as of 15.1 we changed all deactivating/activating signatures to not return values (see windows.pkg / ComboForm / Activating for more)
   120     Procedure Activating //Returns Integer
   121         Integer iMode iRet
   122         Get Prompt_Button_Mode to iMode
   123         If iMode eq PB_PromptAuto ;
   124            Send Create_Prompt_Button iMode
   125         Forward get msg_Activating to iRet
   126         Procedure_return iRet
   127     End_Procedure
   128
   129
   130End_Class
   131