Page 2 of 2

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

Posted: Sun Jun 24, 2012 1:29 pm
by takis76
Like some Visual Basic forms you load a lots of gadgets and you see them slowly appear on the screen. Yes I had always this problem when I was programmed with M$ Visual Basic 6 in the past , when my program had a lots of gadgets , I saw them appear one by one and the effect wasn't so nice , complete amateur. Always I was wondered how all of these applications (Photoshops , Offices , and any kinds) draws everything at once.

I like this trick and I will use it , is not so pointless then.
About enumerations above , I have some residues from DarkBasic , in DarkBasic when I had one new image the imageID was 0 and when I had one new sprite the spriteID was 0 too and when I had a new music the musicID was 0 too , because all of these was different objects (For DarkBasic) and my gadgets here I thought was working with the same way.

The #MENU is in the menu kind so it will take 0 number and I thought the #REBAR which is another object but different of the kind and with #TOOLBAR which yet another object but different of the kind then will start with 0.

10 menus from 0-9
10 toolbars from 0-9 too
and 10 rebars from 0-9 too


I was wrong 10 Menus starts from 0 to 9
10 toolbars starts from 10 to 19
and 10 rebars starts from 20 to 29.

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

Posted: Sun Jun 24, 2012 2:01 pm
by electrochrisso
I mod your last code a bit to show how you can put a PB gadget into a rebar.

Code: Select all

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

CreateImage(1,32,32)
StartDrawing(ImageOutput(1))
  Box(0,0,32,32,$00FF00)
  Circle(16,16,14,$FF0000)
StopDrawing()
CreateImage(2,32,32)
StartDrawing(ImageOutput(2))
  Box(0,0,32,32,$FF0000)
  Circle(16,16,14,$00FF00)
StopDrawing()

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), 0, #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)
  
  ;Put a PB Gadget into a Rebar
  ExplorerGadget = ExplorerListGadget(#PB_Any,0,0,700,400,"")
  AddRebarGadget(GadgetID(ExplorerGadget), "", 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
The reason I give you the code before that might seemed a bit complicated is to show you some concepts, like the hide/show window, plus the call back to show how to process the ProGUI events inside the callback, where you would normally jump to a different procedure for each Case, and the image structure will come in handy especially when you have more than a dozen different icons, take a look at the code for the Office example.
The example I gave you is actually a cut down version of one of the ProGUI examples, the examples are your best friend to show how to set up flow of ProGUI, templates you could call them.

Anyway have fun, as far as I am concerned ProGUI Rocks. :)

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

Posted: Sun Jun 24, 2012 4:09 pm
by takis76
I opened one new thread about the events here:

http://www.purebasic.fr/english/viewtop ... 13&t=50339

The examples are very huge and complex to understand them and the documentation is not helpful at all.
If the community wasn't exists and you were total newbie , you can't do nothing.

This callback not help me much , I don't understanding it.
The new post about events above :)