Notifications
Clear all

[Closed] Combo Box Selection Issue

Below is some code which runs fine at every situation (Selecting Combo Box) except one.

I鈥檓 working on an automated script for playblast/preview function.

The problem with this code is that it selects and sets the Rendering Level Combo Box to 鈥淪haded鈥?but when I create the preview, the avi is not in shaded.

Strangely, if I change my Display Driver from Nitrous to Direct3D, the code works!

But I need to do everything in Nitrous Mode only so, please assist me.


struct setSFStr
(
fn getButtonHwnd hnd cbn:"Visual Style" = 
(
for i in (windows.getChildrenHWND hnd) where matchPattern i[5] pattern:cbn do return i[1]
0
),
fn sfTurnOn = 
(
local hnd = dialogmonitorops.getwindowhandle()
hwnd1 = setSFStr.getButtonHwnd hnd
hwnd2 = UIAccessor.GetNextWindow hwnd1
hwnd3 = UIAccessor.GetNextWindow hwnd2
 
WM_COMMAND = 0x111 -- Windows Message: Command
CB_SETCURSEL = 0x014E -- ComboBox message: Set current selection
CBN_SELENDOK = 9 -- ComboBox notification: Selection ended, OK
my_id = UIAccessor.getWindowResourceID hwnd3
 
windows.sendMessage hwnd3 CB_SETCURSEL 1 0
format ">>>>>>> %
" (UIAccessor.GetWindowText hwnd3) 
windows.sendMessage hnd WM_COMMAND ((bit.shift CBN_SELENDOK 16) + my_id) hwnd3
 
uiaccessor.pressbuttonbyname hnd "Create"
true
),
 
fn setSF state =
(
DialogMonitorOPS.unRegisterNotification id:#useSF
DialogMonitorOPS.enabled = off
DialogMonitorOPS.enabled = on 
DialogMonitorOPS.RegisterNotification (setSFStr.sfTurnOn) id:#useSF
max preview
DialogMonitorOPS.unRegisterNotification id:#useSF
DialogMonitorOPS.enabled = off
)
)
setSFStr.setSF on

3 Replies
 lo1

Use CBN_SELCHANGE = 1 instead of CBN_SELENDOK = 9.

we don鈥檛 actually need to send a notification message to the parent window to notify a selection change. we can simply send a key press message to the combo-box the same way as we do it for spinner:


 WM_CHAR = 0x0102
 VK_RETURN = 0x000D
 windows.sendmessage hwnd WM_CHAR VK_RETURN 0
 
1 Reply
(@coolankur49)
Joined: 11 months ago

Posts: 0

Fully agree!! Even the 鈥渨indows.sendMessage hwnd CB_SETCURSEL 1 0鈥?line is sufficient to do the selection, as per my tests. But in the Make Preview Dialog (with Nitrous GFX), it was not working. So finally I had to asked the experts!!

That worked.!!! Thanks lo鈥?