Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

OI crash when click -> destroy newly created buttons within an SRP panel

Hi team

Thanks for the latest update. I'm not sure if I've got the intended download as the one I have from that link still says version 3.0.5?

I can see that something has changed, as now when I call the RemoveCtrls method and destroy the control (as per below) OI doesn't blow up which is great. However there seems to be a new bug whenever I right-click on any of these controls (it not a right click issue though, its related to the fact then when I right-click I destroy and recreate the controls again including the one I just clicked on). This recreation does work ok if its triggered from a control not within the panel (e.g. changing modules). Attached is the crash msg. If I don't DESTROY the control, then the crash doesn't happen, however the controls still appear in the panel - which doesn't seem right?

Please let me know if you need anymore info.



destroy_module_controls: existing_controls = get_property(window, var_module_ctrls$) no_of_existing_controls = fieldcount(existing_controls<item_control_pos$>, @vm) ctrls_to_remove = '' for i = 1 to no_of_existing_controls this_control = existing_controls<item_control_pos$,i> hwnd = get_property(this_control, 'HANDLE') if hwnd then ctrls_to_remove<-1> = hwnd Send_Message(ole_modulectrl_panel$, 'OLE.RemoveCtrls', hwnd) ans = Send_Message(this_control, 'QUALIFY_EVENT', 'OLE', false$) ;* de-register ole event destroyed = Utility('DESTROY', this_control) end next i return

User: Jamie Birnie

Comments

  • Hi

    I'll also mention how I CREATE the new button controls that get added to the panel

    create_module_button: * requires the following properties * new_control_name * new_control_line_counter * new_control_counter new_button_struct = module_button_base_struct; new_button_struct<1, PSPOS_X$> = offscreen_pixels$ new_button_struct<1, PSPOS_y$> = offscreen_pixels$ new_button_struct<1, PSPOS_NAME$> = new_control_name new_button_struct<1, PSPOS_WIDE$> = module_button_width$ new_button_struct<1, PSPOS_HIGH$> = module_button_height$ new_button_struct<1, PSPOS_VISIBLE$> = true$ ans = Utility('CREATE', new_button_struct) hWnd = get_property(new_control_name, 'HANDLE') if hWnd then * calculate button position module_button_base_size<1,1> = module_buffer$ ;* column pos (x) module_button_base_size<1,2> = (modules_counter * (module_button_height$ + module_buffer$)) + module_buffer$;* row pos (y) module_button_base_size<1,3> = module_button_width$ module_button_base_size<1,4> = module_button_height$ last_vertical_bottom_left_pos += module_button_height$ + module_buffer$ * ole record control info modules_counter += 1 modules_ole_ctrls<modules_counter> = hWnd:@vm:module_button_base_size modules_control_xref<item_control_pos$, modules_counter> = new_control_name modules_control_xref<entity_control_pos$, modules_counter> = this_code * setup standard look and feel, and register for events oryxole_setup_button(new_control_name, buttontype_RIBBON_lefticon$, button_rec, true$) end return followed eventually by:
    x = Send_Message(ole_module_panel$, 'OLE.AddCtrls', modules_ole_ctrls) User: Jamie Birnie
  • Hi all,

    Overnight I thought about this, I really don't need to destroy and recreate the buttons in this scenario.

    The use-case is that a user right-clicks on a module button (in the main panel, to the right of "Security"), this either makes it a Favourite or removes it as a Favourite (star in top right corner in images above). A favourite becomes part of the global Favourites list panel, and also repositions them to be at the front of the module list. So in this scenario, there will be no change to the number of controls within the panel. Hence I'll simply change the display of the existing buttons to the new order, and it shouldn't crash because its the DESTROY that seems to be doing the damage (but only when you already have focus)

    User: James Birnie
  • Yep making that change works as expected - no crashing now

    User: James Birnie
  • :-) Liking the look of that ribbonbar James
Sign In or Register to comment.