Testing examples from the manual in ubuntu 6.10

Linux specific forum
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Testing examples from the manual in ubuntu 6.10

Post by chen »

Like Im so interested in Linux version and I have had some problems, I decided
to test most of the examples in the manual.... starting with the "gadget" section

The examples here are not working for me, because I forget something
or simply they dont work.... Im comparing with the windows version.

I have all the flags on : enable debuger, asm support, create unicode executable
create threadsafe executable

Using Ubuntu 6.10, PB 4 beta 2

+++ With Problems +++

Code: Select all

 If OpenWindow(0, 0, 0, 120, 100, "ButtonImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    If LoadImage(0, "/home/chen/pb/pbcomm/Images/PBIDE.bmp")    ; change 2nd parameter to the path/filename of your image
      ButtonImageGadget(0, 10, 10, 100, 83, ImageID(0))
    EndIf
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
- does not work in unicode (compiler options: unicode executable).
- does not work with ".ico" images

..........

+++ Working... +++

Code: Select all

 If OpenWindow(0, 0, 0, 200, 250, "DateGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(0))
      DateGadget(0, 10, 10, 180, 25, "Date: %mm/%dd/%yyyy Time: %hh:%ii")
      Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf
- invalid memory access
++++ Update: is working... ++++ I installed again Ubuntu.

..........

+++ Works adding chr(10) an the end of line. see next post by Walker+++

Code: Select all

 If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
    EditorGadget(0, 8, 8, 306, 133) 
    For a = 0 To 5 
      AddGadgetItem(0, a, "Line "+Str(a)) 
    Next 
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
  EndIf 
- output in one line (must be in several lines)
the AddGadgetItem is not working in "Editor Gadget"... it works in "ListviewGadget"

..........

+++ works if *.* is replaced by /*.* as Walker point out +++

Code: Select all

 If OpenWindow(0, 0, 0, 400, 200, "ExplorerListGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    ExplorerListGadget(0, 10, 10, 380, 180, "*.*", #PB_Explorer_MultiSelect)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf 

- open window but empty.....

..........

+++ With Problems +++

Code: Select all

 If OpenWindow(0, 0, 0, 320, 250, "Frame3DGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CreateGadgetList(WindowID(0))
      Frame3DGadget(0, 10,  10, 300, 50, "Frame3DGadget Standard")
      Frame3DGadget(1, 10,  70, 300, 50, "", #PB_Frame3D_Single)
      Frame3DGadget(2, 10, 130, 300, 50, "", #PB_Frame3D_Double)
      Frame3DGadget(3, 10, 190, 300, 50, "", #PB_Frame3D_Flat)
    
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
- I dont see the difference from frame to frame except the first one :wink:
I dont know if it is the theme Im using.

..........

+++ With Problems +++

Code: Select all

 If OpenWindow(0, 0, 0, 270, 160, "HyperlinkGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    HyperLinkGadget(0, 10, 10, 250,20,"Red HyperLink", RGB(255,0,0))
    HyperLinkGadget(1, 10, 30, 250,20,"Arial Underlined Green HyperLink", RGB(0,255,0), #PB_HyperLink_Underline)
    SetGadgetFont(1, LoadFont(0, "Arial", 12))
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
- #PB_HyperLink_Underline : constant not found

..........

+++ With Problems +++

Code: Select all

 If OpenWindow(0, 0, 0, 245, 105, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    If LoadImage(0, "/home/chen/pb/pbcomm/Images/PBIDE.bmp")    ; change 2nd parameter to the path/filename of your image
      ImageGadget(0,  10, 10, 100, 83, ImageID(0))                      ; imagegadget standard
      ImageGadget(1, 130, 10, 100, 83, ImageID(0), #PB_Image_Border)     ; imagegadget with border
    EndIf
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
- I need to uncheck "create unicode executable" in compiler options

..........

To no post all examples with images.... only a note:
- I must unchecked "create unicode executable" from compiler options fpr work

..........

+++ With Problems ++

Code: Select all

#Main = 0
  #MDIChild = 1
  If OpenWindow(#Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
    If CreateGadgetList(WindowID(#Main)) And CreateMenu(#Main, WindowID(#Main))
      MenuTitle("Menu index 0")
      MenuTitle("MDI windows menu")
        MenuItem(0, "self created item")
        MenuItem(1, "self created item")
        
      MDIGadget(0, 0, 0, 0, 0, 1, 2, #PB_MDI_AutoSize)
        AddGadgetItem(0, #MDIChild, "child window")
        CreateGadgetList(WindowID(#MDIChild))
          ; add gadgets here...
      UseGadgetList(WindowID(#Main)) ; go back to the main window gadgetlist
    EndIf
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf
- #window object not initialized

..........

+++ working see how in the next post by Walker +++

Code: Select all

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")
    ; Note: if you want to use a local file, change last parameter to "file://" + path + filename
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
- here I think I need to do something... looking for it...
- mozilla embeding library not found. Call WebGadgetPath() first
- I couldnt find library "libgtkembedmoz.so"

.......... Thats all for the Gadget Section......
Last edited by chen on Thu Jan 11, 2007 6:07 am, edited 22 times in total.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi chen,

first, for other image formats than bmp you have to use the UsexxxImageDecoder() commands... and ico isn't supported(yet) on linux.

the missing constant is worth to report in the bug section

second example works here (it will be a good idea to tell us the used PB-version...) maybe not all needed devel packages installed? (just a guess)

for a new line in the Editorgadget() you'll have to ad a chr(10) to the end of the line...

the Explorerlist doesn't know, where to search... only *.* didn't do the job... try "/*.*" instead...

frame3D ... yes, that depends on the theming engine.... (on my machine there is NO difference)

the Unicode and imageloading... report it (with the linker error) in the Bug-section...

The MDI-Gadget... I guess there is an error too... feel free to report this as a bug... (if you delete the line CreateGadgetList(WindowID(#MDIChild)) it works mostly as expected.... :roll:

the WebGadget,,, take a look at /etc/ ... do you have a ld.so.conf file?
if not, create one (as root) and add the path to firefox (or mozilla) to this file
(i.e. /usr/lib/firefox/ where it's installed on my machine) after that run su ldconfig ..
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

(it will be a good idea to tell us the used PB-version...)
PB4 Beta 2... Sorry..

Im gonna check out your answers... thanks
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

walker write
first, for other image formats than bmp you have to use the UsexxxImageDecoder() commands... and ico isn't supported(yet) on linux.
Updated in the post.
second example works here (it will be a good idea to tell us the used PB-version...) maybe not all needed devel packages installed? (just a guess)
I reinstalled Ubuntu and is working....
for a new line in the Editorgadget() you'll have to ad a chr(10) to the end of the line...
I know... but something is missing... windows does not require chr(10)
the Explorerlist doesn't know, where to search... only *.* didn't do the job... try "/*.*" instead...
I suppose it must be fixed..... it works as you said.
frame3D ... yes, that depends on the theming engine.... (on my machine there is NO difference)
I changed theme and and dont see any difference... I gonna try other themes..
the WebGadget,,, take a look at /etc/ ... do you have a ld.so.conf file?
if not, create one (as root) and add the path to firefox (or mozilla) to this file
(i.e. /usr/lib/firefox/ where it's installed on my machine) after that run su ldconfig ..
done..... and working

Thanks for your support....
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

.......... jan 11, 2007

Code: Select all

 Debug FormatDate("%yyyy/%mm/%dd", AddDate(Date(), 0, 2)) ; Returns the current date + 2 years
- Error Assembler purebasic.asm

......... jan 10, 2007 Working see reply by bembulak ......

Code: Select all

 If OpenConsole()
    Print("Enter your name and press return: ")
    Name$ = Input()
    
    PrintN("Hello " + Name$ + ", nice to meet you.")
    PrintN("Press return to exit")
    Input()
  EndIf
- the console does not open
- In fact all the exAmples with OpenConsole() dont work
- if it works with you please let me know if you adusted some parameters
..........
Last edited by chen on Thu Jan 11, 2007 4:36 pm, edited 1 time in total.
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 576
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Post by bembulak »

In fact all the exAmples with OpenConsole() dont work
Did you set the compiler options form "linux" to "console"?
cheers,

bembulak
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Actually Linux doesn't have ONE Terminal emulator, but many different therfore it is not that easy to open one with the OpenConsole Command, it would also be very very very uncommon for a Linux Software to do that. If You use Commandlien Software on Linux you start it from a console, that's it.
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

bembulak wrote:
In fact all the exAmples with OpenConsole() dont work
Did you set the compiler options form "linux" to "console"?
Done...it works... :wink:
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 576
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Post by bembulak »

Nik wrote:Actually Linux doesn't have ONE Terminal emulator, but many different therfore it is not that easy to open one with the OpenConsole Command, it would also be very very very uncommon for a Linux Software to do that. If You use Commandlien Software on Linux you start it from a console, that's it.
No, because I can start cmd-line-apps from X by passing them the option "open in terminal" and what about calling the $TERM Var?
At the moment I can't check (because I gotta use Windoze), but I know that every user can set a Variable for the favorite terminal emu. Same with WWW-BROSWER and som other apps and configs.
chen wrote:Done...it works...
8)
cheers,

bembulak
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

We had this discussion allready:

On linux, you have to start the terminal first, then launch the executable inside it. (or both at once with commandline parameters).
You cannot start your exe, and let it open a terminal around it.
Thats why OpenConsole() cannot do this.
quidquid Latine dictum sit altum videtur
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

........... jan 11, 2007 DeskTop group ........

Code: Select all

MessageRequester("Desktop Information", "You have "+Str(ExamineDesktops())+" desktops")
- nothing to show

.........

Code: Select all

ExamineDesktops()
  MessageRequester("Display Information", "Current resolution = "+Str(DesktopWidth(0))+"x"+Str(DesktopHeight(0))+"x"+Str(DesktopDepth(0)))
- shows nothing

..........

Code: Select all

ExamineDesktops()
  MessageRequester("Display Information", "Primary desktop name = "+DesktopName(0))
-shows nothing
..........

Code: Select all

ExamineDesktops()
  MessageRequester("Display Information", "Current resolution = "+Str(DesktopWidth(0))+"x"+Str(DesktopHeight(0))+"x"+Str(DesktopDepth(0)))
- Nothing happens

........

Code: Select all

ExamineDesktops()
  f = DesktopFrequency(0)
  If f = 0
    MessageRequester("Display Information", "There isn't set any desktop frequency, the standard hardware frequency is used.")
  Else
    MessageRequester("Display Information", "Frequency of desktop: "+Str(f)+" Hz.")
  EndIf
- Not working
.........

Code: Select all

ExamineDesktops()
  MessageRequester("Display Information", "Current resolution = "+Str(DesktopWidth(0))+"x"+Str(DesktopHeight(0))+"x"+Str(DesktopDepth(0)))
- it does not work

.......... jan 11, 2007 Date Group ........

Code: Select all

Debug Day(Date(2002, 10, 3, 0, 0, 0))  ; Outputs '3'.
- shows nothing

Code: Select all

Debug DayOfWeek(Date(2006, 10, 30, 0, 0, 0))  ; Outputs '1' for Monday.
- shows nothing

Summarizing: Date commands dont work.... at least here!
Post Reply