Results 1 to 8 of 8

Thread: Forms, need help quick please!

  1. #1
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Forms, need help quick please!

    okay, here is my problem: i want a dropbox to "refresh", here is what I mean:
    SCAR Code:
    if (WhatToDo.Text='Cooking') then
      begin
        cbspec.text := 'meat';
        cbspec.Items.Add('chicken');
        cbspec.Items.Add('shrimps');
        cbspec.Items.Add('anchovies');
        cbspec.Items.Add('trout');
        cbspec.Items.Add('salmon');
        cbspec.Items.Add('tuna');
        cbspec.Items.Add('lobs');
        cbspec.Items.Add('swordfish');
        cbspec.Items.Add('sharks');
      end;
      if (WhatToDo.Text='Smelting') then
      begin
        cbspec.text := 'bronze bars';
        cbspec.Items.Add('bronze bars');
        cbspec.Items.Add('iron bars');
        cbspec.Items.Add('silver bars');
        cbspec.Items.Add('steel bars');
        cbspec.Items.Add('Gold Bar');
        cbspec.Items.Add('Mithril Bar');
        cbspec.Items.Add('Adamant Bar');
        cbspec.Items.Add('Rune Bar');
      end;
      if (WhatToDo.Text='Tanning') then
      begin
        cbspec.text := 'Hard Leather';
        cbspec.Items.Add('Soft Leather');
        cbspec.Items.Add('Hard Leather');
      end;
    This is just one example, but you get the idea. if I choose "tanning" in the first dropbox, i want the second one to show the tanning options...
    Thank you,Pure1993
    There is nothing right in my left brain and there is nothing left in my right brain.

  2. #2
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    cbspec.Clear
    before each option starts.

    That clears the whole combo box and then you can add the new info into it
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  3. #3
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for helping us!
    ~Hermen

  4. #4
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks, but that wan't really the answer to our problem.
    The first combo box has three options: tanning, cooking, and smelting.
    if, for example, i chose smelting in the first option, then, in the second combobox, i want to have displayed: shrimp, meat, trout, {etc.}.
    So, technically, all we are looking for if an option to sorta "refresh" the form, so that the second combobox can "see" what we have done to the first one, and react accordingly...
    There is nothing right in my left brain and there is nothing left in my right brain.

  5. #5
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I always wanted to do this a script I have been doing for, say 6 months.

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by Pure1993 View Post
    ...xample, i chose smelting in the first option, then, in the second combobox, i want to have displayed: shrimp, meat, trout, {etc.}.
    So, techni...
    lol, ur sure that is what u want?

  7. #7
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    I am assuming WhatToDo is another ComboBox.

    PHP Code:
    program New;

    Var
      
    WhatToDocbSpecTComboBox;
      
    procedure ChangeCBSpec(SenderTObject);
    begin
      cbSpec
    .Clear;
      case 
    WhatToDo.Text of
        
    'Tanning'begin
                   
    //What you want added to tanning goes here for refresh
                   
    end;
        
    'fighting':begin
                   
    //What you want added to fighting goes here for refresh
                   
    end;
        
    //Others here
      
    end;
    end;

    procedure InitForm;
    begin
      
    //Rest of form stuff goes here
      
    WhatToDo.OnChange := @ChangeCbSpec;
    end;

    begin
    end

    Look at where I've added the Clear. Is that not what you want? Everytime you select a new WhatToDo item, the cbSpec will refresh and add the new options in
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  8. #8
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @Starblast: Thanks, you are the best! (I didn't know about that ".OnChange" thing ^^)
    @Zytext: Yeah, I am pretty sure that's what I want...
    There is nothing right in my left brain and there is nothing left in my right brain.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Just a quick question? Did I say quick?
    By SeanJohn in forum OSR Help
    Replies: 3
    Last Post: 01-28-2009, 12:03 AM
  2. Help with forms
    By rotflmfwao in forum OSR Help
    Replies: 17
    Last Post: 08-21-2007, 03:08 AM

Posting Permissions

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