Results 1 to 4 of 4

Thread: Form questions

  1. #1
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Form questions

    Because I am now looking for work, I thought I would expand on a game project I did for school, which used SCAR, and create a fully working board game (think monopoly) with a fully functioning AI, (that challenge later). I have currently converted it to simba, and am configuring better code.

    Q1. Forms have a TComboBox, where you can select an item, or type one in, is there one which you can only select one?

    Q2. TLabel, can I change the orientation of the text? (ie have it going up the page).

    Q3. When my form loads, its too big for my screen, (its 1200x1200) and its not offering a scroll bar. I tried using the property 'VERTSCROLLBAR' but when I try and use create, or change Visible, it just says Compiling failed, with no explanation.

    Q4. Why won't WordWrap work propely...

    possibly more questions later. Yes I know I need a small snippit of code from SRL to get forms to work, yes I know where it is. Yes you guys will get full credit for Simba and the stuff that makes forms work.

    Current Script Project
    Pot of flour gatherer - 95% done

    Can't get Simba to work? Click here for a tutorial

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Bad Boy JH View Post
    Q1. Forms have a TComboBox, where you can select an item, or type one in, is there one which you can only select one?
    Use the OnKeyDown Event.

    PascalScript := FAIL;

    so we don't get the ReadOnly property...

    Simba Code:
    program new;

    procedure Pressed(Sender: TObject; var Key: Word; Shift: TShiftState);
    begin
      DebugLn(IntToStr(Key));
      if (not (InIntArray([8,  9, 13, 16, 17, 18, 37, 38, 39, 40, 46], Key))) then
        Key := 0;

      if ((Key = 8) or (Key = 46)) then
        TComboBox(Sender).Text := '';
    end;

    procedure ShowForm;
    var
      I: integer;
    begin
      with TComboBox.Create(nil) do
        try
          Parent := TForm.Create(nil);
          Top := 50;
          Left := 50;
          Sorted := True;
          OnKeyDown := @Pressed;
          for I := 1 to 25 do
            Items.Add('Randomness ' + IntToStr(I));
          with TForm(Parent) do
            try
              Width := 200;
              Height := 125;
              ShowModal;
            finally
              Free;
            end;
        finally
          Free;
        end;
    end;

    var
      V: TVariantArray;

    begin
      ThreadSafeCall('ShowForm', V);
    end.

    E, E2: Updated Pressed Function
    Last edited by Dgby714; 01-18-2011 at 05:42 AM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  3. #3
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I already have a double check feature, which when they hit send, it refuses anything not in the list, and sends them right back to the form to try again... however I wish I didn't need to double check...

    Is there a simmilar easy to understand language simmilar to pascal (python?) which has good forms, and functions reasonably simmilar to pascal (with regards to functions etc.)

    Current Script Project
    Pot of flour gatherer - 95% done

    Can't get Simba to work? Click here for a tutorial

  4. #4
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    if you have the double check on the onkeyup event, then you could disable the button from being pressed until it matches whatever item you want. (if i get what you're doing)
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •