Dynamic creation of toolbar with controls on main frame not showing, unless you minimize the window or open other window

I have created a sample program, in which I encountered not showing toolbar and controls inside it when created unless you open a window or minimize the main window. What should be the cause and how to resolve this. Here’s a sample video

dynbuttons.zip (726.6 KB)

Hi,

I’m not sure why it doesn’t work, if it’s a bug or some kind of expected behaviour.

A quick if dirty fix. Declare a window structure like so

simpleWindow WINDOW(),AT(,,,)
             END

And then after your code to create and unhide the toolbar, add this code

OPEN(simpleWindow)
ACCEPT
  IF EVENT() = EVENT:OpenWindow
    BREAK
  END
END
CLOSE(simpleWindow)

Note: There may be a slight flicker.

I’d be interested to see if someone knows what’s going on.

Mark

1 Like

For now, this will do, Thanks a lot, Sir Mark. :smiley:

I’m glad it will do, of course, another option, which would probably be my choice.

Add a toolbar to the frame with a hight of 0

TOOLBAR,AT(0,0,50,0),USE(?TOOLBAR1)
END

Then change your code where you currently create the toolbar to this

IF NOT ToolbarFeq
  ToolbarFeq = ?TOOLBAR1
  ToolbarFeq{PROP:Height} = 42
END

Mark

1 Like

I’ll try this and I will also try not destroying the toolbar whenever I try to refresh/update buttons

I tried not destroying the toolbar I created on run time and works the same as opening a dummy window. For now this will be a working solution. Thank you so much for helping.

1 Like