Notifications
Clear all

[Closed] Selection Region

 MZ1

How we can get currently Selection Region mode?

18 Replies
 lo1
getRenderType() == #selected

are you asking about selection type (#window|#crossing|#leftToRight|#rightToLeft)?
it sounds silly but there is no way to get selection type (via sdk as well) without some ui reading hack.

2 Replies
(@spacefrog)
Joined: 11 months ago

Posts: 0
(@denist)
Joined: 11 months ago

Posts: 0

my bad. maybe forgot… maybe missed.

 MZ1

My question was about “Selection Region types” (Rectangular, Circular, Fence,…).

2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

the same sh*t. at least i don’t know a way to get it without a ui hack.

 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

:argh: , Lets do it with hack. I guess its handler is 132604P, But i don’t know how we can send a message to get its state.

fn PrintData Hwnd =
(
format “Dialog Window Handle: %
” Hwnd
format “Dialog Name: %
” (UIAccessor.GetWindowText Hwnd)
format “Window Class Name: %
” (UIAccessor.GetWindowClassName Hwnd)
format “Window Resource ID: %
” (UIAccessor.GetWindowResourceID Hwnd)
format “Is Window: %
” (UIAccessor.isWindow Hwnd)
format “Window DLL Filename: %
” (UIAccessor.GetWindowDllFileName Hwnd)
format “Window DLL Description: %
” (UIAccessor.GetWindowDllDescription Hwnd)
format “Window Parent: %
” (UIAccessor.GetWindowText (UIAccessor.GetParentWindow Hwnd))
format “=====================

)

clearlistener()

for d in (UIAccessor.GetChildWindows (windows.getMAXHWND())) where (UIAccessor.GetWindowText d) == “Main Toolbar” do
(
for dd in (UIAccessor.GetChildWindows d) where dd == 132604P do
(
PrintData dd
–UIAccessor.closedialog dd
)
)

For the selection mode ( fence, box , etc ) there is

max cycle select

and you can set to specific modes by the corresponding user actions

actionMan.executeAction 0 "59232"  -- Selection: Rectangular Selection Region
actionMan.executeAction 0 "59233"  -- Selection: Circular Selection Region
actionMan.executeAction 0 "59234"  -- Selection: Fence Selection Region
actionMan.executeAction 0 "59235"  -- Selection: Lasso Selection Region
actionMan.executeAction 0 "59236"  -- Selection: Paint Selection Region

So depending on your needs this might help you achieving the things you want to do

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

I know how to SET, my question was how we can GET?

there is no probably state for this button… the state is something internal. but as you know id (hwnd) of control you probably can get an icon id. the id has to correspond to selection mode.
it’s a theory only. that’s what i would try

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

it seems icons wouldn’t change, All icons are arranged in one image and this image moves depend on button’s mode.(I guess)

do you have spy++? try…
if spy can see any difference (resource id for example) theoretically we can see it too

btw. why do you need to know the mode?

1 Reply
 MZ1
(@mz1)
Joined: 11 months ago

Posts: 0

Actually I don’t have any hack experiences, but I will try the spy++. I just recreated some tools and buttons (including this option) from main toolbar, and i need to update them both (old and new toolbars).

if you know the HWND you should be able to do the following in the SDK

ICustButton* selectmodeflyoff = GetICustButton(theHWND); 
 int mode = selectmodeflyoff->GetCurFlyOff ();
 ReleaseICustButton(selectmodeflyoff); 

this works

def_visible_primitive(getFlyOffState, "getFlyOffState");
  
  Value* getFlyOffState_cf(Value **arg_list, int count)
  {
  	check_arg_count(getFlyOffState, 1, count);
  
  	ICustButton* flyoff = GetICustButton((HWND)arg_list[0]->to_int()); 
  	if(flyoff)
  	{
  		int mode = flyoff->GetCurFlyOff ();
  		ReleaseICustButton(flyoff); 
  		return Integer::intern(mode);
  	}
  	return &undefined;
  }

you can then call from mxs with the lovely and elegant

getFlyOffState ((windows.getChildrenHWND (windows.getChildHWND #max "Main Toolbar")[1] )[10])[1]
 MZ1

, Thank You! I will try it…

Page 1 / 2