Coding a button to chose random user defined words ?

Yep as the title says for I need write a code for a button which it chooses random values and show it on screen(on a label maybe).This is just a one part of my project which I need to do it for my homework and because that I dont have much time I decided come and ask here.
Let me explain my project first.I have one button at the bottom and one label at the top(or any other object you say).I need to define 5 different situations inside the code like situation A situation B ....C....D...E.... etc. and when I click the button it will display randomly selected situation.
Example
I run the app
Click
A
click again
B
Close the app
Open the app again
Click
H
just like this
Help is needed guys please.
Thanks...

I found this code on the net and tried it it worked but its for mac development so I cant use it.I tried to change it for ios but I failed maybe it will give you some idea.
The programmer named its class as RuFact
@interface RUFacts : NSObject {
    IBOutlet textField;
- (IBAction)reset:(id)sender;
- (IBAction)set5:(id)sender;
@end
@interface RUFacts : NSObject {
    IBOutlet UITextField *textField;
- (IBAction)reset:(id)sender;
- (IBAction)setTo5:(id)sender;
@end
#import "RuFactsViewController.h"
@implementation RUFacts
- (IBAction)reset:(id)sender {
    [textField setIntValue:0];
- (IBAction)setTo5:(id)sender {
    int random_num;
    random_num = (arc4random() % 7 - 1) + 1;
    if (random_num == 1)
        [textField setStringValue:@"Hello1"];
    else if (random_num == 2)
        [textField setStringValue:@"Hello2"];
    else if (random_num == 3)
        [textField setStringValue:@"Hello3"];
    else if (random_num == 4)
        [textField setStringValue:@"Hello4"];
    else if (random_num == 5)
        [textField setStringValue:@"Hello5"];
    else if (random_num == 6)
        [textField setStringValue:@"Hello6"];
    else if (random_num == 7)
        [textField setStringValue:@"Hello7"];
@end
This is the modified version of the code for ios every thing works fine with this code but it gives me interface error on
[textField setIntValue:0];
any ideas ???

Similar Messages

  • Add Link button in UDF(User Defined Field)

    How Can be add link Button when create new user Defined Field ?

    Hi,
    You can bring the link button in user designed forms using SDK, but you cannot create the Link button in SAP standard forms. It's hard to bring the link button in SAP standard forms.
    Raja.S

  • Prevent closure of user defined field forms

    Hi.
    I need to prevent the closure of a user defined fields form while the parent form is opened. I can trap the et_FORM_UNLOAD before event but seems is too late to prevent the closure. Have anyone some idea about it?
    Ciao. Nicola

    Hi Martella,
    You need to do two things to achieve this.
    1. Make sure that when parent form is opened, the user defined field form is always opened at that same time.
    you can do that as follows
    If pVal.FormTypeEx = [Parent form type] And pVal.EventType = et_FORM_ACTIVATE Then
       Set oForm = SBO_Application.Forms.GetForm(-Val(pVal.FormTypeEx), pVal.FormTypeCount)
       If oForm Is Nothing Then
            If applic.Menus.Item("6913").Enabled = True And applic.Menus.Item("6913").Checked = False Then
               applic.Menus.Item("6913").Activate
            End If
       End If
    End If
    2. Disable the close button(X) on the user defined field form as follows:
    If pVal.FormTypeEx = [User defined form type] And pVal.EventType = et_FORM_LOAD And pVal.Before_Action = False Then
         Set oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
         Set oItem = oForm.Items.Item("4") ' Item 4 is close button
          oItem.Enabled = False
    End if
    Hope this helps.
    Satish.

  • Predictive text and the user defined dictionary, h...

    for ages now I've suspected that I'm losing words out of my dictionary. how are the additional words stored in the phone? and can the location be changed to the memory card if its an issue with the phones memory?
    cheers
    Rich
    Nexu 5

    I experienced this with my Nokia 6230. That after a certain amount of user defined words, that the first ones i had put in where lost and i had to type them in all over again! Very frustrating, actually so frustrating that i simply stopped writing in the words that didnt match the wordlist and just pushed # 2 times and entered the word the old fashioned way! I think that the 6230 didnt have more then around 20 user defined words that could be put in!
    However on my new Nokia N80 there seems to be alot larger amount of words that are user defined in the wordlist, since i yet havent seen the oldes words be replaced! Perhaps the old phones had a much smaller list of words being able to be stored.
    Same thing goes with messages, on my 6230 the inbox got full at around 100 sms. But on the N80 i think that the memory is dynamic and therefor can store more messages, words and whatever!

  • Enable User Defined toolbar button on click -  editable alv grid using oops

    Hi all,
    I  have created editable alv using  oops concept.
    created 2 user defined toolbar button save and print using method toolbar
      ls_toolbar-text      = 'Print'.                         "#EC NOTEXT
        ls_toolbar-quickinfo = space.
        ls_toolbar-checked   = space.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    requirement is
    initially print button should be disabled, and save enabled
    when i click save button, print button should be enabled.
    I want coding in editable alv oops concept
    kindly help
    regards
    senthil kumar

    Halo Senthil,
    You should call set_toolbar_interactive method of cl_gui_alv_grid in the on_user_command( ie the event handler for event user command) .
    method on_user_command.
    case e_ucomm.
    when 'SAVE'. or whatever your function code is .
    my_save_flag = 'X'.
    call method grid->set_toolbar_interactive.
    endmethod.
    This triggers the toolbar event of the
    cl_gui_alv_grid. Inside the eventhandler method ( ie the on_toolbar method ) you should set the toolbar.
    if my_save_flag = 'X'.
    read table e_object->mt_toolbar
    clear l_toolbar-disabled.
    modify e_object->mt_toolbar.
    endif.
    e_ucomm will not have  the function code if the save button is not in the toolbar area.
    then you can set the my_save_flag in the data_changed event handler of the Cl_gui_alv_grid.
    Regards
    Arshad

  • How to create user defined button in alv report

    how to create user defined button in alv report
    thnks in advance.

    Hi,
    U can define it the the PF-STATUS ( Menu for ALV ).
    For that u have to define it in the EVENTCAT.
    form z_eventcat  using    p_i_eventcat type slis_t_event.
      data: i_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = p_i_eventcat
        exceptions
          list_type_wrong = 1
          others          = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      clear i_event.
      read table p_i_eventcat with key name = slis_ev_top_of_page into
      i_event.
      if sy-subrc = 0.
        move 'TOP_OF_PAGE' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
      read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
      if sy-subrc = 0.
        move 'SET_PF_STATUS' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
      clear i_event.
      read table p_i_eventcat into i_event with key name = slis_ev_user_command .
      if sy-subrc = 0.
        move 'USER_COMMAND' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
    And in the DISPLAY
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                = v_progname
         i_callback_pf_status_set          = 'SET_PF_STATUS'
         i_callback_user_command           = 'USER_COMMAND'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = v_gridtitle
         i_save                            = 'A'
         is_layout                         = i_layout
         it_fieldcat                       = i_fieldcat[]
         it_sort                           = i_sortinfo
         it_events                         = i_eventcat
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_final
       exceptions
         program_error                     = 1
         others                            = 2
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    *MENU SETTINGS.
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'ALV_MENU'.
    endform.                    "SET_PF_STATUS
    endform.                    " Z_EVENTCAT
    Now double click on ALV MENU nad u can create a button in the application bar.
    Regards,
    Pritha.

  • Link button to User Defined Object in Grid

    Hi,
    I'm using SAP B1 8.81 with B1DE.
    I have added a grid which is populated from a DataTable to a form.
    One of the columns in the grid contains the DocEntry of a User Defined Object.
    How can I display a link button on the grid ?
    Regards,
    Ben

    Hello Ben,
    You need to set the column object type.
    Dim oGrid As SAPbouiCOM.Grid = oForm.Items.Item("MyGrid").Specific
    oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText
    Dim oEditCol As SAPbouiCOM.EditTextColumn = oGrid.Columns.Item("DocEntry")
    oEditCol.LinkedObjectType = "2" 'The SDK documentation says you should use the value 0, but in previous versions it didn't work, so I recommend you user a value other than -1 or 0
    You then need to catch the et_MATRIX_LINK_PRESSED event and other your user form...
    From the SDK Help File regarding the BoLinkedObjectType enum
    lf_None -1 No target object
    lf_UserDefinedObject 0 User-defined object
    lf_GLAccounts 1 G/L account object
    lf_BusinessPartner 2 Business Partner object
    lf_Items 4 Item object
    lf_SalesEmployee 53 Sales employee object
    Regards,
    Vítor Vieira

  • How to use user defined object with linked button

    Hi experts
    Can I use user defined table data with linked button. If yes then how. plz give me sample examples.
    Regards
    Gorge

    If you have an UDO in your form, or any other, the FormDataLoad eventhandler should be used.
    Take care, it is not inside the eventhandler.
    for VB:
    Select SBO_APPLICATION in the classes, and select FormDataLoad event
    Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent
    in C#
    Add a new eventhandler as
    // declaration
    SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(ref SBO_Application_FormDataEvent);
    // eventhandler:
    public void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)

  • Using user defined text functions to generate strings on button.

    I am new to java programming and am facing a problem.. It would be great if you could help me resolving it..
    The problem is:
    Is it possible to use user defined functions to generate the string on a button(button name)?
    If it is possible please educate me on it..
    Thanks..

    Yes its possible. What you ask is so vague that it can be interpreted in so many ways there are plenty correct answers
    public void userDefinedFunction(String aString)
    yourButton.setText(aString);
    }

  • ALV with user-defined buttons on toolbar in wd abap

    Hi All,
    I have to create an alv with user defined buttons  in wd abap on its toolbar.Could any one tell me in detail about it or provide me with any tutorial based on it.
    Thanking you all in advance.

    DATA: LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
    DATA: LR_INTF_ALV TYPE REF TO IWCI_SALV_WD_TABLE.
    LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).
    IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) EQ ABAP_FALSE.
       LR_CMP_USAGE->CREATE_COMPONENT( ).
    ENDIF.
    LR_INTF_ALV = WD_THIS->WD_CPIFC_ALV( ).
    WD_THIS->M_MODEL = LR_INTF_ALV->GET_MODEL( ).
    DATA: LR_FUNCTION TYPE REF TO CL_SALV_WD_FUNCTION.
    LR_FUNCTION =
    WD_THIS->M_MODEL->IF_SALV_WD_FUNCTION_SETTINGS~CREATE_FUNCTION(
                            ID = 'ISSUE' ).
    DATA: LR_BUTTON TYPE REF TO CL_SALV_WD_FE_BUTTON.
    CREATE OBJECT LR_BUTTON.
    LR_BUTTON->SET_TEXT( 'Issue/Receive' ).
    LR_FUNCTION->SET_EDITOR( LR_BUTTON ).
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110
    Abhi

  • User-defined F4 Search - cancel button in the title bar

    Hi,
    I implement user-defined F4 search for my WD application. F4 view comes from another component (as described in the tutorial). Everything is fine, I see that view popuped when F4 is clicked for an input field. My problem is, how to make visible the Close button in the title bar of that popup window.
    I was able to set window's title text, but have no idea how to control those buttons. I only see maximize button which comes by default.
    Also would be nice to create kind of standard OK and Cancel buttons on the bottom bar instead of creating them manually on my view... I've tried set_button_kind(), it works somehow: displayes three empty buttons without icons - need more info about it too...
    Thanks

    Hi Serguei,
    The empty buttons are worth a ticket.
    The behavior for the close button in popups is that the application developer can determine its visibility independent from the buttons in the lower row.
    The second aspect is the action that is triggered if someone clicks that button. There the application developer is able to bind a separate action to that close button. If no action was bound and if a cancel button is visible, clicking the close button will trigger the same action as it would have been the case for the cancel button. A bit complicated, I know. We had to do the latter for backwards compatibility.
    Best regards,
    Thomas

  • CFolders - User Defined Buttons

    Hi All,
    I went to SPRO -> Collaboration Folders and created a User-defined button for showing the status report.
    The place at which is displayed, i have chosen "Default".
    Then went to SPRO -> Collaboration Folders and BADI, created a new implementation name and activated with the Filter ID as the new button id (created from the above step).
    But now my question is, in the cFolders, i can't able to see the button. Any other specific setting need to be done, to display the button?
    And also i would like to know, when i click the button, it has to generate an ABAP report in html format. Any suggestion on this?
    Regards,
    Anandhi

    I don't think this is possible in the ALV, you may add another toolbar using class [CL_GUI_TOOLBAR|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/8f/bcc23657ad0730e10000009b38f839/frameset.htm].
    (You can  search sdn for sample or look at SAP sample SAPTOOLBAR_DEMO1)
    Regards,
    Raymond

  • How i can make user defined button in standard menu.........

    hi all,
                     please tell me how i can make user defined button in standard menu.........
       regards
    vikas saini

    hi Vikas ,'
    u can do this by using PF status and setting titile .
    follow thw link for help.
    Re: To Change SAP Tiltle into some other title
    Regards,
    Amit

  • User defined class objects for a ADF component (button,inputfield)

    How do I define a user defined class object for ADF objects?
    My requirement is that when I do a modification to the class object, it should get reflectected to all the instances on my page.
    E.g:- I'm having class object clsInputField, and all my input fields in my pages are based on this object. So when I change clsInputField it should get reflected to all my controls based on this class object.
    Please help!!!

    Hi Timo,
    In our client server environment, we have a custom control for managing the zip code (used a Custom InputText field which extends the actual TextField) . All zip code specific validations are written in this custom class. In our application many of the pages uses this Custom component. So if any of the zipcode specific behaviour changes, we could implement this by only changing the Custom InputText field class.
    We need to implement this behaviour in our ADF applications. Please advise.
    Thanks,
    Vishnu

  • User defined fields does not get added into database

    Hello Experts
                              User defined fields does not get added into database , when i click add button it
    shows data added sucessfully , but when i check data base no entry is made , only entry is made for
    B1 fields , like DocEntry ,DocNum etc.., no entry is made for U_fields..
    I have check every thing databound is also set to true
    Actually first few 6 data was added properly but now its not geeting added for user fields
    I have used 2 document row  child table for 2 matrix and for remaining Document table
    What might be the problem
    reply soon
    plz suggest

    Hello sir
    I have checked Default form , in that entry is made into database
    but running the form in screen painter in preview mode or through coding it does not get added for user field
    this id my binding code
    LoadFromXML("updateopd.srf")
                oForm = SBO_Application.Forms.Item("updopd")
                oForm.DataBrowser.BrowseBy = "txtpatid"
                'Adding combo in Obervation
                oItem = oForm.Items.Item("txtpatid")
                oEdit2 = oItem.Specific()
                oEdit2.DataBind.SetBound(True, "@UPDATE", "U_PID")
                oItem = oForm.Items.Item("txtmnane")
                oEdit3 = oItem.Specific()
                oEdit3.DataBind.SetBound(True, "@UPDATE", "U_FName")
                oItem = oForm.Items.Item("txtlname")
                oEdit3 = oItem.Specific()
                oEdit3.DataBind.SetBound(True, "@UPDATE", "U_LName")
    Plz suggest

Maybe you are looking for