[patch] Allow use cursor keys to move in lists

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
alex6
Engineer
Engineer
Posts: 2
Joined: 13 Oct 2014 00:04
Location: France (Lille)

[patch] Allow use cursor keys to move in lists

Post by alex6 »

Here is another patch that i always wanted (https://bugs.openttd.org/task/6074?project=1).

It lets the user to use arrow keys up and down to navigate in the following lists :
  • 1) build of new vehicles/trains/ships/aircrafts : it's very useful to quickly compare the caracteristics of the vehicles
    2) lists of vehicles/ships/aircrafts
It would be nice if some of you could patch their version of openttd to see if it's ok. :)

Thanks !
Attachments
patch_FS#6074_alex6.diff
patch file
(3.43 KiB) Downloaded 63 times
Lechuza
Engineer
Engineer
Posts: 16
Joined: 30 Oct 2014 01:33

Re: [patch] Allow use cursor keys to move in lists

Post by Lechuza »

Love the idea, I instinctively do this when I scroll through vehicles until I realize is not supported and instead use the mouse.
Works perfectly except when you do the following:
  • 1. Select (one of the) top vehicles.
    2. Scroll down with the mouse by draggin the scroll bar, so the selected vehicle is not seen in the list anymore.
    3. Use the arrow keys to scroll all the way down.
Thats when I encounter the following crash, which my guess is that an index is going out of bounds.

Code: Select all

*** OpenTTD Crash Report ***

Crash at: Sat Nov 01 21:15:35 2014
In game date: 1920-01-02 (35)

Crash reason:
 Exception: E1212012
 Location:  00007FFFA167606C
 Message:   Assertion failed at line 704 of c:\users\lechuza\desktop\openttd\trunk\src\widget_type.h: this->count <= this->cap ? (position == 0) : (position + this->cap <= this->count)

OpenTTD version:
 Version:    r27051M (2)
 NewGRF ver: 150069ab
 Bits:       64
 Endian:     little
 Dedicated:  no
 Build date: Nov  1 2014 19:08:36

Registers:
 RAX: 00007FFF00000004 RBX: 0000000000000016 RCX: 0000000000000048 RDX: 0000000000000001
 RSI: 0000000000000000 RDI: 0000000000000001 RBP: 00000029CF5DF2B9 RSP: 00000029CF5DEE40
 R8:  00007FFFA3DA23A3 R9:  00007FFFA3DA2458 R10: 0000000000000000 R11: 0000000000000000
 R12: 0000000000000910 R13: 00000000003D028A R14: 00007FF7B06F1208 R15: 00007FF7AFCA6274
 RIP: 00007FFFA167606C EFLAGS: 00000206

 Bytes at instruction pointer:
 48 8B 8C 24 C0 00 00 00 48 33 CC E8 84 B3 FF FF 48 81 C4 D8 00 00 00 C3

Stack trace:
 00000100 00000000 00000016 00000000 00000000 00000000 00000001 00000000
 E1212012 00000000 00000000 00000000 A167606C 00007FFF 00000000 00000000
 B065BFF8 00007FF7 B0CCAB30 00007FF7 00000050 00000000 003D028A 00000000
 00000000 00000000 B0CCAB30 00007FF7 B065BFF8 00007FF7 00000010 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 A42832F7 00007FFF
 00000000 00000000 00000000 00000000 CF5DED20 00000029 CF5DED00 00000029
 29A17DFE 0000A8E7 00000001 FFFFFFFF 00000016 00000000 AFD914B7 00007FF7
 00000001 00000000 D1138B29 00000000 3B375EE0 0000B6F2 A427430B 00007FFF
 01500001 00000000 0000000C 00000000 00000100 00000000 00000000 00000000
 01500001 00000000 0000000C 00000000 0000000C 00000000 AFD90A24 00007FF7
 00000001 00000000 D1138B29 00000000 B0CCAB30 00007FF7 FFFFFFFF 00000000
 A27AF790 00000029 AFA119CB 00007FF7 A27AF790 00000029 CF5DF2B9 00000029
 0000000C 00000000 B0658CD8 00007FF7 65737341 6F697472 6166206E 64656C69
 20746120 656E696C 34303720 20666F20 755C3A63 73726573 63656C5C 617A7568
 7365645C 706F746B 65706F5C 6474746E 7572745C 735C6B6E 775C6372 65676469
 79745F74 682E6570 6874203A 3E2D7369 6E756F63 3D3C2074 69687420 633E2D73
 3F207061 6F702820 69746973 3D206E6F 2930203D 28203A20 69736F70 6E6F6974
 74202B20 2D736968 7061633E 203D3C20 73696874 6F633E2D 29746E75 00007F00
 00000000 00000000 AFB31FB1 00007FF7 D2C28E70 00000029 CF5DF169 00000029
 00000000 00000000 A3DA3CB3 00007FFF 00000000 00000000 A424304F 00007FFF
 CF97F610 00000029 CFDCE1F0 00000029 00000000 00000000 00000000 00000000
 CF7E0000 00000029 A4257CC5 00007FFF CF7E0000 00000029 A4257CC5 00007FFF
 D1D20008 00000029 2DFF0557 00000000 00000000 00000000 AFCA3931 00007FF7
 CF7E0000 00000029 A4257CC5 00007FFF D1D20068 00000029 00000000 00000000

Operating system:
 Name:     Windows
 Release:  6.2.9200 ()
 Compiler: MSVC 1700

Configuration:
 Blitter:      32bpp-anim
 Graphics set: OpenGFX (5203)
 Language:     C:\Users\Lechuza\Desktop\OpenTTD\trunk\bin\lang\english_US.lng
 Music driver: win32
 Music set:    OpenMSX (96)
 Network:      no
 Sound driver: win32
 Sound set:    OpenSFX (87)
 Video driver: win32

Fonts:
 Small:  sprite
 Medium: sprite
 Large:  sprite
 Mono:   sprite

AI Configuration (local: 0):
  0: Human
  1: TownCars (v5)
 GS: Renewed City Growth (v4)

Libraries:
 FreeType:   2.4.11
 ICU:        51.2
 LZMA:       5.0.4
 LZO:        2.06
 PNG:        1.5.14
 Zlib:       1.2.7

Module information:
 C:\Users\Lechuza\Desktop\OpenTTD\trunk\bin\openttd.exe handle: 00007FF7AF9B0000 size: 14197760 crc: EF67D210 date: 2014-11-01 21:10:24
 C:\Windows\SYSTEM32\ntdll.dll handle: 00007FFFA4220000 size: 1710184 crc: 8D4235E8 date: 2014-08-16 04:01:48
 C:\Windows\system32\KERNEL32.DLL handle: 00007FFFA3F60000 size: 1291200 crc: 3D24F3D5 date: 2014-04-17 21:01:51
 C:\Windows\system32\KERNELBASE.dll handle: 00007FFFA1670000 size: 1112512 crc: 84AF4E13 date: 2014-08-16 03:58:45
 C:\Windows\SYSTEM32\WINMM.dll handle: 00007FFF9DA90000 size: 123920 crc: 3175EE4A date: 2014-03-25 02:27:40
 C:\Windows\system32\WS2_32.dll handle: 00007FFFA3C80000 size: 355872 crc: 31116A8F date: 2013-08-22 13:25:35
 C:\Windows\system32\IMM32.dll handle: 00007FFFA3F20000 size: 209160 crc: 20AC617D date: 2014-03-18 10:14:45
 C:\Windows\system32\USER32.dll handle: 00007FFFA3DA0000 size: 1519488 crc: E0993201 date: 2014-07-24 15:23:21
 C:\Windows\system32\GDI32.dll handle: 00007FFFA3AD0000 size: 1336624 crc: FF0BFC95 date: 2014-08-07 02:12:27
 C:\Windows\system32\ADVAPI32.dll handle: 00007FFFA40A0000 size: 669896 crc: 54F72422 date: 2014-03-18 10:15:09
 C:\Windows\system32\SHELL32.dll handle: 00007FFFA2070000 size: 21195616 crc: 0E49F3D7 date: 2014-08-16 04:08:41
 C:\Windows\SYSTEM32\WINMMBASE.dll handle: 00007FFF9DA10000 size: 160600 crc: FEA6053C date: 2014-03-25 02:27:40
 C:\Windows\system32\msvcrt.dll handle: 00007FFFA3880000 size: 674616 crc: 65BAD3E7 date: 2013-08-22 13:25:40
 C:\Windows\system32\NSI.dll handle: 00007FFFA3480000 size: 24832 crc: 9523D5B7 date: 2013-08-22 13:25:35
 C:\Windows\system32\RPCRT4.dll handle: 00007FFFA3740000 size: 1273184 crc: DCB3DAB2 date: 2014-06-20 01:48:19
 C:\Windows\system32\MSCTF.dll handle: 00007FFFA1B70000 size: 1290688 crc: 094487B7 date: 2014-03-18 10:14:45
 C:\Windows\SYSTEM32\sechost.dll handle: 00007FFFA3C20000 size: 356856 crc: 2D76F957 date: 2013-08-22 13:25:35
 C:\Windows\SYSTEM32\combase.dll handle: 00007FFFA1E90000 size: 1927600 crc: B61BF98A date: 2014-03-18 10:14:12
 C:\Windows\system32\SHLWAPI.dll handle: 00007FFFA1E30000 size: 324352 crc: 35EB9619 date: 2013-08-22 12:39:57
 C:\Windows\SYSTEM32\cfgmgr32.dll handle: 00007FFFA1780000 size: 304168 crc: 1AC193E3 date: 2013-08-22 12:45:59
 C:\Windows\SYSTEM32\DEVOBJ.dll handle: 00007FFFA0420000 size: 150296 crc: C8521D2B date: 2013-08-22 12:45:59
 C:\Windows\SYSTEM32\SHCORE.dll handle: 00007FFFA0110000 size: 645592 crc: 7E1775B7 date: 2014-07-24 15:20:37
 C:\Windows\system32\uxtheme.dll handle: 00007FFFA02A0000 size: 1163264 crc: CDE49781 date: 2014-03-18 10:14:37
 C:\Windows\system32\dwmapi.dll handle: 00007FFF9FA10000 size: 125472 crc: 1487085B date: 2014-07-24 15:23:21
 C:\Windows\system32\ole32.dll handle: 00007FFFA1CB0000 size: 1542768 crc: 6CB7F719 date: 2014-04-17 21:01:51
 C:\Windows\SYSTEM32\kernel.appcore.dll handle: 00007FFFA0490000 size: 32040 crc: 4D507A8C date: 2013-08-22 12:45:58
 C:\Windows\SYSTEM32\CRYPTBASE.dll handle: 00007FFFA14E0000 size: 30504 crc: 1976C4E7 date: 2013-08-22 13:25:35
 C:\Windows\SYSTEM32\bcryptPrimitives.dll handle: 00007FFFA1480000 size: 387896 crc: 7AD124B9 date: 2014-05-10 10:12:53
 C:\Windows\system32\mswsock.dll handle: 00007FFFA0E50000 size: 338432 crc: E26147F8 date: 2013-08-22 10:05:19
 C:\Windows\SYSTEM32\MMDevAPI.DLL handle: 00007FFF9D780000 size: 391008 crc: 6ADFFE57 date: 2014-03-18 10:14:21
 C:\Windows\SYSTEM32\wdmaud.drv handle: 00007FFF9D5B0000 size: 217600 crc: 50D99CE1 date: 2013-08-22 09:37:34
 C:\Windows\SYSTEM32\ksuser.dll handle: 00007FFF9C0A0000 size: 22240 crc: FC24BB6C date: 2013-08-22 12:32:40
 C:\Windows\SYSTEM32\AVRT.dll handle: 00007FFF9F860000 size: 35144 crc: 48AF2A50 date: 2013-08-22 12:36:49
 C:\Windows\SYSTEM32\AUDIOSES.DLL handle: 00007FFF8E410000 size: 467496 crc: AD4CC694 date: 2014-04-06 16:20:54
 C:\Windows\system32\OLEAUT32.dll handle: 00007FFFA4160000 size: 745328 crc: 95DE2757 date: 2014-03-18 10:14:12
 C:\Windows\SYSTEM32\powrprof.dll handle: 00007FFFA1000000 size: 275312 crc: 8D827151 date: 2014-03-18 10:14:12
 C:\Windows\SYSTEM32\msacm32.drv handle: 00007FFF9F1E0000 size: 25088 crc: 8D6B6B43 date: 2013-08-22 11:25:37
 C:\Windows\SYSTEM32\MSACM32.dll handle: 00007FFF9D590000 size: 104328 crc: 03653452 date: 2013-08-22 12:32:46
 C:\Windows\SYSTEM32\midimap.dll handle: 00007FFF9D580000 size: 23552 crc: 6B108078 date: 2013-08-22 11:32:41
 C:\Windows\system32\psapi.dll handle: 00007FFFA3710000 size: 17592 crc: F98A9B09 date: 2013-08-22 12:46:02

---- gamelog start ----
Tick 0: new game started
Revision text changed to r27051M, savegame version 200, modified, _openttd_newgrf_version = 0x150069ab
New game mode: 1 landscape: 1
Added NewGRF: GRF ID 4D470305, checksum 2E96B9AB2BEA686BFF94961AD433A701, filename: basecosts-5.0\basecosts.grf (md5sum matches)
Added NewGRF: GRF ID FBFB0301, checksum D961A46B2CC37A04CD4FCBEDD2311A53, filename: foobars_tram_tracks-1.0.1\foobarstramtracks.grf (md5sum matches)
Added NewGRF: GRF ID 05102002, checksum A8B77B8D1F20D43B6FA521B4C3A8FC50, filename: monolev_replacement_set_v0.3.6-0.3.7\mrsv037.grf (md5sum matches)
Added NewGRF: GRF ID 4D4D9910, checksum 3CD3F4D0D98DDC0DB08E9AD74B88A9E2, filename: the_lighthouse_set-1.2\the_lighthouse_set_v1.2.grf (md5sum matches)
Added NewGRF: GRF ID 504A0103, checksum F4056FECA93218E2B1FC015B0C7844A2, filename: isrstyle_dock-1.3\isrdock_v1_3.grf (md5sum matches)
Added NewGRF: GRF ID 504A0013, checksum E2FB4F9E66207F8016B7303323FDD00C, filename: isrdwestyle_objects-1.0\isrdwe_objects_v1_0.grf (md5sum matches)
Added NewGRF: GRF ID 4E4D4C00, checksum 493A92DFCBE83CDC6331F6E4DA0290F6, filename: world_cities-1.0\world_cities.grf (md5sum matches)
Added NewGRF: GRF ID 48530101, checksum EC17E22A38C037D156BD22A96F4A8523, filename: reduced_passenger_payment.1.0\reducedpassengerpayment.grf (md5sum matches)
Added NewGRF: GRF ID 43485053, checksum 68B7DC640138E4F4B712F3CFB88167D6, filename: chips_station_set-1.4.0\chips.grf (md5sum matches)
Added NewGRF: GRF ID 1560B248, checksum 76BE5A3BA8C66817C14CFA05177D20D9, filename: redfish-0.4\redfish.grf (md5sum matches)
Added NewGRF: GRF ID 45520400, checksum 1D00426064137AA49B6FC4F4BCFF173F, filename: brickfreight\brickfreightw.GRF (md5sum matches)
Added NewGRF: GRF ID 4D480201, checksum 9E914C31E5FC7FC3F686D009BD55F331, filename: alexandra_palace-1.0.0\alexandrapalace.grf (md5sum matches)
Added NewGRF: GRF ID 4A430001, checksum 4CF50E2A770F6672A77A8842A3129ECA, filename: british_stations_set-0.0.4final\dstatsw.grf (md5sum matches)
Added NewGRF: GRF ID 44440502, checksum 9B2267C916691C45A2C85BE1FF54F7C3, filename: combined_american_signal_set.1.1\ussigzw.grf (md5sum matches)
Added NewGRF: GRF ID 46520107, checksum FC0469A7B5D9267EED4CCAC17F56019E, filename: fontrenew_ttdur-1.0\fontreneww.grf (md5sum matches)
Added NewGRF: GRF ID 58534602, checksum 181DF5910D8F6B29E3D2940DEDE43042, filename: found\found.grf (md5sum matches)
Added NewGRF: GRF ID 504E0002, checksum 6E6944E09CE6C3AC130DF72C542EE4B1, filename: generic_buffers.0.1\buffers.grf (md5sum matches)
Added NewGRF: GRF ID 52571208, checksum DC83DAB2933FACCB91678D4F75ABCCC6, filename: generic_cars-0.4\cars.grf (md5sum matches)
Added NewGRF: GRF ID 4A430002, checksum 658BE666D7F1EAA7D23B93BC38890D71, filename: industrial_stations_renewal-1.0.1\indstatr.grf (md5sum matches)
Added NewGRF: GRF ID 4E480201, checksum C3BB1694AAD8ABF5599AADB352BEE2B1, filename: nhdep\nhdepw.grf (md5sum matches)
Added NewGRF: GRF ID 43414361, checksum 4FF21D837F0C19EF91DB383B62FB3151, filename: nacity\NACityw.grf (md5sum matches)
Added NewGRF: GRF ID 4F472B34, checksum C15196D11C5461AC4733C645346BB10B, filename: opengfx_landscape-1.0.1\ogfx-landscape.grf (md5sum matches)
Added NewGRF: GRF ID 415A0301, checksum 433C292E9DE1B8F12F82D28A6A5D8592, filename: american_road_replacement_set-1.2.0\americanroads.grf (md5sum matches)
Added NewGRF: GRF ID 43415000, checksum 4DA9FE9A87DD330EBAD43916771BAF21, filename: opengfx_airports-0.4.2\ogfx-airports.grf (md5sum matches)
Added NewGRF: GRF ID 52455200, checksum 0E5A9C5ACD2BCAF7FA0658C3F905A660, filename: rural_stations-1\ae_ruraw.grf (md5sum matches)
Added NewGRF: GRF ID 54560103, checksum 381A11BC5B0F0489B410A0A3B4967844, filename: smooth_snow_transition.1.2\smoothsnoww.grf (md5sum matches)
Added NewGRF: GRF ID 52455300, checksum 37C0B839B13C4B18051580C81EEDF427, filename: suburban_stations-1\ae_subuw.grf (md5sum matches)
Added NewGRF: GRF ID 4D666F01, checksum 1C3723AAE56C6648B61BC211EA344835, filename: stolentrees\testw.grf (md5sum matches)
Added NewGRF: GRF ID 415A0501, checksum 37F4A01391FE088BD22740A89E22F78B, filename: total_bridge_renewal_set_arrs-1.0.0\total_bridges.grf (md5sum matches)
Added NewGRF: GRF ID 54520107, checksum E224CA3932045781F931DF19ADD75777, filename: transmitter_ttdur-1.0\transmitterw.grf (md5sum matches)
Added NewGRF: GRF ID 504E0001, checksum E7781323D2B0086E2E76342DAA036054, filename: uk_waypoints-1\ukwaypointsw.grf (md5sum matches)
Added NewGRF: GRF ID 54570200, checksum 3DEB9B30A6254AE8606A5A9A99A9A696, filename: us_stations_set-0.86\usstatsw.grf (md5sum matches)
Added NewGRF: GRF ID 44440A01, checksum FCEEC76CF44EC23E7FE9C88048CF11CC, filename: av8_aviators_aircraft_set-2.21\pb_av8w.grf (md5sum matches)
Added NewGRF: GRF ID 4D42000A, checksum BC3A0E791C74C1A04A3B90C3B2FA83A6, filename: bats-0.4\batsv0.4w.grf (md5sum matches)
Added NewGRF: GRF ID 52571203, checksum 7CE88A25DDB058C1BE577B88D049B274, filename: egrvts2-188\egrvts2.grf (md5sum matches)
Added NewGRF: GRF ID 44442303, checksum 90300B85C4DE1DD192691827B054522D, filename: uk_railway_set_tracks-2.0\pb_trax.grf (md5sum matches)
Added NewGRF: GRF ID 2D480107, checksum D12D0DF9F96AFFB4122E32D0C5D12D63, filename: main_hq_ttdur-1.0\mainhqw.grf (md5sum matches)
Added NewGRF: GRF ID 4642FB21, checksum 117F6F1F07C18A9C15ADC6127AFBAE97, filename: modern_tram_set-3.1\motraset_r3.1.grf (md5sum matches)
Added NewGRF: GRF ID 44440302, checksum 439275017478C2E5E7AA25F5E191903D, filename: north_american_renewal_set.2_03\nars2w.grf (md5sum matches)
Added NewGRF: GRF ID 4E415256, checksum ABC1F6EB17576182AEC8863E751DF6D5, filename: north_american_road_vehicle_set-0.1.2\narvs.grf (md5sum matches)
Added NewGRF: GRF ID 44441000, checksum DA36131A815D2D5FC158C7A27D67B5AF, filename: ukrs2__the_uk_railway_set-1.05\proj1000.grf (md5sum matches)
Added NewGRF: GRF ID 44441001, checksum 83915879F68DD174C953868C0629A4C9, filename: ukrs2_uk_railway_addon_set-gobi\pj1kadd.grf (md5sum matches)
Added NewGRF: GRF ID 27711003, checksum 30EF819C36EA5E003976E26A8A25CF71, filename: 2cc_trainset-2.0.0beta5\2cctrainset.grf (md5sum matches)
Added NewGRF: GRF ID F1250005, checksum FA6ED75EAF01CEC721CBEE2EA16D49F6, filename: firs\firs.grf (md5sum matches)
Added NewGRF: GRF ID 4A44FAB1, checksum 63A57EAF610A482C8A1C248E7E87EB4E, filename: NewCC_beta\newcc_beta.grf (md5sum matches)
---- gamelog end ----

*** End of OpenTTD Crash Report ***

Decoded stack trace:
[00] KERNELBASE           0x00007FFFA167606C RaiseException + 108
[01] openttd              0x00007FF7AFD914B7 raise + 475 (f:\dd\vctools\crt_bld\self_64_amd64\crt\src\winsig.c:586)
[02] openttd              0x00007FF7AFD90A24 abort + 24 (f:\dd\vctools\crt_bld\self_64_amd64\crt\src\abort.c:82)
[03] openttd              0x00007FF7AFA119CB error + 119 (c:\users\lechuza\desktop\openttd\trunk\src\openttd.cpp:123)
[04] openttd              0x00007FF7AFA4CCEA Scrollbar::SetPosition + 126 (c:\users\lechuza\desktop\openttd\trunk\src\widget_type.h:704)
[05] openttd              0x00007FF7AFA628F0 BuildVehicleWindow::OnKeyPress + 304 (c:\users\lechuza\desktop\openttd\trunk\src\build_vehicle_gui.cpp:1348)
[06] openttd              0x00007FF7AFA568E9 HandleKeypress + 245 (c:\users\lechuza\desktop\openttd\trunk\src\window.cpp:2588)
[07] openttd              0x00007FF7AFCA3C4C WndProcGdi + 1016 (c:\users\lechuza\desktop\openttd\trunk\src\video\win32_v.cpp:855)
[08] USER32               0x00007FFFA3DA2434 DispatchMessageW + 340
[09] USER32               0x00007FFFA3DA2297 IsThreadDesktopComposited + 503
[10] openttd              0x00007FF7AFCA47C2 VideoDriver_Win32::MainLoop + 366 (c:\users\lechuza\desktop\openttd\trunk\src\video\win32_v.cpp:1239)
[11] openttd              0x00007FF7AFA13BB8 openttd_main + 3788 (c:\users\lechuza\desktop\openttd\trunk\src\openttd.cpp:865)
[12] openttd              0x00007FF7AFCA707C WinMain + 312 (c:\users\lechuza\desktop\openttd\trunk\src\os\windows\win32.cpp:457)
[13] openttd              0x00007FF7AFD930BC __tmainCRTStartup + 328 (f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c:238)
[14] KERNEL32             0x00007FFFA3F616AD BaseThreadInitThunk + 13
[15] ntdll                0x00007FFFA4274409 RtlUserThreadStart + 29

*** End of additional info ***
Screenshot: https://dl.dropboxusercontent.com/u/241 ... enshot.png


Hope that helps! Will try again when you resolve the issue and let you know :)
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [patch] Allow use cursor keys to move in lists

Post by FooBar »

Reading this I wonder what happens if you have multiple lists open. OpenTTD doesn't have a concept of active windows, at least not in a way that the user is made aware of.
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: [patch] Allow use cursor keys to move in lists

Post by oberhümer »

Nice idea, what about making it work with scrollwheels too?
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
Eddy Arfik
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 09 Apr 2014 11:10

Re: [patch] Allow use cursor keys to move in lists

Post by Eddy Arfik »

Scrollwheels already work in lists, at least they do running under Windows
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: [patch] Allow use cursor keys to move in lists

Post by oberhümer »

Indeed. Maybe I should play more often...
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
Lechuza
Engineer
Engineer
Posts: 16
Joined: 30 Oct 2014 01:33

Re: [patch] Allow use cursor keys to move in lists

Post by Lechuza »

FooBar wrote:Reading this I wonder what happens if you have multiple lists open. OpenTTD doesn't have a concept of active windows, at least not in a way that the user is made aware of.
It looks to be working perfectly with multiple lists opened, even though there isn't a visual indication of the active window, it recognizes the last one clicked.

For now I just encountered that one bug mentioned above. Which also happens if you do the steps I mentioned in reverse, so instead of scrolling down with the cursor keys you scroll up, the index seems to be getting a value that is not >= 0.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [patch] Allow use cursor keys to move in lists

Post by Zuu »

FooBar wrote:Reading this I wonder what happens if you have multiple lists open. OpenTTD doesn't have a concept of active windows, at least not in a way that the user is made aware of.
OpenTTD do have a focused window. And each window also has a focused widget. This was added so that we can have multiple edit boxes on the screen at the same time. Later we also got rid of the limit of only one edit box per window. See for example the muliplayer servers window where there is both a filter for server names and an edit box for player name.

That said, apart from edit boxes, there is not much clue on what window/widget has focus. There is also no complete keyboard support for dealing with widget focus. Eg. like you can use a combination of TAB and arrow keys in Windows programs to jump between widgets within the same window and Alt+Tab to switch windows.

So this patch could use focused window or also widget to decide which list to scroll. But you will need to use the mouse to change focus. On the other hand new windows generally gain focus, so if you use a hotkey to open a window, that window will have focus.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 28 guests