Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Support

Pages: 1 ... 23 24 [25] 26 27 ... 59
361
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 23, 2013, 05:23:34 PM »
Quote
Did you ever make a iup package for Linux32bit? Everything here iup looks to be for Linux64bit.

ALL posted ScriptBasic 2.2 releases include the IUP extension module.

Based on the message returned with the scriba -d trying to load IUP, your Gtk2 is out of date. (guess) I sent Antonio (IUP author) an e-mail asking about Gtk2 version requirements.


362
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 23, 2013, 11:12:45 AM »
Quote
Ver 14.14 Distrib 5.1.66, for debian-linux-gnu (i486) using readline 6.1

Info returned from running the testmysql.sb example.

Client info is: 6.0.0
Server info is: 5.5.28

I would say that the SB 2.2 current driver interface isn't happy with your older version of MySQL server. If the 2.1 version of the SB mysql.so works for you and it's less painful than upgrading your server, nothing other than updating the library to the latest version was done to the extension module for 2.2.


363
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 23, 2013, 09:43:27 AM »
ScriptBasic 2.2 runs on Ubuntu 12.04 LTS 32  and 64 bit versions with 3rd party extension modules updated to current levels. That said, lets find out why your version of Linux is having issues with the current SB Ubuntu version. I would like to get the MySQL problem solved first then we can move on to IUP.

Q. Does the SB 2.1 version of the MySQL interface work on your box?

Q. What version of MySQL server are you running?

Q. What is your Linux kernel version?

Q. Does the console version of the MySQL client work?




364
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 22, 2013, 11:25:45 PM »
Looks like the MySQL client can't find a MySQL server to connect to. Do you have MySQL server installed or can you change the script to point to one?

Are you sure you have the SB iup.so (extension module) with the others and the iup.bas with the other SB includes?

Having two shared objects with the same name caused problems under Windows so that is why the DLL is named pui.dll. I haven't had the same issue with Linux. (yet)


365
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 22, 2013, 06:50:11 PM »
Quote
scriba sbiupdict.sb
The requested module can not be loaded.

Just tested this again with no issues.  ???

Quote
scriba testmysql.sb
The requested module can not be loaded.

Try a scriba -d testmysql.sb and see if it gives you anymore info why the module isn't loading.

Quote
scriba testodbc.sb
Extension specific error.

Have you done your odbcinst -c to create your user/system DSN? Did you download the ODBC driver for the DB you're trying to access?

Quote
I have installed the dependencies. The other test programs are working.

Does this mean the other IUP examples work? (SBx_bunttons & SBx_dict.sb)


366
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 22, 2013, 04:12:18 PM »
What is the error you are getting?

367
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 22, 2013, 09:34:17 AM »
Ron,

Works fine on my Ubuntu 12.04 LTS 32 bit system. (VirtualBox)

Do you have a libiup.so in your /usr/lib directory? (put there by the IUP install script)

What version of Gtk are you using? (2 or 3)

John

368
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 21, 2013, 10:06:03 PM »
Quote
I removed the ' and made the change as you suggested.

The second (near the end) sort that was remarked out is an extra step to output a word list by rank. The one I posted is the only change needed if you don't want the rank list.

Quote
My main use of SB has been mostly sbhttpd, cgi and curl, which are working fine.

SBHTTPD is a rock solid multi-threaded web server that is easy to program.

FYI If you are using MT for session (cookie) tracking and use the function to return expired sessions in an array, make sure you undef that session array or overtime memory usage gets huge. I thought SBHTTPD had a memory leak until Peter Verhas commented on how I was removing expired sessions.


369
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 21, 2013, 06:08:14 PM »
Ron,

There has been a change in how ScriptBasic was installed in the past. (< 2.2)  With this release ScriptBasic allows you to unzip the archive to where ever you like (a sub directory within your user account for example) and no need to regenerate a scriba.conf pointing to your SB module and include directories. The paths to these directories are relative to where the scriba.conf is located which is bin. This makes ScriptBasic more flexible with where it lives.

Code: [Select]
jrs@laptop:~/sb/sb22/bin$ scriba -D
dll ".so"
module "../modules/"
include "../include/"
maxinclude 100
preproc (
  internal (
    sdbg "../modules/sdbg.so"
   )
 )
maxstep 0
maxlocalstep 0
maxlevel 3000
maxmem 0

I created a . script to setup my environment variables for ScriptBasic.

Code: [Select]
export PATH=/home/jrs/sb22/bin:$PATH
export SCRIBACONF=/home/jrs/sb22/bin/scriba.conf

You can find IUP on SourceForge which has 32/64 bit Linux versions with the choice of Gtk2 or Gtk3. Just download the archive somewhere and run the install script with sudo.

The cURL example assumes you have Apache running local on your system. If not point the URL in the script somewhere else.

The MySql example assumes you have MySQL server and the libmysql client installed. If you don't have MySQL installed then you need to point the host argument to where you have access to one.

If you are going to use the ODBC extension module then you will need to download the unixODBC drivers for MySQL and SQLite.

Load the wc.sb script in your text editor and change the following.

ok = EXECUTE("sort wc.raw /O wc.srt", -1, PID)

TO

ok = EXECUTE("sort wc.raw -o wc.srt", -1, PID)



370
What's New / ScriptBasic 2.2 Beta - Feedback
« on: February 21, 2013, 10:01:33 AM »
Most if not all of these issues are due to missing dependencies. I attached a Text File that listed the packages that needed to be installed. You also need to install IUP. (runtime files are all that is needed)

My mistake. The wc.sb word count program is using the sort option for Windows not Linux. Change them to -o instead and it will work fine. I'll fix that in the next build.

Make sure you are using the hash.so that came with 2.2 as the 2.1 version had issues.
Make sure your scriba|basic.conf is pointing to the right modules directory. (scriba -D)

testhash.sb
Code: [Select]
IMPORT hash.bas

h = hash::New()
hash::SetValue(h,"1234567890A",1)
hash::SetValue(h,"12345678901234567890B",2)
hash::SetValue(h,"123456789012345678901234567890C",3)
hash::Start(h)

FOR x = 1 to 3
  PRINT hash::ThisKey(h), " - "
  PRINT hash::ThisValue(h),"\n"
  hash::Next(h)
NEXT x

hash::Release(h)

jrs@U32VB:~/sb22/test$ scriba testhash.sb
1234567890A - 1
12345678901234567890B - 2
123456789012345678901234567890C - 3
jrs@U32VB:~/sb22/test$


Thanks again for your testing and feedback.



371
What's New / ScriptBasic SokoMouse Game
« on: February 20, 2013, 09:38:51 PM »




The attached zip contains all the files to run the SokoMouse game on a ScriptBasic for Windows installed system. The spacebar will reset the level if you need to start the level over. Click the rotating arrows to scroll through the levels. SokoMouse supports sound so don't forget to turn on those speakers.

This project was just a proof of concept to show that ScriptBasic is robust enough to support a GUI game engine.

Code: [Select]
' ScriptBasic SokoMouse

INCLUDE "sw.inc"

SUB Initialize
  DrawBmp p1, 0, 0, 640, 480, 0
  CALL ShowLevel
  FOR bc = 0 TO 299
    xBox[bc] = 0
    yBox[bc] = 0
    rBox[bc] = 0
    zBox[bc] = 0
    iBox[bc] = 0
  NEXT
  zR = 0
  vR = 0
  zA = 0
  pHead = 3
  Ready = 0
  sl = 0
  cV = 0
  cR = 0
  Steps = 0
  RasReg = 0
  KeyR = 0
  KeyL = 0
  KeyU = 0
  KeyD = 0
  BoxRas = 0
  Turn = 1
  zTurn = 0
END SUB

SUB LoadMaps
  LoadBytes "Maps/Map" & lev & "-1.bin", Map1
  LoadBytes "Maps/Map" & lev & "-2.bin", Map2
  LoadBytes "Maps/Map" & lev & "-3.bin", Map3
END SUB  
  
SUB ShowLevel
  Sprite s8, 480, 420, zA
  Sprite s9, 576, 420, zA
  IF lev < 10 THEN
    BmpText fo, 520, 420, Nums[lev], 24, 24
  ELSE
    BmpText fo, 520, 420, STR(lev), 24, 24
  END IF
  vA += 1
  IF vA = 8 THEN
    vA = 0
    zA = zA + 1
    IF zA = 4 THEN zA = 0
  END IF
END SUB

SUB ShowMaps
  FOR icx = 0 TO 14
    FOR idx = 0 TO 19
      ibx = icx * 20 + idx
      IF ASC(Map1[ibx]) = 3 THEN Sprite s1, idx * 32, icx * 32, 3
      IF ASC(Map3[ibx]) = 2 THEN Sprite s1, idx * 32, icx * 32, 2
      IF ASC(Map2[ibx]) = 5 THEN Sprite s2, idx * 32, icx * 32, zR
    NEXT
  NEXT
  vR += 1
  IF vR = 10 THEN
    vR = 0
    zR += 1
  END IF
  IF zR = 4 THEN zR = 0
END SUB

SUB FindHead
  FOR icx = 0 TO 14
    FOR idx = 0 TO 19
      ibx = icx * 20 + idx
      IF ASC(Map3[ibx]) = 6 THEN
        xHead = idx * 32
        yHead = icx * 32
        rHead = 0
        zHead = 0
        EXIT SUB
      END IF
    NEXT
  NEXT
END SUB

SUB AllDone
  IF Ready >= 1 THEN EXIT SUB
  FOR icx = 0 TO 14
    FOR idx = 0 TO 19
      ibx = icx * 20 + idx
      IF ASC(Map2[ibx]) = 5 AND ASC(Map3[ibx]) <> 4 THEN
        EXIT SUB
      END IF
    NEXT
  NEXT
  PlaySound w3
  Ready = 2
  RasReg = 1
  Turn = 0
  pHead = 0
  rTurn = Rand(1, 2)
  xTurn = xHead
  yTurn = yHead
END SUB

SUB TurnHead
  IF Turn > 0 THEN EXIT SUB
  IF rTurn = 1 THEN
    Sprite s6, xTurn, yTurn, zTurn
  ELSE IF rTurn = 2 THEN
    Sprite s7, xTurn, yTurn, zTurn
  END IF
  zTurn = zTurn + 1
  IF zTurn = 64 THEN zTurn = 0
END SUB

SUB FlashBox
  FOR icx = 0 TO 14
    FOR idx = 0 TO 19
      ibx = icx * 20 + idx
      IF ASC(Map2[ibx]) = 5 AND ASC(Map3[ibx]) = 4 THEN
        Sprite s4, idx * 32, icx * 32, cR
      END IF
    NEXT
  NEXT
  cV += 1
  IF cV = 10 THEN
    cV = 0
    cR += 1
  END IF
  IF cR = 4 THEN cR = 0
END SUB

SUB ScanBoxes
  IF BoxRas > 0 THEN EXIT SUB
  FOR icx = 0 TO 14
    FOR idx = 0 TO 19
      ibx = icx * 20 + idx
      IF ASC(Map3[ibx]) = 4 THEN
        iBox[ibx] = 1
        xBox[ibx] = idx * 32
        yBox[ibx] = icx * 32
        rBox[ibx] = 0
      END IF
    NEXT
  NEXT
END SUB

SUB ShowBoxes
  FOR ibx = 20 TO 280
    IF iBox[ibx] = 1 AND rBox[ibx] = 0 THEN
      Sprite s1, xBox[ibx], yBox[ibx], 4
    ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 1 THEN
      xBox[ibx] = xBox[ibx] + 2
      Sprite s1, xBox[ibx], yBox[ibx], 4
      zBox[ibx] = zBox[ibx] + 2
      IF zBox[ibx] = 32 THEN
        zBox[ibx] = 0
        iBox[ibx] = 0
        icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
        Map3[icx] = CHR(4)
      END IF
    ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 2 THEN
      xBox[ibx] = xBox[ibx] - 2
      Sprite s1, xBox[ibx], yBox[ibx], 4
      zBox[ibx] = zBox[ibx] + 2
      IF zBox[ibx] = 32 THEN
        zBox[ibx] = 0
        iBox[ibx] = 0
        icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
        Map3[icx] = CHR(4)
      END IF
    ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 3 THEN
      yBox[ibx] = yBox[ibx] - 2
      Sprite s1, xBox[ibx], yBox[ibx], 4
      zBox[ibx] = zBox[ibx] + 2
      IF zBox[ibx] = 32 THEN
        zBox[ibx] = 0
        iBox[ibx] = 0
        icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
        Map3[icx] = CHR(4)
      END IF
    ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 4 THEN
      yBox[ibx] = yBox[ibx] + 2
      Sprite s1, xBox[ibx], yBox[ibx], 4
      zBox[ibx] = zBox[ibx] + 2
      IF zBox[ibx] = 32 THEN
        zBox[ibx] = 0
        iBox[ibx] = 0
        icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
        Map3[icx] = CHR(4)
      END IF
    END IF
  NEXT
END SUB

SUB ScanHead
  IF RasReg > 0 THEN EXIT SUB
  idx = xHead / 32
  icx = yHead / 32
  ibx = icx * 20 + idx
  IF ASC(Map3[ibx]) = 6 AND Key(vk_right) AND ASC(Map3[ibx + 1]) = 4 AND ASC(Map3[ibx + 2]) = 0 AND KeyR = 0 THEN
    Map3[ibx] = CHR(0)
    Map3[ibx + 1] = CHR(6)
    rHead = 1
    pHead = 1
    BoxRas = 0
    xBox[ibx + 1] = xHead + 32
    yBox[ibx + 1] = yHead
    rBox[ibx + 1] = 1
    iBox[ibx + 1] = 1
    Steps += 1
    PlaySound w2
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_left) AND ASC(Map3[ibx - 1]) = 4 AND ASC(Map3[ibx - 2]) = 0 AND KeyL = 0 THEN
    Map3[ibx] = CHR(0)
    Map3[ibx - 1] = CHR(6)
    rHead = 2
    pHead = 2
    BoxRas = 0
    xBox[ibx - 1] = xHead - 32
    yBox[ibx - 1] = yHead
    rBox[ibx - 1] = 2
    iBox[ibx - 1] = 1
    Steps += 1
    PlaySound w2
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_up) AND ASC(Map3[ibx - 20]) = 4 AND ASC(Map3[ibx - 40]) = 0 AND KeyU = 0 THEN
    Map3[ibx] = CHR(0)
    Map3[ibx - 20] = CHR(6)
    rHead = 3
    pHead = 3
    BoxRas = 0
    xBox[ibx - 20] = xHead
    yBox[ibx - 20] = yHead - 32
    rBox[ibx - 20] = 3
    iBox[ibx - 20] = 1
    Steps += 1
    PlaySound w2
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_down) AND ASC(Map3[ibx + 20]) = 4 AND ASC(Map3[ibx + 40]) = 0 AND KeyD = 0 THEN
    Map3[ibx] = CHR(0)
    Map3[ibx + 20] = CHR(6)
    rHead = 4
    pHead = 4
    BoxRas = 0
    xBox[ibx + 20] = xHead
    yBox[ibx + 20] = yHead + 32
    rBox[ibx + 20] = 4
    iBox[ibx + 20] = 1
    Steps += 1
    PlaySound w2
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_right) AND ASC(Map3[ibx + 1]) = 0 AND KeyR = 0 THEN
    rHead = 1
    pHead = 1
    Map3[ibx] = CHR(0)
    Map3[ibx + 1] = CHR(6)
    Steps += 1
    PlaySound w1
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_left) AND ASC(Map3[ibx - 1]) = 0 AND KeyL = 0 THEN
    rHead = 2
    pHead = 2
    Map3[ibx] = CHR(0)
    Map3[ibx - 1] = CHR(6)
    Steps += 1
    PlaySound w1
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_up) AND ASC(Map3[ibx - 20]) = 0 AND KeyU = 0 THEN
    rHead = 3
    pHead = 3
    Map3[ibx] = CHR(0)
    Map3[ibx - 20] = CHR(6)
    Steps += 1
    PlaySound w1
  ELSE IF ASC(Map3[ibx]) = 6 AND Key(vk_down) AND ASC(Map3[ibx + 20]) = 0 AND KeyD = 0 THEN
    rHead = 4
    pHead = 4
    Map3[ibx] = CHR(0)
    Map3[ibx + 20] = CHR(6)
    Steps += 1
    PlaySound w1
  ELSE
    rHead = 0
  END IF
END SUB

SUB ShowHead
  IF rHead = 0 AND pHead = 1 THEN
    Sprite s3, xHead, yHead, 3
  ELSE IF rHead = 0 AND pHead = 2 THEN
    Sprite s3, xHead, yHead, 1
  ELSE IF rHead = 0 AND pHead = 3 THEN
    Sprite s3, xHead, yHead, 0
  ELSE IF rHead = 0 AND pHead = 4 THEN
    Sprite s3, xHead, yHead, 2
  ELSE IF rHead = 1 THEN
    xHead += 2
    Sprite s3, xHead, yHead, 3
    RasReg += 2
    IF RasReg = 32 THEN
      RasReg = 0
      rHead = 0
    END IF
  ELSE IF rHead = 2 THEN
    xHead -= 2
    Sprite s3, xHead, yHead, 1
    RasReg += 2
    IF RasReg = 32 THEN
      RasReg = 0
      rHead = 0
    END IF
  ELSE IF rHead = 3 THEN
    yHead -= 2
    Sprite s3, xHead, yHead, 0
    RasReg += 2
    IF RasReg = 32 THEN
      RasReg = 0
      rHead = 0
    END IF
  ELSE IF rHead = 4 THEN
    yHead += 2
    Sprite s3, xHead, yHead, 2
    RasReg += 2
    IF RasReg = 32 THEN
      RasReg = 0
      rHead = 0
    END IF
  END IF
END SUB

SUB MousePos
  xPos = FIX(xMouse() / 32)
  yPos = FIX(yMouse() / 32)
  IF MouseButton() = 1 THEN
    IF xPos = 15 AND yPos = 13 AND lev > 1 AND ButtonC = 0 THEN
      lev -= 1
      ButtonC = 1
      PlaySound w4
      ' Sync
      Initialize
      LoadMaps
      FindHead
      EXIT SUB
    END IF
  END IF
  IF MouseButton() = 1 THEN
    IF xPos = 18 AND yPos = 13 AND lev < 9 AND ButtonC = 0 THEN
      lev += 1
      ButtonC = 1
      PlaySound w4
      ' Sync
      Initialize
      LoadMaps
      FindHead
    END IF
  END IF
  IF MouseButton() = 0 THEN ButtonC = 0
END SUB


' MAIN

Window 640, 480, 1
SetCaption "ScriptBasic SokoMouse"

SetFps(60)

Q  = LoadBmp("SokoMedia/sokomouse.bmp", 1)
p1 = LoadBmp("SokoMedia/Phantasie.bmp", 1)
Fo = LoadBmp("SokoMedia/FontStrip.bmp", 96)
s1 = LoadBmp("SokoMedia/SokoStrip.bmp", 5)
s2 = LoadBmp("SokoMedia/RundStrip.bmp", 4)
s3 = LoadBmp("SokoMedia/HeadStrip.bmp", 4)
s4 = LoadBmp("SokoMedia/BoxsStrip.bmp", 4)
s6 = LoadBmp("SokoMedia/HeadStripR.bmp", 64)
s7 = LoadBmp("SokoMedia/HeadStripL.bmp", 64)
s8 = LoadBmp("SokoMedia/ArroStripL.bmp", 4)
s9 = LoadBmp("SokoMedia/ArroStripR.bmp", 4)

w1 = "SokoMedia/move.wav"
w2 = "SokoMedia/push.wav"
w3 = "SokoMedia/done.wav"
w4 = "SokoMedia/clic.wav"

Nums[1] = "01"
Nums[2] = "02"
Nums[3] = "03"
Nums[4] = "04"
Nums[5] = "05"
Nums[6] = "06"
Nums[7] = "07"
Nums[8] = "08"
Nums[9] = "09"

Cls  0xCCCCCC
Sprite Q, 180, 60, 0
BmpText fo, 205, 32, "SOKOMOUSE", 24, 24
BmpText fo, 170, 428, "PRESS ANY KEY", 24, 24
WaitKey

lev = 1
Initialize
LoadMaps
ShowLevel
FindHead

WHILE Key(27) = 0
  ShowMaps
  IF sl THEN ShowLevel
  ScanBoxes
  ScanHead
  ShowBoxes
  ShowHead
  FlashBox
  AllDone
  MousePos
  TurnHead
  IF Key(vk_space) THEN
    BmpText fo, 64, 420, "Wait...", 24, 24
    Initialize
    LoadMaps
    FindHead
  END IF
  BmpText fo, 200, 8, "SokoMouse", 24, 24
  IF Ready = 2 THEN
    BmpText fo, 64, 420, "Advance to the next level ...", 16, 16
    sl = 1
  END IF
  BoxRas += 2
  IF BoxRas = 32 THEN BoxRas = 0
  IF Key(vk_right) = 0 THEN KeyR = 1
  IF Key(vk_right)THEN KeyR = 0
  IF Key(vk_left) = 0 THEN KeyL = 1
  IF Key(vk_left) THEN KeyL = 0
  IF Key(vk_up) = 0 THEN KeyU = 1
  IF Key(vk_up) THEN KeyU = 0
  IF Key(vk_down) = 0 THEN KeyD = 1
  IF Key(vk_down) THEN KeyD = 0
  Sync
WEND
CloseWindow

Update: I notice a memory freeing issue with Simple Windows and will post an updated version of the game when it is resolved.

372
What's New / Re: ScriptBasic 2.2 Beta Release - (Ubuntu 64)
« on: February 20, 2013, 08:34:24 PM »
Attached is a ScriptBasic 64 bit beta version for Ubuntu 12.04 LTS. It pretty much mirrors the Ubuntu 32 bit beta version previous released but ODBC is not include in this build. (64 bit issues with the interface - hope to have this resolved in the next build)  Please follow the same install procedure described above for the 32 bit Ubuntu version.
 

ScriptBasic 2.2 (Ubuntu 64) Attached

373
What's New / Re: ScriptBasic 2.2 Beta Release - (Windows 32)
« on: February 20, 2013, 02:33:54 PM »
Quote
022013 update: I installed SB22b1_Ubuntu32 over scriba-v2.1.1_i386. So far everthing is working well.

Thanks Ron for the feedback. Let me know if you find anything not working to your satisfaction.


374
What's New / ScriptBasic 2.2 Beta Release - (Ubuntu 32)
« on: February 13, 2013, 09:51:23 PM »
Attached is a beta version of the ScriptBasic 2.2 release for Ubuntu 32 bit. The test directory contains the same programs and results as the Windows version above.

Installation:

I unzipped the archive in a ~/sb22 directory within my Linux user account and exported the following commands.

export PATH=/home/jrs/sb22/bin:$PATH

export SCRIBACONF=/home/jrs/sb22/bin/basic.conf

I attached a list of runtime support libraries needed to use some of the extension modules.

Feedback appreciated!

John Spikowski
ScriptBasic Project Manager

ScriptBasic 2.2 (Ubuntu 32) Attached

375
What's New / SBx
« on: February 12, 2013, 07:16:54 PM »
I expanded on the SBx IUP wrapper library enough to convert the online dictionary example. (see attached - running on Ubuntu 64) The same code runs on Win7-64 (as a 32 bit application) untouched.

SBx_dict.sb
Code: [Select]
' SBx Online Dictionary

servers[0]="dict.org"
servers[1]="dict1.us.dict.org"
servers[2]="all.dict.org"

about="""This is a Demo
of the IUP GUI Binding
for Scriptbasic"""

INCLUDE "SBx"

' Create main window
win = DIALOG()
  SETPROPERTIES win, "TITLE=\"SBx Dictionary\", SIZE = 500x300"
  SETEVENT win, "CLOSE_CB", ADDRESS(Win_exit())

' Create container to house ALL GUI objects
vbx = VBOX()
  SETPROPERTIES vbx, "MARGIN=10x10"

' Create server panel
topBox = HBOX()
  SETPROPERTIES topBox, "GAP=10"
  APPEND vbx, topBox
serverFrame = FRAME()
  SETPROPERTIES serverFrame, "TITLE=Servers, EXPAND=YES"
  APPEND topBox, serverFrame
serverBox = HBOX()
  SETPROPERTIES serverBox, "GAP=5"
  APPEND serverFrame, serverBox
serverCombo = LIST()
  SETPROPERTIES serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1"
  APPEND serverBox, serverCombo
  SETEVENT serverCombo, "ACTION", ADDRESS(serverCombo_selected())
btnFetch = BUTTON()
  SETPROPERTIES btnFetch, "TITLE=Fetch, SIZE = 50x"
  APPEND serverBox, btnFetch
  SETEVENT btnFetch, "ACTION", ADDRESS(btnFetch_clicked())

' Create control panel
controlFrame = FRAME()
  SETPROPERTIES controlFrame, "TITLE=Controls"
  APPEND topBox, controlFrame
controlBox = HBOX()
  SETPROPERTIES controlBox, "GAP=5"
  APPEND controlFrame, controlBox
btnAbout = BUTTON()
  SETPROPERTIES btnAbout, "TITLE=About, SIZE = 50x"
  APPEND controlBox, btnAbout
  SETEVENT btnAbout, "ACTION", ADDRESS(btnAbout_clicked())
btnClear = BUTTON()
  SETPROPERTIES btnClear, "TITLE=Clear, SIZE = 50x"
  APPEND controlBox, btnClear
  SETEVENT btnClear, "ACTION", ADDRESS(btnClear_clicked())
btnExit = BUTTON()
  SETPROPERTIES btnExit, "TITLE=Exit, SIZE = 50x"
  APPEND controlBox, btnExit
  SETEVENT btnExit,"ACTION",ADDRESS(Win_exit())

' Create dictionary panel
dictFrame = FRAME()
  SETPROPERTIES dictFrame, "TITLE=\"Dictionaries\""
  APPEND vbx, dictFrame
serverList = LIST()
  SETPROPERTIES serverList, "EXPAND=YES, VISIBLELINES=1"
  APPEND dictFrame, serverList
  SETEVENT serverList, "ACTION", ADDRESS(serverList_selected())

' Create text part
transFrame = FRAME()
  SETPROPERTIES transFrame, "TITLE=\"Translation\""
  APPEND vbx, transFrame
txt = TEXT()
  SETPROPERTIES txt, "MULTILINE=YES, EXPAND=YES"
  APPEND transFrame, txt


' Create entry and search button
bottomBox = HBOX()
  SETPROPERTIES bottomBox, "GAP=10"
  APPEND vbx, bottomBox
lbl = LABEL()
  SETPROPERTIES lbl, "TITLE=\"Enter Word to Search For:\", SIZE=x12"
  APPEND bottomBox, lbl
entry = TEXT()
  SETPROPERTIES entry, "EXPAND=HORIZONTAL"
  APPEND bottomBox, entry
btnSearch = BUTTON()
  SETPROPERTIES btnSearch,"TITLE=Search, SIZE=50x"
  APPEND bottomBox, btnSearch
  SETEVENT btnSearch, "ACTION", ADDRESS(btnSearch_clicked())
chkAll = TOGGLE()
  SETPROPERTIES chkAll, "TITLE=ALL, SIZE=x12"
  APPEND bottomBox, chkAll
chkUTF = TOGGLE()
  SETPROPERTIES chkUTF, "TITLE=UTF-8, SIZE=x12"
  APPEND bottomBox, chkUTF

' Add the main GUI container to the Window
APPEND win, vbx

' Setup dialog defaults
SHOW win
FOCUS btnFetch
FOR i = 0 TO UBOUND(servers)
  SETPROPERTY serverCombo, "APPENDITEM", servers[i]
NEXT
SETPROPERTY serverCombo, "VALUE", "1"
UPDATE serverCombo
server_selection = servers[0]
GETEVENT()
END


' Callback routines

SUB Win_exit
  Iup::ExitLoop = TRUE
END SUB

SUB btnAbout_clicked
  MESSAGE "ABOUT", about
END SUB

SUB serverCombo_selected
  server_selection = GETITEM()
END SUB

SUB serverList_selected
  whichDictionary = GETITEM()
END SUB

SUB btnFetch_clicked
  LOCAL dat, total, count
  ON ERROR GOTO G_NetError
  OPEN server_selection & ":2628" FOR SOCKET AS #1
  PRINT#1,"SHOW DB\n"
  LINE INPUT#1, dat
  LINE INPUT#1, dat
  count = 0
  WHILE LEFT(dat, 1) <> "."
    LINE INPUT#1, dat
    IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
    count+=1
  WEND
  PRINT#1,"QUIT\n"
  CLOSE(#1)
  FOR cnt = 0 TO count - 2
    SETPROPERTY serverList, "APPENDITEM", total[cnt]
  NEXT
  SETPROPERTY serverList, "VALUE", "1"
  UPDATE serverCombo
  whichDictionary = total[0]
  EXIT SUB

  G_NetError:
  PRINT "Server ",server_selection," not available. (",ERROR,")\n"
END SUB

SUB btnClear_clicked
  CLEAR serverList
  SETPROPERTY txt, "VALUE", ""
  SETPROPERTY entry, "VALUE", ""
END SUB

SUB btnSearch_clicked
  LOCAL dict, dat, total, info
  SETPROPERTY txt, "VALUE", "Fetching...."
  ON ERROR GOTO L_NetError
  dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
  OPEN server_selection & ":2628" FOR SOCKET AS 1
  IF GETPROPERTY(chkAll, "VALUE") THEN
    PRINT#1,"DEFINE * " & GETPROPERTY(entry, "VALUE") & "\n"
  ELSE
    PRINT#1,"DEFINE " & dict & " " & GETPROPERTY(entry, "VALUE") & "\n"
  END IF
  REPEAT
    LINE INPUT#1, dat
    IF LEFT(dat, 3) = "151" THEN
      total &= "------------------------------\r\n"
      total &= RIGHT(dat, LEN(dat) - LEN(GETPROPERTY(entry, "VALUE")) - LEN(dict))
      total &= "------------------------------\r\n"
      REPEAT
        LINE INPUT#1, info
        info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
        IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
      UNTIL LEFT(info, 1) = "."
      total &= "\n"
    END IF
  UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
  PRINT#1,"QUIT\n"
  CLOSE(#1)
  IF LEFT(dat, 3) = "552" THEN
    total = "No match found."
  ELSE IF LEFT(dat, 3) = "501" THEN
    total = "Select a dictionary first!"
  ELSE IF LEFT(dat, 3) = "550" THEN
    total = "Invalid database!"
  END IF
  SETPROPERTY txt, "VALUE", total
EXIT SUB

L_NetError:
  dat[0] = "Could not lookup word! (" & ERROR & ")"
  SETPROPERTY txt, "VALUE", dat
END SUB

SBx
Code: [Select]
' ScriptBasic IUP Interface

IMPORT iup.bas

Iup::Open()

FUNCTION DIALOG
  DIALOG = Iup::Create("dialog")
END FUNCTION

SUB SETPROPERTIES(ih, propstr)
  Iup::SetAttributes(ih, propstr)
END SUB

SUB SETPROPERTY(ih, typ, value)
  Iup::SetAttribute(ih, typ, value)
END SUB

FUNCTION GETPROPERTY(ih, typ)
  GETPROPERTY = Iup::GetAttribute(ih, typ)
END FUNCTION

FUNCTION VBOX
  VBOX = Iup::Create("vbox")
END FUNCTION

FUNCTION HBOX
  HBOX = Iup::Create("hbox")
END FUNCTION

FUNCTION FRAME
  FRAME = Iup::Create("frame")
END FUNCTION

FUNCTION BUTTON
  BUTTON = Iup::Create("button")
END FUNCTION

FUNCTION LIST
  LIST = Iup::Create("list")
END FUNCTION

FUNCTION TEXT
  TEXT = Iup::Create("text")
END FUNCTION

FUNCTION LABEL
  LABEL = Iup::Create("label")
END FUNCTION

FUNCTION TOGGLE
  TOGGLE = Iup::Create("toggle")
END FUNCTION

SUB MESSAGE(title, body)
  Iup::Message(title, body)
END SUB

FUNCTION GETITEM
  GETITEM = Iup::GetListText()
END FUNCTION
 
SUB APPEND(ih_to, ih_from)
  Iup::Append(ih_to, ih_from)
END SUB

FUNCTION FOCUS(ih)
  FOCUS = Iup::SetFocus(ih)
END FUNCTION

FUNCTION UPDATE(ih)
  UPDATE = Iup::Update(ih)
END FUNCTION

SUB CLEAR(ih)
  Iup::ClearList(ih)
END SUB

SUB SETEVENT(ih, class, funcaddr)
  Iup::SetCallback(ih, class,  funcaddr)
END SUB

SUB SHOW(ih)
  Iup::Show(ih)
END SUB  

SUB GETEVENT
  Iup::MainLoop
  Iup::Close
END SUB

Pages: 1 ... 23 24 [25] 26 27 ... 59