It is currently Mon Sep 28, 2020 6:44 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 11:27 am 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Hello,
as I wrote some time ago I just started with PureBasic. I hoped for a RibbonGadget, but it's not natively implemented and all efforts creating this have stopped due to legal issues or something else (at least as far as I know). So I took the wheel and started it yesterday. I think my work is already doing great, however, I need some help. This is also my first module, so I need to understand some things that are currently unclear to me. I wanted to seek help in the German forum but again I cannot contact an admin and don't get any email for account reset. My english account works, so here I am.
Image
Here are my questions:
1. Can I use "UseModule" for always just one module at a given time?
2. How can I use constants effectively. I now declare them in the DeclareModule-section and the module itself. This seems not as intended. same question with structures.
3. I want a function "CheckRibbonActivity()" to return the ribbon-item-id and activity. I now use said function just for checking if something has happened at all and "RibbonID()" plus "RibbonEvent()" for further information. Can I pass a variable that is filled with that data, like (and certainly wrong):
Code:
Structure RibbonEvent
  event.i
  id.i
EndStructure
Global RE.RibbonEvent

;Module...
procedure CheckRibbonActivity(event,id)
PeekL(event,#Ribbon_Event_Something)
PeekL(id,my_id)
;...Code
;EndModule...

;Creation etc.
CheckRibbonActivity(@RE\event,@RE\id);or CheckRibbonActivity(@RE)
;More Code...


4. I know how to create threads and stuff. At the moment the function "CheckRibbonActivity()" is called after "WaitWindowEvent()". I know I can remap the processing to my own function (via "SetWindowCallback(...)") and then return to normal. But what if someone wants to use it in the porgram too? Do multiple calls of the function stack and process all functions until the original windowproc is called?
5. Can I make my module publicly accessible (if there is demand) without releasing the source code or creating a DLL? XProfan is able to precompile the code into a precompiled include file that is not readable, but can be included like a normal inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 11:33 am 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1138
1. If you have e.g. two modules with the same function names.... don't use "UseModule".... use it direct "MyModule::Function()"

2. You have only declare the "public" stuff in the declaremodule section. You don't need to declare the Constants and other declare twice....

3. I think you are using gadgets to build this ribbon.... Is BindGadgetEvent an option ?

4. See 3.

5. No ;) modules with the source only.

_________________
PureBasic 5.72 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 64GB RAM | iChill GeForce RTX 2080 Super | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 11:47 am 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Hello Bisonte,
thanks for the answers.

1. It's a hypothetical question.
2. So I always have to declare my constants in the Declare module section AND the module itself if I want to use them in the main program and the module.
3. Nope, hand drawn on a canvas. This way I have full control over behaviour and drawing, colours etc. For now Buttons, Checkboxes, PushButtons work. Also hovering, changing tabs, custom color (not just blue), multiple ribbons in multiple windows. The control is only drawn when something changes, totally flicker fee. I can upload a demo if you want to see it live. But it's still in earliest stage.
4. See 3.
5. Ah crap. I'm not sure if I want to release the source code, but we'll see. There will be a solution.

I also don't plan to clone the ms ribbons but give it a touch of a unique look. That's why some things look a bit different, plus like I wrote above, it's still in its earliest stage.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 1:37 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4933
Location: Germany
Hm... simple test:
Code:
DeclareModule Test
  #Test = 666
 
  Declare.i Test()
   
EndDeclareModule

Module Test
 
  Procedure.i Test()
    Debug #Test
  EndProcedure
 
EndModule


#Test = 999

Debug Test::#Test

Test::Test()


Last edited by infratec on Sun Sep 13, 2020 5:12 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 1:43 pm 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Thanks, I'll test that. It didn't come to my mind to just define them in the Declare section.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Sun Sep 13, 2020 6:31 pm 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Works fine that way, thanks, now I know how to use it.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Tue Sep 15, 2020 7:42 pm 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Just to mention: you can now deactivate elements, change the colour on the fly and the renderer is optimized.

I need a push into right direction regarding message processing and such: of course the ribbon needs to be repainted when the window is resized. Thus is something that is not actively caused by the programming, like adding an element or changing the colour. So I'm thinking about bindgadgetevent() for my canvas. However, there may be too many messages incoming, so when one is processed and the gadget is repainted there's already another coming, repainting and interfering with the first one which is still running. Is there an easy and safe way to process that?
Can I get information like window resizing without redirecting the windowproc or without having the programmer add much code?


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Tue Sep 15, 2020 7:50 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4933
Location: Germany
Code:
 BindEvent(#PB_Event_SizeWindow, @SizeWindowHandler())


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Tue Sep 15, 2020 7:51 pm 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Yes, but what if the programmer wants to use it too?


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Tue Sep 15, 2020 8:19 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4933
Location: Germany
I don't think that this is a problem:
Code:
Procedure Size1()
  Debug "Size1"
EndProcedure


Procedure Size2()
  Debug "Size2"
EndProcedure


If OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
 
  BindEvent(#PB_Event_SizeWindow, @Size1())
  BindEvent(#PB_Event_SizeWindow, @Size2())
 
 
  Repeat
    Event = WaitWindowEvent()

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

  Until Quit = 1
 
EndIf


They are cascaded.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Tue Sep 15, 2020 8:20 pm 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
Oh very great, thanks. That'll help alot.


Top
 Profile  
Reply with quote  
 Post subject: Re: RibbonGadget, but need some help
PostPosted: Wed Sep 16, 2020 5:29 am 
Offline
User
User
User avatar

Joined: Wed Jul 15, 2020 7:10 am
Posts: 30
How do I get systemcolors on Linux and Mac OS similar to windows, e.g. GetSysColor_(COLOR_BTNFACE)?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: minimy and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye