Here's a simple example that might help. I put an FL_Box on the right of the menubar, but you should be able to put whatever you want.
// clang++ -Werror -Wall -Wextra -std=c++20 `fltk-config --cxxflags` -o menubartest menubartest.cpp `fltk-config --ldflags`
#include <stdio.h>
#include <string>
#include <time.h>
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Sys_Menu_Bar.H>
#include <FL/Fl_Window.H>
int main() {
int mainX = 500;
int mainY = 250;
int mainW = 700;
int mainH = 400;
Fl_Window* winMain = new Fl_Window(mainX, mainY, mainW, mainH, "Menubar Test");
winMain->color(FL_BLUE);
int winMenuH = 25;
Fl_Window* winMenu = new Fl_Window(0, 0, mainW, winMenuH, 0);
// Limit the menuBar width so something can go on its right side.
int mbW = 200;
Fl_Sys_Menu_Bar* menuBar = new Fl_Sys_Menu_Bar(0, 0, mbW, winMenuH, 0);
menuBar->box(FL_NO_BOX);
menuBar->add("Abc", 0, 0, 0, FL_SUBMENU);
menuBar->add("Abc/1", 0, 0, 0, 0);
menuBar->add("Def", 0, 0, 0, FL_SUBMENU);
menuBar->add("Def/2", 0, 0, 0, 0);
// This goes to the right of the menuBar. It could be anything,
// but this example displays the current time as the box label.
Fl_Box* status = new Fl_Box(mbW, 0, mainW - mbW, winMenuH, 0);
winMenu->end();
winMain->end();
winMain->show();
char timBuf[100];
while(winMain->visible()) {
time_t now = time(0);
strftime(timBuf, sizeof(timBuf), "%Y-%m-%d %H:%M:%S %Z %z", localtime(&now));
status->copy_label(&timBuf[0]);
Fl::wait(0.01);
}
}