Selecting and Running QML Function Routines from a GUI

107 views
Skip to first unread message

Bert Mariani

unread,
Jan 11, 2026, 4:54:34 PMJan 11
to The Ring Programming Language
Hello ALL

I am trying to:
Select and Run QML Function Routine from a GUI
Using 2 Proven QML Fuctions for the testing

But cannot figure out the Conflicts involved.
with the "exec" etc 
Need your help. Thanks


This starter Code Works ...
    //=====================================
    // QML STUFF - Works From Here for One
   
    oQML = new RingQML(NULL)
    oQML.LoadContent(Understanding_the_Rectangle())   // <<<=== Calls Func
     
 App.exec()   // Starts the GUI

========================================
This Gives Errors when Selection a QML Routine

Func GetSamples()

    cSamples = comboSamples.currentText()
    See "cSamples: "+ cSamples +nl
   
    if cSamples = "Select"         //--- Do Nothing
        return
    ok
   
    # =========================================
    # The_Absolute_Minimum"
   
    if cSamples = "1.1: The_Absolute_Minimum"
   
        oQML = null
        oQML = new RingQML(NULL)
        oQML.LoadContent(The_Absolute_Minimum())         // <<<=== Call QML Func .  
   
    ok
      
    # =================================================
    # Understanding_the_Rectangle
       
    if cSamples = "1.2: Understanding_the_Rectangle"
   
        oQML = null
        oQML = new RingQML(NULL)
        oQML.LoadContent(Understanding_the_Rectangle()())   // <<<=== Call QML Func
       
    ok  
Return


Capture-Snap1.png
RingQML-Picker-3.ring

Mahmoud Fayed

unread,
Jan 12, 2026, 8:04:29 AMJan 12
to The Ring Programming Language
Hello Bert

I can review this after I return from vacation, when I have more time at the office.

For now, three suggestions:

(1) Generate source code file (*.ring), i.e. a complete program then run it using (ring sample.ring) through System() function
i.e. Just do what (Ring Notepad) is doing (using System() or QProcess()).

(2) Use ring_state_new()/ring_state_mainfile() instead of (System()) to run the sample file as in this example:  Embedding Ring in Ring — Ring 1.25.0 documentation
This requires to be careful about memory management and when to delete the State objects.

(3) Maybe, wait for Mohannad and RingQML updates and see if he will support running QML samples multiple times (or not).

Greetings,
Mahmoud

MOHANNAD ALDULAIMI

unread,
Jan 12, 2026, 3:44:07 PMJan 12
to The Ring Programming Language

Hello Bert, Mahmoud

I do not understand why you try to make a such application while we have this ringQML samples runner !:RingQMLSamples/samples/UsingRingQML/runSamples.ring at main · mohannad-aldulaimi/RingQMLSamples

Also using :

oQMl = new ringQML(NULL)

is serve the application for only first time , so we have a main.qml that will load, utilize other components,
so depending on this concept :

  • Ring QML loadContent is used one time only!
  • Ring QML class/object can be used as you want , so if we have application uses qquickwidget to load qml we can use ringQML in it as we want !
    so every parent of ringQML object when do : new ringQML( Parent ) expects to use loadContent one time only !

according to your code ,you can either make every sample as component using newComponent(cComponentName,cQMLCode) , and you can load it using a main qml code (using specific approach),
or simply as Mahmoud mentioned that you can easily use system(cCode) with ring files to run them …

or simply move our RingQMLSamples runner app forward and upgrade its code …

Best regards,
Mohannad Al-Ayash

Bert Mariani

unread,
Jan 13, 2026, 10:03:56 AMJan 13
to The Ring Programming Language
Hello Mahmoud, Mohannad et ALL

Using the "SYSTEM()" approach
Using the Drop Down method to select a standalone QML routines

aSamples = ["Select",
            "The_Absolute_Minimum",
            "Understanding_the_Rectangle",          
            "Anchoring_System",
...
System("ring The_Absolute_Minimum.ring")
System("ring Understanding_the_Rectangle".ring)
System("ring Anchoring_System.ring")

Problem
   - Not Able to Select another Drop Down entry ,  Until the Current sample QML routine is Closed.
  -  Also need to Create 32 Separate Routines.

Objective
    - Have 1 App with the 32 QML routines as separate callable functions
    - The QML functions will run independent of each other as they are selected from the Drop Down menu.

============================================

System-Method-Snap1.png

Bert Mariani

unread,
Jan 13, 2026, 11:27:39 AMJan 13
to The Ring Programming Language
Hello Mahmoud, Mohannad et ALL

Using this method to Call QML File App
The Drop Down selector will Work, but generate msg - The event loop is already running
Need a method to run the  QML Functions that are in the Main App.

    pState = ring_state_new()
    ring_state_mainfile(pState,"The_Absolute_Minimum.ring") // Call File app

-------------------------------------------------------------
cSamples: The_Absolute_Minimum
In APP - The_Absolute_Minimum
QCoreApplication::exec: The event loop is already running

cSamples: Understanding_the_Rectangle
In APP - Understanding_the_Rectangle
QCoreApplication::exec: The event loop is already running

cSamples: Anchoring_System
In APP - Anchoring_System
QCoreApplication::exec: The event loop is already running

===================================

Call-FileApp-1.png
RingQML-Picker-6.ring

Mahmoud Fayed

unread,
Jan 15, 2026, 7:09:08 PMJan 15
to The Ring Programming Language
Hello Bert

>> "Not Able to Select another Drop Down entry ,  Until the Current sample QML routine is Closed."

Try using (start) before the command 
Like

System("start ring The_Absolute_Minimum.ring")

>> "Also need to Create 32 Separate Routines."

You can keep them in one file which you load using the Load command by a runner file (another Ring file) that you generate based on the selected sample

Greetings,
Mahmoud

Bert Mariani

unread,
Jan 20, 2026, 10:45:10 PM (12 days ago) Jan 20
to The Ring Programming Language
Hello Mahmoud, Mohannad, Mansour et ALL

Attached
     - RingQML-Selector-GUI.ring

There are 30 Samples all in the same File
Select a Sample from the Drop Down list
Click on "Get Samples" to Create the File and Run it.

aSamples = ["Select",
            "The_Absolute_Minimum",
            "Understanding_the_Rectangle",          
            "Anchoring_System",
            "Column_Layout",
            "Row_Layout",
            "Grid_Layout",
            "Adaptive_Layout",
            "Button_with_Hover_Effect",          
            "Text_Input_Field",
            "Slider_Control",
            "Gradients",
            "Borders_and_Shadows",
            "Icons_and_Images",
            "Simple_Property_Animation",
            "Sequential_Animation",
            "Rotation_Animation",                
            "Basic_States",                      
            "Expanded_Collapsed_State",          
            "Calling_Ring_from_QML_Button",      
            "Ring_Function_with_Return_Value",    
            "Ring_Setting_QML_Properties",        
            "Complete_Ring_QML_Interaction",      
            "Property_Bindings",
            "Computed_Properties",
            "ListModel_and_Repeater",
            "Custom_Reusable_Component",          
            "Timer_and_Periodic_Updates",        
            "Drawer_Navigation_Pattern",        
            "Task_Manager_Application",          
            "Simple_Computation_Example"          
           ]
============================
NOTE: 
Import features to use
Quotes  "  '  `  are used  inside the Code 
Quote    `        is used to encapsule the Code for output
The Code is written as an Output File called  QMLScript.ring
Then runs the command to execute the File:   System("start ring QMLScript.ring")

// Start BackQuote to Create QML FILE to Execute
F2 = `
    ....
    CODE  ...
   ....
 `  // END BackQuote

    Write( "QMLScript.ring", F2 )
    See "Done Writing: "+ "QMLScript.ring" +nl
    txtLog.append("Done Writing: "+ "QMLScript.ring")
    
    System("start ring QMLScript.ring")

Capture-2-Snap1.png

RingQML-Selector-GUI.ring

Mahmoud Fayed

unread,
Jan 21, 2026, 1:05:45 AM (12 days ago) Jan 21
to The Ring Programming Language
Hello Bert

Thank you very much for sharing :D

Greetings,
Mahmoud

Mansour Ayouni

unread,
Jan 21, 2026, 3:35:39 AM (12 days ago) Jan 21
to Mahmoud Fayed, The Ring Programming Language
Hell Bert,

Thanks for sharing this.

Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/7ae70100-af8e-43b1-aaae-87a84500cb59n%40googlegroups.com.

Bert Mariani

unread,
Jan 21, 2026, 4:36:11 PM (11 days ago) Jan 21
to The Ring Programming Language
Hello ALL

See attached for Part-2 of additional QML Samples.
     RingQML-Selector-Part-2-GUI.ring

It can display Multiple QMLs output at a time. See capture

aSamples = ["Select",
"ComboBox_Dropdown_Selection",
"CheckBox_and_RadioButton",
"SpinBox_and_ProgressBar",
"TabBar_TabView_Navigation",
"TableView_with_Grid_Data",
"GridView_with_Cards",
"SwipeView_with_Pages",
"Hierarchical_Data_with_Expandable_Lists",
"Dialog_Windows",
"Popup_and_ToolTip",
"Custom_Bar_Chart_with_Canvas",
"Pie_Chart_Visualization",
"Progress_Visualizations",
"Line_Chart_with_Animation",
"Pull_to_Refresh_Pattern",
"Bottom_Sheet",
"Floating_Action_Button_with_Speed_Dial"    

======================

Cature-3-Snap1.png

======================

RingQML-Selector-Part-2-GUI.ring

Mahmoud Fayed

unread,
Jan 21, 2026, 11:13:27 PM (11 days ago) Jan 21
to The Ring Programming Language
Hello Bert

>> "See attached for Part-2 of additional QML Samples."

Thanks for sharing :D

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages