help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Iliad: I must be misunderstanding some basic form behav


From: Bèrto ëd Sèra
Subject: [Help-smalltalk] Iliad: I must be misunderstanding some basic form behaviour...
Date: Sat, 14 Nov 2009 05:38:34 +0200

Hi!

stupid me again :) I have a very simple widget that is supposed to
collect a search string execute the search and show it in another
widget. You'd think one would run into trouble because of interwidget
operations, but no, everything fine on that front. My problem is that
the value in the textarea for some reason doesn't get passed at all.
If I put a constant string in the example, instead of using "self
target" everything works just fine... Maybe it's simply too late at
night, but it really beats me, there simply does not seem to be much
that can go wrong in so little code...

Berto

My widget:

  Ambaradan.AmbaradanLocalizedWidget subclass: WidgetSearch [
    <category: 'Widgets'>
    <comment: 'version 0.6.0' >
    | target |

    WidgetSearch class [

      initialize [
        "Registering the uuids of the text strings used by the GUI."
        <category: 'initialization'>
        super initialize.
        self
          guiAdd: #title        -> 'Search';
          guiAdd: #searchButton -> 'search';
          guiAdd: #includeDef   -> 'include definitions';
          guiAdd: #help         -> 'You can target expressions only or
also look in definitions. Parenthesys and boolean operators can be
used.'.
      ]
    ]

    doSearch [
      <category: 'search'>
      | parser result |
      result := Ambaradan.SearchResult asResultOf: (self target)
fromGateway: (self application gateway).
      self application history add: result.
      self application historyWidget markDirty.
      (self application searchResultsWidget)
         hasResults: true;
         index: 1;
         markDirty.
      ^self
         target: '';
         markDirty;
         yourself
    ]

    target: aString [
      <category: 'accessing'>
      ^target := aString
    ]

    target [
      <category: 'accessing'>
      ^target
    ]

    contents [
        <category: 'building'>
        ^[:e |
            | divImage divtitle form |
            divImage := e div id: 'search-image'.
            divtitle := divImage div class: 'sidebar-title title-right'.
            divtitle build: (self localize: #title).
            form := divImage form.
            (form textarea)
                cols: 17;
                rows: 2;
                action: [:val | self target: val].
            form br.
            form build:
              (LocalizedButton new
                 from: (self getText: #searchButton)
                 withStatus: (self status: #searchButton)
                 withAction: [self answer: self doSearch]).
            form br.

            form checkbox
                action: [:val | nil].
            form build: (self localize: #includeDef).
            form br.
            (divImage div class: 'help')
              build: (self localize: #help) ]
    ]

  ]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]