GithubHelp home page GithubHelp logo

Tab order about finalcut HOT 2 CLOSED

wimstockman avatar wimstockman commented on August 17, 2024
Tab order

from finalcut.

Comments (2)

wimstockman avatar wimstockman commented on August 17, 2024 1

Hi gansm,

Thanks for this example. Just what I needed.

from finalcut.

gansm avatar gansm commented on August 17, 2024

Hi Wim, it's generally intended that the child adding order determines the tab order. But you can change the order afterward (for example, by sorting the children's list).

#include <final/final.h>

using namespace finalcut;

int main (int argc, char* argv[])
{
  FApplication app(argc, argv);

  // The dialog window
  FDialog dialog("The window title", &app);
  dialog.setGeometry (FPoint{20, 5}, FSize{40, 12});

  // The child objects from dialog
  FButton child4("&4", &dialog);  // 1st child
  FButton child1("&1", &dialog);  // 2nd child
  FButton child3("&3", &dialog);  // 3rd child
  FButton child2("&2", &dialog);  // 4th child
  child1.setGeometry(FPoint{6, 2}, FSize{28, 1});
  child2.setGeometry(FPoint{6, 4}, FSize{28, 1});
  child3.setGeometry(FPoint{6, 6}, FSize{28, 1});
  child4.setGeometry(FPoint{6, 8}, FSize{28, 1});

  // Sort by button name to change the initial tab order of the widgets
  std::sort ( dialog.begin()
            , dialog.end()
            , [] (const auto lhs, const auto rhs)
              {
                // Skip non-button widgets
                if ( ! lhs->isInstanceOf("FButton")
                  || ! rhs->isInstanceOf("FButton") )
                  return false;

                const auto& lhs_btn = static_cast<FButton*>(lhs);
                const auto& rhs_btn = static_cast<FButton*>(rhs);
                return lhs_btn->getText() < rhs_btn->getText();
              } );

  FWidget::setMainWidget(&dialog);
  dialog.show();
  return app.exec();
}

grafik

from finalcut.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.