Help with SCUI Lib

Find quick help here to get you started with Hollywood
User avatar
Redlion
Posts: 96
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Help with SCUI Lib

Post by Redlion »

Hi,

I need some help to understand how to use this library.

I have had a play with the SCUI Lib but have not been able to get it to work.

I was trying to set the contents of some Labels and Stringboxes, but I just can not get it to work.

I have used this code

Code: Select all


@INCLUDE "ScuiLib.hws"

ChangeDisplaySize(800,600)
MoveDisplay(#CENTER, #CENTER)

Function PressButton() 
     set.scui("Label",{ Values = { "A Test ", " Second Line." }, Lines = 2 },1)
Endfunction

D = scui.NewObject( #IFOCLASS_BUTTON, "SimpleButton",
                     { x =  10, y = 60 }, 
                     { x = 100, y = 20 },
                     nil, 
                     { Values = { "Simple Button" }, Lines = 1 },
                     { OnPushed = PressButton })

E = scui.NewObject( #IFOCLASS_LABEL, "Label",
                    { x = 310, y = 60 }, 
                    { x = 300, y = 40 }, 
                    { Text  = { Alignment = #TEXTALIGN_HCENTER } },
                    { Values = { "A Test ", "This is ther second line." }, Lines = 2 } )

Repeat
  WaitEvent 
Forever

Can someone show me a working example, please.

Thanx.
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Help with SCUI Lib

Post by Clyde »

Hi Redlion,

there were two errors in your code.

1. It don't have to be "set.scui()" in your PressButton() function, but "scui.Set()".
2. Your set call misses some arguments, so the whole call must be

scui.Set("Label", { Text = { Content = { Values = { "A Test ", " Second Line." }, Lines = 2 } } },1)

Please pay attention to the bold marked pieces.

All in all your code have to look like this:

Code: Select all

@INCLUDE "ScuiLib.hws"

ChangeDisplaySize(800,600)
MoveDisplay(#CENTER, #CENTER)

Function PressButton()
      scui.Set("Label", { Text = { Content = { Values = { "A Test ", " Second Line." }, Lines = 2 } } }, 1)
Endfunction

D = scui.NewObject( #IFOCLASS_BUTTON, "SimpleButton",
                     { x =  10, y = 60 },
                     { x = 100, y = 20 },
                     nil,
                     { Values = { "Simple Button" }, Lines = 1 },
                     { OnPushed = PressButton })

E = scui.NewObject( #IFOCLASS_LABEL, "Label",
                    { x = 310, y = 60 },
                    { x = 300, y = 40 },
                    { Text  = { Alignment = #TEXTALIGN_HCENTER } },
                    { Values = { "A Test ", "This is ther second line." }, Lines = 2 } )

Repeat
  WaitEvent
Forever
I hope this helps!

BTW, which version of ScuiLib do you use?

Greetings!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
Redlion
Posts: 96
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Re: Help with SCUI Lib

Post by Redlion »

Hi Clyde,

Thanks for the help, the first mistake was a typo.

I am using Hollywood 4.8 with Scui 0.7. on a Sam 460EX Lite

Is there a user manual for Scui or a bunch of working examples?

Is there an editor gadget, I wanted to have a list an select one of them ( like the OWB Bookmark )

Thanks agian.

Redlion
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Help with SCUI Lib

Post by Clyde »

You are welcome, Redlion.

Well, normally the ScuiLib zip is loaded with quite a bunch of working examples. Fabio did also some manuals for some controls, but that is not completed AFAIK. But the examples should be quite good for a start.

Where exactly did you download ScuiLib. Could you provide the link? I will look, if I find the examples when I am at home.

CU,
Clyde
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
Redlion
Posts: 96
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Re: Help with SCUI Lib

Post by Redlion »

Hi Clyde,

I downloaded the lib from the link on this forum.

I have tried to understand the "manual" but I just can not seem to makeout the syntax properly. I have only just got back onto the Amiga and have just started programming in Hollywood, so it is a hard learning curve for me.

It would be much easier to learn from simple working examples of just one or two commands instead of a large complete demo of all the commands in one hit. ( Maybe an archive of worked examples for each command would be very helpful to the beginner )

Enough of my ranting, just getting to old to think new things.

Thanks again.

Redlion
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Help with SCUI Lib

Post by Clyde »

Hi Redlion,

to be honest, I have the same difficulties with ScuiLib, especially when I don't use it regularly. Another proof for that statement are the noobish questions I asked Allanon at his forum, as you may have seen. :-)

So, no worries, please feel free to ask all you want as I will learn from that, too. Maybe I can compile some small code snippets, but I can't promise that, sorry! :-/ Nevertheless, I still plan to develop some kind of Visual ScuiLib some time. I already started with that project some time ago, but didn't reach far til now. :-(

Greetings!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Help with SCUI Lib

Post by Allanon »

Hello guys and sorry for the late answer to this thread :)

Just to let you know I've started to rewrite ScuiLib completely in a more OOP with simpler syntax and much more efficiency and speed with quiet good results but actually my time is limited so I can boost the development but I hope to complete a first release before the end of the year

If you have some doubts please ask here, I will try to answer as soon as I can :)
I don't have time right now to make some tutorials but if you ask specific question I will answer with specific snippets ;)

Have you looked at the HelloWorld.hws example?
User avatar
Redlion
Posts: 96
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Re: Help with SCUI Lib

Post by Redlion »

Hi Allanon,

I have been playing with your SCUI Lib trying to generate a simple Listview Gadget, nothing fancy, but with limited success. I just wanted to be able to add data to a list and let someone select an item and depending on the item selected perform a function.

There does not seem to be any documentation for the listview gadget, so I am finding it a little hard to do.

Any help or demo code would be great :D

Regards
Redlion
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Help with SCUI Lib

Post by Clyde »

You mean something like this? This is part of my tool "Hollywood Cubic Compiler":

Code: Select all

; callback function, which evaluates, which option was chosen
Function deSelectTargetOSOpt()
    Local optswitch = scui.Get("optDeSelTargetOS") ; get the ID of the object in order to get infos about it

    if optswitch.Value[0] = 1 ; if the "select all" button is pressed
        
        ; perform task A

    ElseIf optswitch.Value[1] = 1 ; if the "deselect all" button is pressed
        
       ; perform task B

    EndIf
EndFunction

; define the object
scui.NewObject(
    #IFOCLASS_OPTIONS,
    "optDeSelTargetOS",
    { x = 9, y = 290 },
    { x = 214, y = 25 },
    nil,
    { Rows = 1,
      Columns = 2,
      Mode = #OPTMODE_ONLYONE,
      Options = { "Select all",
                  "Deselect all" },
      DefaultOptions = { }, ; nothing should be preselected
      SwitchWidth = 20,
      SwitchPosition = #OPT_LEFTSWITCH,
      SwitchMode = #OPTSWITCH_FULLWIDTH },
    { OnChanged = deSelectTargetOSOpt } ; callback!
)
I hope this helps. If you any questions ...

EDIT:

Ah, sorry, I misunderstood you. You meant a list view ... So, let's take the example of Allanon's Demo_1.hws:

1. Define the listview:

Code: Select all

scui.NewObject( #IFOCLASS_LISTVIEW, "ListView", { x = 10, y = 4 },
                                        { x = 300, y = 100 },
                                        nil,
                                        { FieldNames = { "Name", "Surname", "Age" },
                                          Sizes      = { 40, 30, 30 },
                                          Entries    = { { "Fabio",    "Falcucci", "37" },
                                                         { "Johnny",   "Mnemonic", "36" },
                                                         { "Clark",    "Kent",     "38" },
                                                         { "Peter",    "Pan",      "14" },
                                                         { "Takaya",   "Todoroky", "23" },
                                                         { "Aran",     "Benjo",    "24" },
                                                         { "Mickey",   "Mouse",    "??" },
                                                         { "Doraemon", "-",        "??" },
                                                         { "Lupin III","-",        "??" },
                                                         { "Rio",      "Saeba",    "35" }
                                                         }
                                          },
                                        { OnChanged = ButtonID } ) ; callback!!!!
2. Now define the callback before the Scui object definition:

Code: Select all

Function ButtonID(mess)
    DebugPrint("---------------------> EVENT HANDLER TEST:", mess.id, mess.event)
 
   ; to get access to the table row and its values, access the data attribute in the mess variable
   DebugPrint(mess.data[0]) ; "Fabio"; assuming, first row was clicked
   DebugPrint(mess.data[1]) ; "Falcucci"; assuming, first row was clicked
   DebugPrint(mess.data[2]) ; "37"; assuming, first row was clicked

   ; what really helps is Fabios great debugger helper! To be honest, I didn't know how to get the values, so I used this:
   DBG.Console.Enable()
   DBG.DumpTable(mess)
   DBG.Console.Disable()
   ; somewhere here in the forums there must be the helpers. I will look, if I find them. Or do you have them?
EndFunction
Regards
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
Redlion
Posts: 96
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Re: Help with SCUI Lib

Post by Redlion »

Hi Clyde,

Sorry for the late reply, family commitments.

I have tried your code but I still can not get it to work, even with the helper libs.


Regards
Redlion
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
Post Reply