Note that there are some explanatory texts on larger screens.

plurals
  1. POShoes problems: clipboard and scroll bar
    text
    copied!<p>The code below has (at least) two problems: the <code>Copy</code> button doesn't update the clipboard, and the <code>edit_box</code> doesn't show a vertical scroll bar when it should.</p> <pre><code>Shoes.app (:title =&gt; "Test", :width =&gt; 1000, :height =&gt; 600) do background "#DFA" stack :margin =&gt; 30 do flow do button "Paste" do @sql.text = clipboard end button "Copy", :margin_left =&gt; 15 do clipboard = @sql.text alert(@sql.text.length.to_s + " characters copied to clipboard.") end end stack :margin_top =&gt; 10, :width =&gt; "100%", :height =&gt; 500, :scroll =&gt; true do @sql = edit_box :width =&gt; "100%", :height =&gt; "100%" end end end </code></pre> <p>The <code>Paste</code> button correctly pastes the clipboard contents into the <code>edit_box</code>. If you make changes, then click <code>Copy</code>, the <code>alert</code> message displays the correct number of characters. If you then click <code>Paste</code> again, the original clipboard contents are pasted. The <code>Copy</code> button never correctly updates the clipboard.</p> <p>Also, if you generate more lines than fit the <code>edit_box</code>, either by editing or pasting, no scroll bar ever appears.</p> <p>Any help on these two issues will be much appreciated. My environment is Windows XP if that helps.</p> <p><strong>UPDATE WITH ANSWERS:</strong> Thanks to @Pesto for answering the clipboard question. It turns out that qualifying <code>clipboard</code> with either <code>app.</code> or <code>self.</code> works as expected in both the <code>Paste</code> and <code>Copy</code> buttons.</p> <p>After digging deeper into the scrollbar issue, I think I understand why the <code>edit_box</code> doesn't show a scrollbar. The scrollbar in Shoes applies only to slots (<code>stack</code> and <code>flow</code>), and not to individual elements like <code>edit_box</code>. The <code>edit_box</code> height is specified in such a way as to always fit within the enclosing <code>stack</code>, so the <code>stack</code> never needs a scrollbar. This led me to a work-around that is not ideal, but is acceptable for my application. Simply change the <code>edit_box</code> height to a larger-than-necessary value such as <code>"10000px"</code> and the scrollbar appears. Unfortunately, it's there whether needed or not, but that's better than no scrollbar. I'm sure that some additional tinkering can dynamically change the <code>edit_box</code> height to exactly fit the contents, so that the scrollbar will appear only when needed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload