About displaying a value of a field in a form.

33 views
Skip to first unread message

Antonio F.S.

unread,
Jul 30, 2022, 6:38:34 PM7/30/22
to The Ring Programming Language

Hello.

What should I put in line 8 to get the value of the capo instead of the message "pobject: [This Attribute Contains A List]"?

Best regards.
Antonio F.S.

Ilir

unread,
Jul 31, 2022, 5:49:00 AM7/31/22
to The Ring Programming Language
Hello,

you can use ? attributes(olr3.entrada1) to find out that object behind entrada1 have only one attribute: pObject like you have already seen.
Here p in pObject stands for pointer (which is a list of 3 elements) to object as you can see by looking at libraries/guilib/classes/ring_qt.ring.
Reason why is like that is: performance. Objects in Ring are just lists, and attributes are variables (each variable is a list of 5 elements).
That makes difficult to map each attribute to external objects/structure fields, easier (faster) is to map whole structure via pointer).

This will be addressed in one of the future Ring2 series.

Antonio F.S.

unread,
Jul 31, 2022, 5:58:30 AM7/31/22
to ring...@googlegroups.com

Good morning.

I am a newbie in Ring, but also POO so, all this is complicated to understand without a good documentation that details everything very well with examples, about it. In any case I have put the suggestion of your explanation and the result is the following:



Thank you.
Best regards.
Antonio F.S.

------------------------------------------------

El 31/7/22 a las 11:48, Ilir escribió:
--

---
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 on the web visit https://groups.google.com/d/msgid/ring-lang/eaba3446-09d6-4d31-bcb2-677ee2273b0dn%40googlegroups.com.

Antonio F.S.

unread,
Jul 31, 2022, 6:26:46 AM7/31/22
to ring...@googlegroups.com

El 31/7/22 a las 11:58, Antonio F.S. escribió:

Ilir

unread,
Jul 31, 2022, 6:33:35 AM7/31/22
to The Ring Programming Language
Hello,

if in your first example ? olr3.entrada1 showed result, then ? attributes(olr3.entrada1) should show result too, but cleaner.

This is what I tried n your style based on sample from Al (because I don't have your complete source code)

load "bookslibraryController.ring"

import System.GUI

olr3 = new bookslibraryView

new Entradas { comprobacion() }

class Entradas
    func comprobacion()
        ? attributes(olr3.button1)

That works showing

pobject

But your app should look like

load "bookslibraryView.ring"

import System.GUI

if IsMainSourceFile() {

   new App {

       StyleFusionblack()

       openWindow(:bookslibraryController)

       exec()

   }

}

class bookslibraryController from windowsControllerParent

    oView = new bookslibraryView
    see attributes(oView.button1)


Check sample from Al or any other sample using MVC.

Antonio F.S.

unread,
Jul 31, 2022, 6:38:25 AM7/31/22
to ring...@googlegroups.com

Hello,

These are tests I'm doing with Ring. Here are the sources.

Thank you.
Antonio F.S.

----------------------------------------------

El 31/7/22 a las 12:33, Ilir escribió:
TestsRing.zip

Ilir

unread,
Jul 31, 2022, 6:53:33 AM7/31/22
to The Ring Programming Language
Hello,

you made mistakes, having wrong name of the variable, tying to call object as method, etc.

The solution is what I told in my previous post

load "Ventana1RingView.ring"

olr3 = new Ventana1RingView


new Entradas { comprobacion() }

class Entradas
    func comprobacion()
        ? attributes(olr3.entrada1)
    endfunc
endclass

However, your app should start from Ventana1RingController, not DesdeElControladorEntradas.

Check any MVC sample (in Ring of course).

Antonio F.S.

unread,
Jul 31, 2022, 8:25:06 AM7/31/22
to ring...@googlegroups.com
Hello.

All my professional life programming procedurally, mainly with Fortran,
and I see that this OOP thing (although I did a little course some time
ago), I find it difficult to integrate it. :-) :-)

Thank you very much for the contribution.

Best regards.
Antonio F.S.

-------------------------------------------------

El 31/7/22 a las 12:53, Ilir escribió:

Antonio F.S.

unread,
Jul 31, 2022, 9:14:01 AM7/31/22
to ring...@googlegroups.com
Hello.

In any case, I don't think there are as many errors as it seems, as the
philosophy is correctly stated. That is to say, from the automatism of
the form designer in which the two files view and controller are
created, I make a call from the former to a function of the latter and,
from the latter, I branch the flow of the programme to the different
classes I consider. The problem is how to know how to visualise the
value of what is introduced on the screen, and this is not done because
we do not know how to apply the corresponding sentence from the ' Inputs
' class.
As you can see in the video (I have only attached the link), what I have
programmed may be more or less crude, but it works.

https://drive.google.com/file/d/1v54DJPcbkPIr844zQh04hJdrxHWMOXan/view?usp=sharing

Best regards.
Antonio F.S.
-------------------------------------------------------------

El 31/7/22 a las 14:25, Antonio F.S. escribió:

Ilir

unread,
Jul 31, 2022, 9:59:52 AM7/31/22
to The Ring Programming Language
Hello,

I see.

You can do following (see attachment). 
TestsRing.zip

Antonio F.S.

unread,
Jul 31, 2022, 2:50:34 PM7/31/22
to ring...@googlegroups.com

Hello,

First of all, thank you very much for your cooperation. :-)

As you can see in the video (link attached), your solution does not work either.

https://drive.google.com/file/d/153ZNo3tDeO-nGzikzDEQHWLxf1dOWAmc/view?usp=sharing

Best regards.
Antonio F.S.

------------------------------------------------

El 31/7/22 a las 15:59, Ilir escribió:
--

---
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.

Ilir

unread,
Jul 31, 2022, 4:29:18 PM7/31/22
to The Ring Programming Language
Hello,

You're Welcome. Contrary, video shows solution working, but you haven't specified what you really want it to do.

You want to see text?

class Entradas
    func comprobacion(o)
        ? o.text()
    endfunc
endclass


class botones
    func botonPresionado(o)
        ? o.text()
    endfunc
endclass


As I told earlier, look under libraries/guilib/classes/ring_qt.ring for available methods (QLineEdit and QPushButton in this case)

Antonio F.S.

unread,
Jul 31, 2022, 5:19:53 PM7/31/22
to ring...@googlegroups.com

How right he is! :-) :-)

Me making queries, without stating what I wish to achieve. A thousand pardons.

It does indeed "work" now, or rather, it does what I wanted it to do. :-) :-)

I'm so used to manuals, that going directly to the programs to see what the code does, I hardly ever contemplate it: and I must do it!

I'm going to study your corrections to my code to make it as clear as possible.

Best regards and thank you very much.

Antonio F.S.

------------------------------------------------

El 31/7/22 a las 22:29, Ilir escribió:
Reply all
Reply to author
Forward
0 new messages