none
add button to form programiticly

    Question

  • I want to add button and picture to the form by code
    just click button to add another button
    and put a click action for the new button
    Saturday, January 16, 2010 2:26 PM

Answers


  •    HI  ALAA:

    *....Add a class definition  in your  main.prg code in any place..*

    DEFINE CLASS cmdMyCmndBtn10 AS CommandButton  && Create Command button
       Caption = 'Alaa Mukhtar'  && Caption on the Command button
       Left = 200   && Command button column
       Top = 100    && Command button row
       Height = 25  && Command button height

      PROCEDURE CLICK
          WAIT WIND  "This  example is working "
     
      PROCEDURE GOTFOCUS
        *****
        *****
      PROCEDURE LOSTFOCUS
        *****
        *****
     
    ENDDEFINE
    *..object name must be unique ..when adding programaticaly to your form..*

      in INIT()  EVENT  of form  add  this code
     
      thisform.pageframe1.page1.addobject("cmnd6","cmdMyCmndBtn10")
      thisform.pageframe1.page1.cmnd6.visible=.t.  
      thisform.pageframe1.page1.PICTURE="D:\BABA\KANAAN\BITMAPS\NEXT.BMP"
     
     *. It is  Better  to create objects  at designe time  not at run time and use
     *. visible setting  to .t.  or .f.  to show or hide  this objects it is easier
     *..than all coding  unless you create all things  by programms  and not  using
     *..any wizard ,Some Prefer that like Code masters Cetinbasoz,Marcia Akins,Naom,vladimer;
     *... Craig ,Alex ,I Do not
     


    azizsallam
    • Edited by abd el aziz sallam Monday, January 18, 2010 12:08 AM run word
    • Marked as answer by Jeff Shan Friday, January 22, 2010 8:30 AM
    Saturday, January 16, 2010 6:16 PM