Hi Staffan,
Here is a program that demonstrates how the setTabStops() method works, and
can be used for testing the method.
On Windows 7 at least it appears to me that the method works okay.
ooDialog merely invokes the Windows API. Any discrepancies in the way
things work is due to Microsoft, not ooDialog.
It looks to me like Windows does not report any errors, it simply does not
set the erroneous tab stop but continues from that point on with default
tab stops. Note that tab stops are set at every 32 *dialog* units by
default. Units are in dialog units, not pixels.
By the way, I discovered when playing with this that you can enter a tab
stop when typing in the edit control using CTRL-tab.
Watch for line wraps:
/* A Simple Dialog demonstrating tabstops in an edit contorl */
consts = .table~new
consts[IDC_EDIT] = 106
consts[IDC_PB_PUSHME] = 107
consts[IDC_RB_DEFAULT] = 108
consts[IDC_RB_EVEN_SPACE] = 109
consts[IDC_RB_NUMBERS] = 110
consts[IDC_UPD_EDIT] = 111
consts[IDC_UPDOWN] = 112
consts[IDC_EDIT_TABS] = 113
consts[IDC_ST_TYPE] = 114
.application~setDefaults('O', consts, .false)
dlg = .TabStopsDialog~new()
if dlg~initCode = 0 then do
dlg~create(30, 30, 480, 160, "Edit Control with TabStops", "VISIBLE")
dlg~execute("SHOWTOP")
end
-- End of entry point.
::requires "ooDialog.cls"
::class 'TabStopsDialog' subclass UserDialog
::method defineDialog
self~createStaticText(IDC_ST_TYPE, 10, 15, 300, 10, "TAB", "When 'Reset
Tabs' is pushed, set tabstops to: Evenly spaced")
styles = "VSCROLL HSCROLL MULTILINE"
self~createEdit(IDC_EDIT, 10, 25, 440, 90, styles)
self~createPushButton(IDC_PB_PUSHME, 10, 135, 45, 15, "DEFAULT GROUP",
"Reset Tabs", pushed)
self~createGroupBox(IDC_STATIC, 65, 120, 340, 30, , 'Reset Tabstops to:')
self~createRadioButton(IDC_RB_DEFAULT, 70, 133, 45, 11, , 'Default')
self~createRadioButton(IDC_RB_EVEN_SPACE, 120, 133, 60, 11, , 'Evenly
Spaced')
self~createEDIT(IDC_UPD_EDIT, 185, 129, 30, 16, 'NUMBER READONLY CENTER')
self~createUpDown(IDC_UPDOWN, 195, 129, 30, 16, 'AUTOBUDDY BUDDYINT
ARROWKEYS')
self~createRadioButton(IDC_RB_NUMBERS, 225, 133, 75, 11, , 'Individual
Tabstops')
self~createEdit(IDC_EDIT_TABS, 305, 133, 95, 11, 'AUTOSCROLLH')
self~createPushButton(IDOK, 415, 135, 35, 15, , "Done")
self~connectButtonEvent(IDC_RB_DEFAULT, 'CLICKED', onDefault)
self~connectButtonEvent(IDC_RB_EVEN_SPACE, 'CLICKED', onEven)
self~connectButtonEvent(IDC_RB_NUMBERS, 'CLICKED', onNumbers)
::method initDialog
expose staticText edit editTabs tab
staticText = self~newStatic(IDC_ST_TYPE)
edit = self~newEdit(IDC_EDIT)
font = self~createFontEx('Courier New', 9)
edit~setFont(font)
tab = '09'x
text = tab"H1"tab"H2"tab"H3"tab"H4"tab"H5" || '0d0a'x || -
"------------------------------------------------------------------------------------------"
|| '0d0a'x || -
tab"1"tab"2"tab"3"tab"4"tab"5" || '0d0a'x || -
" " || '0d0a'x || -
" 1 2 3 4 5 6
7 8 9" || '0d0a'x || -
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|| '0d0a'x || -
""
edit~setText(text)
rbDefault = self~newRadioButton(IDC_RB_DEFAULT)
rbEven = self~newRadioButton(IDC_RB_EVEN_SPACE)
rbNumbers = self~newRadioButton(IDC_RB_NUMBERS)
rbEven~check
editTabs = self~newEdit(IDC_EDIT_TABS)
self~setupUpDown(upDown)
::method pushed unguarded
expose edit upDown tab isEven isDefault isNumbers
select
when isDefault then do
ret = edit~setTabStops(.array~new); say 'setTabStops ret =' ret
end
when isEven then do
pos = upDown~getPosition
ret = edit~setTabStops(.array~of(pos)); say 'setTabStops ret =' ret
end
when isNumbers then do
data = self~getTabStops
if data == .nil then do
end
else do
ret = edit~setTabStops(data); say 'setTabStops ret =' ret
end
end
otherwise do
msg = 'Internal programming error. Mode is not default, even, or
numbers'
title = 'Impossible situation'
ret = MessageDialog(msg, self~hwnd, title, 'OK', 'ERROR', 'TOPMOST')
return 0
end
end
::method onDefault unguarded
expose upDown staticText editTabs isEven isDefault isNumbers
staticText~setText("When 'Reset Tabs' is pushed, set tabstops to their
default value (every '32' dialog units)")
upDown~disable
editTabs~disable
isEven = .false; isDefault = .true; isNumbers = .false
::method onEven unguarded
expose upDown staticText editTabs isEven isDefault isNumbers
pos = upDown~getPosition
staticText~setText("When 'Reset Tabs' is pushed, set tabstops to every
'"pos"' dialog units")
upDown~enable
editTabs~disable
isEven = .true; isDefault = .false; isNumbers = .false
::method onNumbers unguarded
expose upDown staticText editTabs isEven isDefault isNumbers
staticText~setText("When 'Reset Tabs' is pushed, set tabstops to the
positions specified in the adjacent edit control.")
upDown~disable
editTabs~enable
isEven = .false; isDefault = .false; isNumbers = .true
::method onUpDownMove unguarded
expose staticText
use arg pos, delta, id, hwnd, rxUpd
newPos = pos + delta
staticText~setText("When 'Reset Tabs' is pushed, set tabstops to every
'"newPos"' dialog units")
return .UpDown~deltaPosReply
::method setupUpDown private
expose upDown staticText isEven isDefault isNumbers
upDown = self~newUpDown(IDC_UPDOWN)
upDown~setRange(1, 256)
upDown~setPosition(32)
self~connectUpDownEvent(IDC_UPDOWN, 'DELTAPOS', onUpDownMove)
isEven = .true; isDefault = .false; isNumbers = .false
staticText~setText("When 'Reset Tabs' is pushed, set tabstops to every
'"32"' dialog units")
::method getTabStops private
expose editTabs
result = .nil
tabs = editTabs~getText~space~makeArray(' ')
if tabs~items == 0 then do
msg = 'External error. No tabstops specified by the user.'
title = 'User Error'
ret = MessageDialog(msg, self~hwnd, title, 'OK', 'ERROR', 'TOPMOST')
return result
end
do i = 1 to tabs~items
if \ tabs[i]~datatype('W') | tabs[i] \>> 0 then do
msg = 'External error. Tabstop index' i 'is not a postive whole
number'
title = 'User Error'
ret = MessageDialog(msg, self~hwnd, title, 'OK', 'ERROR', 'TOPMOST')
return result
end
end
return tabs
On Sun, May 4, 2014 at 3:05 PM, Staffan Tylen <staffan.ty...@gmail.com>wrote:
> Hi Mark, and thanks for your feedback. I would hate to interrupt your
> vacation with this so I'll keep off for the time being. This is a very
> minor issue at the moment so it can certainly wait. I'll see if I can put
> together a failing sample for when you get back. As for "themed" controls,
> the only such controls I have are treeviews with the EXPLORER theme, but I
> guess that fact wouldn't apply in the case of an edit control.
>
> Enjoy your vacation!
>
> Staffan
>
>
>
> On Sun, May 4, 2014 at 11:36 PM, Mark Miesfeld <miesf...@gmail.com> wrote:
>
>> Hi Staffan
>>
>> I'm on vacation with little to no Internet. So, if you send me a simple
>> example that you would like to work, I'll see if I can get it working and
>> send it back to you next time I stop at a coffee shop with WIFi.
>>
>> That said, the trouble I usually have when trying these tab stop things
>> is remembering that the the "tab stop" is the actually character location,
>> not the difference between the tab stops. I.e., if you want tab stops to
>> be 8, you need to specify them as: 0 8 16 24 32 ...
>>
>> Also, be aware that tab stops in the controls, edit and list box, are
>> apparently a hold over from 16-bit windows and don't always work well with
>> any "Themed" controls. That might be the problem here.
>>
>> --
>> Mark Miesfeld
>>
>>
>>
>> On Wed, Apr 30, 2014 at 2:34 PM, Staffan Tylen
>> <staffan.ty...@gmail.com>wrote:
>>
>>> I have an edit control defined as READONLY MULTILINE VSCROLL and I'm
>>> trying to use setTabStops(.array~new(20)) to control how the text, which
>>> contains tab characters '09'x, should be placed in the control. The program
>>> sets the text in the control using setText, but the text is not adjusted
>>> using the tabs as expected. So then I've tried the sequence:
>>>
>>> edit~setText("")
>>> w = .WindowsClipBoard~new
>>> w~copy(textWithTabs)
>>> edit~setReadOnly(.FALSE)
>>> edit~pasteText
>>> w~empty
>>> edit~setReadOnly(.TRUE)
>>>
>>> I tried this because it's not fully clear if setTabStops takes effect
>>> with setText or if it only works during a paste operation. But this doesn't
>>> seem to work either. I then found the EditControlEx.cls sample that comes
>>> with ooDialogs but unfortunately I haven't been able to understand what the
>>> tab function in there is trying to demonstrate, I can't get anything
>>> tab-friendly working running the example.
>>>
>>> I'm obviously missing something here but I can't see what it is. Any
>>> suggestions?
>>>
>>> Staffan
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>>> Instantly run your Selenium tests across 300+ browser/OS combos. Get
>>> unparalleled scalability from the best Selenium testing platform
>>> available.
>>> Simple to use. Nothing to install. Get started now for free."
>>> http://p.sf.net/sfu/SauceLabs
>>> _______________________________________________
>>> Oorexx-users mailing list
>>> Oorexx-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos. Get
>> unparalleled scalability from the best Selenium testing platform
>> available.
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> _______________________________________________
>> Oorexx-users mailing list
>> Oorexx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos. Get
> unparalleled scalability from the best Selenium testing platform available.
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users