Page 1 of 2

Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 1:36 am
by takis76
Hello my friends,

I am continue the creation of my game and soon I will have a new version out and a new website.

Today I decided to give another one try to window commands of PureBasic , last time months ago I was tried I didn't understand much and I quit using the window commands of the Language. So now I would like to look in window making commands AGAIN , I tried and other languages , but the windows commands aren't complete (Looooong Story - The reason , I was lost from this forums for long time).

I have created one window which closes from X button only one menu which does nothing and one toolbar.
The toolbar will have some bmp images 32x32 , I created the toolbar , but I saw the native purebasic commands don't allows (I don't know Why?) to change the size of the toolbar buttons and as always (And this is the reason , I left the windows commands , was these API commands which there is no documentation nowhere). I wonder where did you found, how these API commands work and what do they mean. I have the language for about 1 year and I use it 50% and even less. Is a nice language , have nice IDE , is fast but , uses directx 7 for graphics which are very old and in window 8 there will not be backwards compatibility for directx 11 , all directx 7 native commands are difficult and very old and I use DarkBasic DarkGDK plugin for DirectX 9 to make all kind of effect , transparent and any kind of sprites etc.. this is another story.

So I use only 30% of the language , the native directx 7 is old and I don't understand these API and all of these windows commands. So I will give a try to windows commands at least to use 60% of the PureBasic and the rest 2D and 3D effects with DarkGDK.
I think , if this language will not updated , to directx 9 and be compatible with directx 10 or 11 , then will die. Directx 7 is very old and all of these complex sprite like and image commands are very complex and I never did nothing , DarkGDK saved me for this. There are posts in the forums about this and I have complain in the past , I am not use the directx 7 native purebasic commands anymore.
If Fantaisie Software is interesting to make updates and change a lots of functions and make everything simpler and add a lots of missing functios , which you need chenese API code then is well , else the language will die.

I tried and other languages , but as I saw the Basic Language world is very problematic and outdated and in generic the Basic Languages are not so professional for game making , even the technology have improved dramatically , the conclusion is , do not make game with Basic Language. I tried many Basics in the past , I have to say , PureBasic made the work better , but is not enough , I am using 3 different lagnuages and plugins to make one game.



Anyway , I search in the forums and I found some (not understanding API commands) and I manage to change the size of the button of my toolbar from unchanged default 16x16 to 32x32 (Why are you making the life of programmer difficult?) why doesn't exist some command with name like just set_toolbar_image_size(w,h) and that's it and you need to write chinese API code to just change the size of the button of the toolbar with one command instead to write 10 lines of _ unknown commands , macros and SendMessages_.
Sometimes , I think this language is incomplete.

The code of my window with the menu and toolbar is bellow

Code: Select all

LoadImage(1,"wall_tool.bmp")

Macro SetToolBarIconSize(ToolBar, IconSize) 
    
   SendMessage_(ToolBarID(ToolBar), #TB_SETBITMAPSIZE, 1, (IconSize << 16) + IconSize) 
   ImageList_SetIconSize_(SendMessage_(ToolBarID(ToolBar), #TB_GETIMAGELIST, (IconSize << 16), 0) , IconSize , IconSize) 
   SendMessage_(ToolBarID(ToolBar), #TB_AUTOSIZE, 0, 0) 
    
EndMacro 

If OpenWindow(main_window, 50, 50, 700, 500, "Eye of the Beholder IV - Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  
  If CreateMenu(adventure_menu, WindowID(main_window))  
    MenuTitle("Adventure")
    MenuItem(1, "New Adventure")
    MenuItem(2, "Load Adventure")
    MenuItem(3, "Save Adventure")
    MenuBar() 
    MenuItem(4, "Adventure Properties")
    MenuBar() 
    MenuItem(5, "Exit Editor")

    
  EndIf
  
  If CreateToolBar(tools, WindowID(main_window))
    If CreateToolBar(tools, WindowID(main_window))
      ToolBarImageButton(0,ImageID(1),#PB_ToolBar_Toggle)

      SetToolBarIconSize(tools, 32)
      
    EndIf

  EndIf
  
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf

The problem is , I manage to change the size from default 16x16 to 32x32 of the button of the toolbar , but the icon remains 16x16 and I see the one quarter of the icon on the toolbar button.
Any chinese API to correct this?

Thank you , at least , I have the help from the community.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 3:46 am
by RASHAD
Adapt it for your needs

Code: Select all

    CreateImage(0,32,32)
    StartDrawing(ImageOutput(0))
      Box(0,0,32,32,RGB(255,255,255))
      Box(4,4,24,24,RGB(255,0,0))
    StopDrawing()
    
    CreateImage(1,32,32)
    StartDrawing(ImageOutput(1))
      Box(0,0,32,32,RGB(255,0,0))
      Box(4,4,24,24,RGB(255,255,255))
    StopDrawing()


If OpenWindow(main_window, 0, 0, 700, 500, "Eye of the Beholder IV - Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  
  If CreateMenu(adventure_menu, WindowID(main_window))  
    MenuTitle("Adventure")
    MenuItem(1, "New Adventure")
    MenuItem(2, "Load Adventure")
    MenuItem(3, "Save Adventure")
    MenuBar() 
    MenuItem(4, "Adventure Properties")
    MenuBar() 
    MenuItem(5, "Exit Editor")

    
  EndIf
  
    If CreateToolBar(tools, WindowID(main_window))
    ToolBarID = ToolBarID(tools)
    TBIL = SendMessage_(ToolBarID, #TB_GETIMAGELIST , 0, 0)
    ImageList_SetIconSize_(TBIL,32,32)

    SendMessage_(ToolBarID,#TB_SETBUTTONSIZE,0,32 | 34 << 16)
    SendMessage_(ToolBarID,#TB_AUTOSIZE,0,0)
    
    ToolBarImageButton(tools,ImageID(0),#PB_ToolBar_Toggle)
    ToolBarImageButton(tools,ImageID(1),#PB_ToolBar_Toggle)

     
    EndIf

  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf


Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 6:19 pm
by takis76
Thank you very much it worked with little changes.
The fewest code:

Code: Select all

    If CreateToolBar(ToolBar, WindowID(main_window))
      
      TBIL = SendMessage_(ToolBarID(ToolBar), #TB_GETIMAGELIST , 0, 0)
      ImageList_SetIconSize_(TBIL,32,32)

      SendMessage_(ToolBarID(ToolBar),#TB_SETBUTTONSIZE,0,32 | 34 << 16)
      SendMessage_(ToolBarID(ToolBar),#TB_AUTOSIZE,0,0)
    
      ToolBarImageButton(0,ImageID(1),#PB_ToolBar_Toggle)
    
    EndIf
Thank you very much , I will try some canvas gadget now.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 7:04 pm
by Ramihyn_
Hi again Takis :)

Just wondering if you know about http://www.progui.co.uk/index.html - tough it will limit you to windows only (just like your API commands).

Windows API documentation is here: http://msdn.microsoft.com/en-us/windows/desktop

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 9:07 pm
by takis76
As I know proGUI , is for menus. Make the menus like MS-OFFICE nothing else.

The gadger system in PureBasic is not limilar to other kinds of gadget systems. For example I have tried Gui Systems from DarkBasic and BlitzMax and was much easier to make something , (Even incomplete)

for example all gadgets when you was create them , they created on a parent gadget.

For example if you create one window with variable main_window , the panel gadget or canvas gadget was created on the parent gadget , here is PureBasic you create the gadget , but is not on the parent gadget.

For example in BlitzMax I used to have a code like this:

Code: Select all

main_window = CreateWindow(AppTitle, 0, 0, 1018, 700, Null, WINDOW_TITLEBAR | WINDOW_CENTER | WINDOW_MENU)
The main_window is the window gadget.

If I want to put a panel gadget on the window I use some code like this

Code: Select all

map_panel = CreatePanel(0, 0, GadgetWidth(main_window) - 5, GadgetHeight(main_window) - 52, main_window, PANEL_SUNKEN, "")
The panel gadget and all gadgets have special argument to put the gadget in specific parent gadget in this case is the main_window and there is and style argument in panel gadget function, which you can make the panel and any kind of gadgets , SUNKEN , RAISED , FLAT , WITH BORDER.

Here in PureBasic gadgets , there are not extra arguments for the parent gadget and the styles. and this gadget list functions I cant understand them.

For example

Code: Select all

    If PanelGadget(Window_panel, 0, 40, 700, 400)
    EndIf
Why (if) and why the parent is missing where this panelgadget will be created and how will be the style?
Why all gadgets need to have an (if) on the creation?

These complexities prevent me to use the PureBasic's window gadget system.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 9:44 pm
by Ramihyn_
takis76 wrote:As I know proGUI , is for menus. Make the menus like MS-OFFICE nothing else.
You didnt even look at the screenshots, into the documentation or try the examples?

Image

Exactly what you tried to achieve :)
takis76 wrote:These complexities prevent me to use the PureBasic's window gadget system.
We could start to discuss all these things and point at the manual and many examples which explain them, but why making things so complicated? Personally i use the excellent PureVisionXP to design GUI's for PureBasic:

http://purevision.reelmedia.org/screenshots.stm

or alternatively you could use the free PureForm designer. The build-in Visual Designer is too outdated.

PureVisionXP can create the complete PureBasic GUI code for you, including the PureBasic event loop so you can instantly edit that and work on your application. It lowers your frustration in the beginning and gives you a headstart to be productive much quicker :)

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 9:55 pm
by void
takis76 wrote:For example

Code: Select all

    If PanelGadget(Window_panel, 0, 40, 700, 400)
    EndIf
Why (if) and why the parent is missing where this panelgadget will be created and how will be the style?
Why all gadgets need to have an (if) on the creation?

These complexities prevent me to use the PureBasic's window gadget system.
Pretty much everything in purebasic that introduces new state to the application has a return code. The usage of if is to verify that the panel was, in fact, successfully created.

You could omit that, but if it's possible for the object creation to fail, you run the risk of failing to handle an error.

That said, even the PanelGadget example code over on this page leaves off the conditional for each gadget.

As for specifying the parent, that's based on the current GadgetList; when you create a gadget that can hold other gadgets, you're switched to that gadgetlist. You can use opengadgetlist to specify a new parent for what you're about to do next. (just be sure you're using CloseGadgetList for parents you're done with!)

Personally, I think as small community languages' built-in libraries go, PureBasic's windowing library is freaking fantastic.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Thu Jun 21, 2012 11:22 pm
by takis76
I have seen proGUI library many times , but now you have convinced me , I will download some demo and see if I will purchase.

I would like to ask. What is the difference between Gold and Platinum version , Gold includes source code , the Platinum?
They say something about major updates , if you purchase the Gold , will you not take the updates?
So if the labrary become outdated what you do? don't they provide updates in Gold and Standard versions?
What major updates? Updates after 10 years in windows 9? I will purchase Gold then (If do I ever use the source code).


Have anyone used and still use proGUI , the problem is not about how the gui is , but how the commands work and avoid all these complexities. If you can create everything without APIs , it will be nice (I read the documentation). Seems promising

I don't need yet another super skinned library and the programming and commands will be very dificult.
If the commands are difficult , I will purchase it and I will left it in my hard disk eat cyber dust as many programming languages and softwares I have purchased in the past.

About form editors , I am not very fun of form editors , because I create visually everything and then generates one huge code which I cant understand , is pointless to create everything automatically and then don't know how to make changes the best way for me to learn is to write everything by hand manually and understand all commands , command by command.

Thank you for your info. I just want to create a very nice game and give it to you as gift , because you are helping me.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Fri Jun 22, 2012 12:07 am
by Ramihyn_
takis76 wrote:About form editors , I am not very fun of form editors , because I create visually everything and then generates one huge code which I cant understand , is pointless to create everything automatically and then don't know how to make changes the best way for me to learn is to write everything by hand manually and understand all commands , command by command.
PureVisionXP exports 2 files by default. One contains all the constants of the windows, gadgets/controls and the other file contains the source for the individual forms/windows you created. You include both files and dont need to touch them at all (in 99.9% of the cases). Additionally you can let PureVisionXP create the event loop into a seperate PureBasic source file. I usually just do that once when i start a new project, because you will edit and change the event loop to fit your application.

If you want to make design changes of your existing GUI, you do that completely visually in PureVisionXP by loading the existing GUI and changing it as you wish. Then you export the 2 source files with the constants and form/window routines again and copy them into your project directory to replace the old version. If you added a window, you now manually edit your existing event loop (thats how i do it).

The generated code is plain and easy to understand, you can actually edit it and use it to learn how the gadget/windows/event stuff works in PureBasic (make a simple window with buttons/menus/listview, let PureVisionXP export the source and look at the exported source to understand how it works). You dont need to edit the created source files usually, you completely work visually inside PureVisionXP to create and change your GUI.

I think the free PureForm editor works pretty much the same, but i don't use that one. Just try one of them to see how they speed up your GUI development with PureBasic - you wont regret it and even the commercial PureVisionXP is really dirt cheap.

I don't use ProGUI, so i cant say how well it works together with Form Designers like PureVisionXP or PureForm.

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Fri Jun 22, 2012 1:44 am
by electrochrisso
I would like to ask. What is the difference between Gold and Platinum version , Gold includes source code , the Platinum?
They say something about major updates , if you purchase the Gold , will you not take the updates?
So if the labrary become outdated what you do? don't they provide updates in Gold and Standard versions?
What major updates? Updates after 10 years in windows 9? I will purchase Gold then (If do I ever use the source code).
Read this: http://www.progui.co.uk/update_policy.html
Major update 2 is the next one, with the Gold, each major update after that one will cost 15 Euros to upgrade.
If you get the Platinum all updates are free, forever, if you read the roadmap http://www.progui.co.uk/phpBB/viewtopic.php?f=2&t=41 it will give you an idea of what the future holds for ProGUI.

I think you will find ProGUI will be a good option for animation/game programming too.
I have gone Platinum, and have been using ProGUI for a while now, the graphics rendering is smooth and highly optimised.
Have anyone used and still use proGUI , the problem is not about how the gui is , but how the commands work and avoid all these complexities. If you can create everything without APIs , it will be nice (I read the documentation). Seems promising
All you need to do is download the fully functioning demo version and see if it works for you. :)

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Sun Jun 24, 2012 1:23 am
by takis76
I downloaded and Installed one demo version to see what I can create and then I will decide to purchase.

For the first look , the library is very nice , I created one menu and one toolbar and I have to say , I create it very easily.

Does anyone from you , know how to use the ProGui well?

I have one problem , I created one menu and one toolbar , but the menu and toolbar overlaps one to each other.

The code:

Code: Select all

StartProGUI("", 0, 0, 0, 0, 0, 0, 0)

LoadImage(1,"wall_tool.bmp")
LoadImage(2,"wall_tool_selected.bmp")

LoadImage(3,"door_tool.bmp")
LoadImage(4,"door_tool_selected.bmp")

LoadImage(5,"wall_decoration_tool.bmp")
LoadImage(6,"wall_decoration_tool_selected.bmp")

Global toolbar.i
Global wall_tool.i
Global program_menu.i
Global adventure_menu.i

If OpenWindow(main_window, 50, 50, 700, 500, "Eye of the Beholder IV - Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  LimitWindowSize(WindowID(main_window), 700, 500, 0, 0)
  
  program_menu = CreateMenuEx(#ProGUI_Any , WindowID(main_window), #UISTYLE_WHIDBEY) 

  MenuTitleEx("Adventure")
  
  MenuItemEx(1, "New Adventure", ImageID(1), ImageID(2), null, 0)
  
  toolbar = CreateToolBarEx(#ProGUI_Any  ,WindowID(main_window),32,32,#TBSTYLE_HIDECLIPPEDBUTTONS|#UISTYLE_OFFICE2003)
  
    wall_tool = InsertToolBarImageButtonEx(toolbar, 1, 1, "", ImageID(1), ImageID(2), 1, #BTNS_CHECK)
    door_tool = InsertToolBarImageButtonEx(toolbar, 2, 2, "", ImageID(3), ImageID(4), 1, #BTNS_CHECK)
    wall_decoration_tool = InsertToolBarImageButtonEx(toolbar, 2, 3, "", ImageID(5), ImageID(6), 1, #BTNS_CHECK)


  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
On images 1-6 above put any 32x32 image.

why my menu is overlapping with toolbar?
I saw some examples which menus and toolbars not overlaps , but I didn't understand how in the example the menus not overlaps.

Just copy and paste my above code to see what is happen.

So far the library seems to be very nice , the menus are very professional. I played with some styles are very nice.
And so far menus and toolbar creation commands seems to be easy and works with parent gadget style.

And one silly quesion out of topic , but always I was looking how to make it.
Is it possible to have a comment block , the comments mark with ";" semi colon symbol , if I want to have a large block of comments do I need to put infinity amount of semi colons? is it possible to put something like /* */ (C++) or rem start and rem end (DarkBasic) or something to know when the comment block starts and ends.

Thank you :)

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Sun Jun 24, 2012 6:10 am
by electrochrisso
The following code is the basic outline you need.
Replace the image names, with your Normal, Hot, Disabled images.
Using a structure for images is the best way to go.

Code: Select all

StartProGUI("", 0, 0, 0, 0, 0, 0, 0)

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #MENU_0
  #REBAR_0
  #TOOLBAR_0
EndEnumeration

Structure images
  normal.i
  hot.i
  disabled.i
EndStructure

Global Dim image.images(9)

image(0)\normal=LoadImg("icons\advanced.ico", 32, 32, 0)
image(0)\hot=LoadImg("icons\advanced_h.ico", 32, 32, 0)
image(0)\disabled=LoadImg("icons\advanced_d.ico", 32, 32, 0)

image(1)\normal=LoadImg("icons\color.ico", 32, 32, 0)
image(1)\hot=LoadImg("icons\color_h.ico", 32, 32, 0)
image(1)\disabled=LoadImg("icons\color_d.ico", 32, 32, 0)

image(2)\normal=LoadImg("icons\music 2.ico", 32, 32, 0)
image(2)\hot=LoadImg("icons\music 2_h.ico", 32, 32, 0)
image(2)\disabled=LoadImg("icons\music 2_d.ico", 32, 32, 0)

Procedure ProGUI_EventCallback(hwnd, message, wParam, lParam)
  
  Select message
      
      ; handle selection of menu items and toolbar items
    Case #WM_COMMAND
      
      If HWord(wParam) = 0 ; is an ID
        
        MenuID = LWord(wParam)
        
        Select MenuID
          Case 0
            Debug "Adventure Selected"
          Case 1
            Debug "Play Selected"
          Case 2
            Debug "Color Selected"
          Case 3
            Debug "Music Selected"
        EndSelect
      EndIf
  EndSelect
  
  ProcedureReturn #PB_ProcessPureBasicEvents
  
EndProcedure

; creates a window
Procedure Open_Window_0()
  
  OpenWindow(#Window_0, 50, 50, 800, 500, "takis76", #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_Invisible)
  
  ; main menu
  menu = CreateMenuEx(#MENU_0, WindowID(#Window_0), #UISTYLE_WHIDBEY)
  MenuTitleEx("Adventure")
  MenuItemEx(0, "New Adventure", image(0)\normal, image(0)\hot, image(0)\disabled, 0)
  
  ; create toolbar
  toolbar = CreateToolBarEx(#TOOLBAR_0, WindowID(#Window_0), 32, 32, #TBSTYLE_HIDECLIPPEDBUTTONS)
  
  ToolBarImageButtonEx(1, "Play", image(0)\normal, image(0)\hot, image(0)\disabled, #BTNS_AUTOSIZE)
  ToolBarImageButtonEx(2, "Color", image(1)\normal, image(1)\hot, image(1)\disabled, #BTNS_AUTOSIZE)
  ToolBarImageButtonEx(3, "Music", image(2)\normal, image(2)\hot, image(2)\disabled, #BTNS_AUTOSIZE)
  
  ; create a rebar
  CreateRebar(#REBAR_0, WindowID(#Window_0), 0, #RBS_VARHEIGHT | #RBS_BANDBORDERS, 0)
  
  AddRebarGadget(menu, "", 0, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE)
  AddRebarGadget(toolbar, "", 620, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE | #RBBS_USECHEVRON)
  
  ; attach our events callback for processing Windows ProGUI messages
  SetWindowCallback(@ProGUI_EventCallback())
  
EndProcedure


Open_Window_0() ; create window
HideWindow(0, 0)  ; show our newly created window

; enter main event loop
Repeat
  
  Event = WaitWindowEvent()
  
Until Event = #WM_CLOSE

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Sun Jun 24, 2012 11:01 am
by takis76
Why are you complexing things up again?

If I will use a structure for images the menu with toolbar will not overlap?


As I understand all the game is on the CreateRebar function , if I copy and paste your programm is pointless because I can't understand what all means above.

Why are you create the window invisible and the use HideWindow(0, 0) to show it after invisible creation?

About image structure I will use them later on , I am using for now static variable images just learn how things work.


The code with this order overlaps the gadgets even I use rebar:

Code: Select all

If OpenWindow(main_window, 50, 50, 700, 500, "Eye of the Beholder IV - Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered| #PB_Window_Invisible)
  LimitWindowSize(WindowID(main_window), 700, 500, 0, 0)
  

  program_menu = CreateMenuEx(#ProGUI_Any , WindowID(main_window), #UISTYLE_WHIDBEY) 
  MenuTitleEx("Adventure")
  MenuItemEx(0, "New Adventure", 1, 2, null, 0)
  
  
  toolbar = CreateToolBarEx(#ProGUI_Any  ,WindowID(main_window),32,32,#TBSTYLE_HIDECLIPPEDBUTTONS|#UISTYLE_OFFICE2003)
  ToolBarImageButtonEx(1, "", ImageID(1), ImageID(2), null, #BTNS_AUTOSIZE)
  
  
  CreateRebar(0, WindowID(main_window), 0, #RBS_VARHEIGHT | #RBS_BANDBORDERS, 0)
  
  AddRebarGadget(program_menu, "", 0, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE)
  AddRebarGadget(toolbar, "", 620, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE | #RBBS_USECHEVRON)


  
  HideWindow(0, 0)

  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
#PB_Window_Invisible and HideWindow(0, 0) are pointless.

If I put the gadgets in this order not overlaps , but the result is not the desirable

Code: Select all

  ;Create the empty menu
  program_menu = CreateMenuEx(#ProGUI_Any , WindowID(main_window), #UISTYLE_WHIDBEY) 
  
  ;Create the empty toolbar
  toolbar = CreateToolBarEx(#ProGUI_Any  ,WindowID(main_window),32,32,#TBSTYLE_HIDECLIPPEDBUTTONS|#UISTYLE_OFFICE2003)
  
  ;create the empty rebar
  CreateRebar(0, WindowID(main_window), 0, #RBS_VARHEIGHT | #RBS_BANDBORDERS, 0)
  AddRebarGadget(program_menu, "", 0, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE)
  AddRebarGadget(toolbar, "", 620, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE | #RBBS_USECHEVRON)
  
  
  ;Add items to menu
  MenuTitleEx("Adventure")
  MenuItemEx(0, "New Adventure", 1, 2, null, 0)
  
  ;add items to toolbar
  ToolBarImageButtonEx(1, "", ImageID(1), ImageID(2), null, #BTNS_AUTOSIZE)


Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Sun Jun 24, 2012 12:10 pm
by takis76
The problem was fixed using Enumerations for each gadget , each gadget is unique and the enumeration increase the order
of the list of variables inside the enumeration nest by one.
Is similar to say

Code: Select all

#MENU_0=0
#REBAR_0=1
#TOOLBAR_0=2
As I understood , if you have 0 in all gadget creation variables , then the windows system sees them as one layer and put them on the gadget 0 and then overlap.

Code: Select all

Enumeration
  #MENU_0
  #REBAR_0
  #TOOLBAR_0
EndEnumeration


If OpenWindow(main_window, 50, 50, 700, 500, "Eye of the Beholder IV - Editor", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  LimitWindowSize(WindowID(main_window), 700, 500, 0, 0)
  
  program_menu = CreateMenuEx(#MENU_0 , WindowID(main_window), #UISTYLE_WHIDBEY) 
  MenuTitleEx("Adventure")
  MenuItemEx(0, "New Adventure", 1, 2, null, 0)
  
  toolbar = CreateToolBarEx(#TOOLBAR_0  ,WindowID(main_window),32,32,#TBSTYLE_HIDECLIPPEDBUTTONS|#UISTYLE_OFFICE2003)
  ToolBarImageButtonEx(1, "", ImageID(1), ImageID(2), null, #BTNS_AUTOSIZE)
  
  CreateRebar(#REBAR_0, WindowID(main_window), 0, #RBS_VARHEIGHT | #RBS_BANDBORDERS, 0)
  AddRebarGadget(program_menu, "", 0, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE)
  AddRebarGadget(toolbar, "", 620, 0, 0, 0, #RBBS_BREAK | #RBBS_NOGRIPPER | #RBBS_CHILDEDGE | #RBBS_USECHEVRON)

  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf
So the important thing is to understand what I program and don't just copy and paste your valuable code you give me.
Thank you very very much :)

Re: Toolbar problem - Giving a try to window commands AGAIN

Posted: Sun Jun 24, 2012 12:32 pm
by electrochrisso
Edit:
I have changed this post takis, we were typing at the same time, good to see you are getting to grips with ProGUI, it does take a little bit of understanding at first but you will get there, I still have a lot to learn myself. :)
Why are you create the window invisible and the use HideWindow(0, 0) to show it after invisible creation?
Because it is the best way to set the window up with all the gadgets etc. first, then the window will display everything instantly, rather than have a staggered render, especially useful if there are a lot of gadgets to be set up, a much more professional approach.