Yab(asic) for newbies

I think he means a Deskbar replicant

The system tray icons are the little icons next to the clock, which can show you some status information and offer an action menu.

In the case of the program I’d like to do, the icon could have 3 statuses: red, yellow and green, and the menu would allow the user to start each server: HTTP and MySQL (and possibly others, why not).

This is not possible with yab, sorry.

I’m not convinced that yab cannot do this. Let me play with it for a few minutes to see.

4 Likes

Since I cannot attatch a zip file here, I posted the example Deskbar tray indicator at http://yab.orgfree.com/forum/showthread.php?tid=104

4 Likes

Thanks for giving this a shot! There seemed to be an issue with the code. I got this error -> line x: syntax error at "0xff", where “x” was every line that has indentation.

I didn’t download the zip file because I don’t have an account on that forum, and it turned out that copying (select->copy) from the forum includes some weird white-space characters that yab can’t handle. I initially thought Yab-IDE has a problem with the copy/paste, but then I tried StyleEdit, Pe and even mcedit (Midnight Commaner’s text editor) in the terminal - all with the same result. Either the forum has some strange text formatting, or WebPositive does something to the text.

Curiously, though, the problem only occurred with white-space on the outside of the text on each line of code - both leading and trailing space. Yab didn’t complain about the white-space inside the lines of code, go figure.

So after I cleaned up the white-space I ran the program and without the downloaded files of course I ended up with some “No such file or directory” errors. I can test them later, if you manage to upload the files elsewhere.

In the meantime I checked the copy/paste and the reformatted files with MCs hex viewer, and this is how the white-spaces are displayed in HEX in:

  • the copy/paste file: C2 A0 (succession of these)
  • the reformatted file: 20 (one or more) - ASCII 32 (space)
  • the reformatted file: 09 (one or more) - ASCII 9 (TAB)

this is a copy paste error. The zip file has the source code and should run from there.the zip is available here: coquilletkd.com/jim/on-off.zip

1 Like

Sweet! :smiley: It works, thank you! Now I’ll have to understand what does what, then work on the program’s logic.

  1. How do I hide the window while allowing the tray icon to stay there so I can show the window again?
  2. How can I check if the window is already displayed, so I don’t display another instance of it? (as it currently does)

// Later edit

  1. After going through the whole program and understanding what it does, it’s obvious I don’t have to hide anything, but simply quit the program. The desklink (tray icon) is a standalone process, so it won’t be affected by quitting my program - unless I want to remove the desklink as well.

Although it’s a nice trick, I hoped there was a way to work with the system tray from the same program/process, so I can toggle the program’s window, and handle the tray icon in a similar way to the ProcessController deskbar item, which updates itself instead of using copyattr to change the executable’s icon. But I can work this, no problem. :smiley:

  1. There are several ways to make sure my program is active. I’ll investigate my options and come up with a solution.

Thanks again for your program! It helped a lot. :+1:

1 Like

This is expected, HTML is often formated with non-breakable spaces, because multiple “normal” spaces will just be merged together when parsing HTML. Web+ just copies the text as it is rendered.

It might be expected for WebPositive, but not from any other browser I used since 2000. I copied the same text from Chrome and Firefox under Linux and I got multiple space characters, as they should be. So Web+'s renderer is obviously wrong in converting the white-space into something else.

1 Like

Otter, Qupzilla and BeZilla all copy the text to the clipboard properly, Only WebPositive causes these issues.

2 Likes

Is this a discussion about yab or web browsers? :slight_smile:

2 Likes

While trying to crop up a small program, I run into a documentation issue. By documentation I mean the one included in the Help tab (left side of the IDE), not yabasic.html. I tried to get unstuck by exploring it a little more, without success. I know I could hunt for examples online, but you’ll understand why it was better to report the issues here.

I wanted to add some tabs in a window, so I used TABVIEW. The Help mentions this synopsis:
TABVIEW x1,y1 TO x2,y2, ID$, Option$, View$

Problem #1: the TABVIEW description doesn’t tell anything about View$, which forces you to guess what to do about this run-time error:
"viewType" is not of type VIEW

I assumed I would have to make a VIEW, as mentioned in the Help’s synopsis:
VIEW x1,y1 TO x2,y2, ID$, View$

Problem #2: The VIEW description only says “Adds a view” and leaves you guess whose ID$ is that, and what should go for View$ to stop getting the same error:
"viewType" is not of type VIEW

Knowing that the variables ending in “$” are strings, I named that parameter “viewType” - just so you know -, so the interpreter can at least see it as a string. But it clearly expects a special type of data, which I can’t find by using yab-IDE.

Of course, this raises the question: what other data and variable types are there in Yab? A page dedicated to these types would be great. But the least that is necessary is to make sure the commands’ arguments are explained well enough so we don’t get stuck like this.

The documentation is pretty big, and I’m sure it’s not easy to keep everything in order. Would it be OK to mention similar issues here? If not, where else?

TABVIEW x1,y1 TO x2,y2, ID$, Option$, View$

Opens a tabview from x1 ,y1 to x2,y2 namde ID$ with the Option$ selected on View$

screenWidth = peek(“desktopwidth”)
screenHeight = peek(“desktopheight”)
window open screenWidth/2-200, screenHeight/2-200 to screenWidth/2+200, screenHeight/2+200, “MainWindow”, “Test”
VIEW 0,0 TO 400,320, "BackgroundView","MainWindow"
TABVIEW 5,2 TO 395,300, "Test", "top", "BackgroundView"
TABVIEW ADD "Test",  "Tab1"
TABVIEW ADD "Test",  "Another tab"

This opens a Window, adds a view named “BackgroundView”, adds a tebview named “Test”, and adds two tabs, “Tab1” and “Another tab”.

To place items on “Tab1”, one would use “Test1” for the view name as it is tab 1 on the tabview named “Test.”

To place items on “Another tab”, one would use “Test2” for the view name as it is tab 2 on the tabview named “Test.”

2 Likes

Generally ID$ is the name you are giving this widget or view being created, while View$ is the name of the view or Window to place your view or widget on.

2 Likes

First you need to add tabs to the tabview:

TABVIEW x1,y1 TO x2,y2, ID$, Option$, View$

** View$ is the name of the view or window you are place the tabview on.

Generates a View for Tabs with the ID$ (internal name of the Tabview)

Then you need to add tabviews:

TABVIEW ADD ID$, “Displayed Name of View”

If you want to place anything on it you need to tell it on which tab. This is by the number you add the tabs to the tabview:

BUTTON 0,0 TO 100,20, ID$, “Displayed Name of Button”, “Tabviewname1” (ID$+“1”)

If you add more then one:

BUTTON 0,0 TO 100,20, ID$, “Displayed Name of Button”, “Tabviewname2” (ID$+“2”)

and so on

2 Likes

My current yab beginners tutorial are here:

http://old.besly.de/menu/search/archiv/dev/yab_shelltool_gui.html

Because the old one are not up to date (written long time ago):

http://old.besly.de/menu/search/archiv/dev/yab_tutorial_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_tutorial2_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_game_tutorial_eng.html

This are the main tutorials for the beginner…

http://old.besly.de/menu/search/archiv/dev/yab_ide_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_wasistwas_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_layout_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_chr_eng.html
http://old.besly.de/menu/search/archiv/dev/yab_laws.html

3 Likes

Thank you both for your replies. I’ll do more experimentation when I’ll have more time. For now I tested the tabview on top of a view, then without a view - directly on the window. Both work, but the IDE’s documentation doesn’t mention anything about their significance. I didn’t have enough time to also read the online documentation, but I will. Is there a reason to use the view between the main window and a tab view?

Anyway, I hope the IDE’s documentation will be updated to clarify these things. Is it somewhere on a git scm? I found some minor issues in various places and I could send the fixes as pull requests.

tabview set:

  • “Synopsys” (mistyped)
  • Related: tabview tabview add, tasbview get (plus missing comma after the first tabview)

tabview get: also missing a comma after the first tabview

I does not clearly understand what you mean. The window is a view himself, if you place a view on it you know its name id$. If you place a tabview on it, you use it already :).

@bbjimmy gave me this example: window -> view -> tabview. So I asked because the documentation doesn’t make it clear what is necessary for a tabview, and what’s the role of views.