IDE-Tool wie nur Editor anzeigen!

Für allgemeine Fragen zur Programmierung mit PureBasic.
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

IDE-Tool wie nur Editor anzeigen!

Beitrag von Mijikai »

Wie kann ich das Hauptfenster und alle anderen Controls verstecken aber den Editor-Bereich sichtbar lassen?

Was ich bisher versucht habe:

Code: Alles auswählen

EnableExplicit

Global hwnd.i
Global hsub.i

hwnd = Val(GetEnvironmentVariable("PB_TOOL_MainWindow"))
hsub = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))

ShowWindow_(hwnd,#False)
ShowWindow_(hsub,#True)

End
So einfach ist es leider nicht, der Code versteck alles... :S
:coderselixir:
Benutzeravatar
#NULL
Beiträge: 2235
Registriert: 20.04.2006 09:50

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von #NULL »

Vielleicht temporär in ein separates borderless window auslagern, falls sonst nix geht.

<edit>
Ach es geht um PB-IDE Fenster. Keine Ahnung ob das da überhaupt gehen würde.
my pb stuff..
Bild..jedenfalls war das mal so.
Benutzeravatar
RSBasic
Admin
Beiträge: 8022
Registriert: 05.10.2006 18:55
Wohnort: Gernsbach
Kontaktdaten:

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von RSBasic »

Möchtest du einen Fullscreen-Modus haben? Wenn ja, dann kannst du mein Werkzeug benutzen: viewtopic.php?f=11&t=31518
Da PB IDE inzwischen OpenSource ist, könnte man dieses direkt einbauen.
Aus privaten Gründen habe ich leider nicht mehr so viel Zeit wie früher. Bitte habt Verständnis dafür.
Bild
Bild
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von Mijikai »

Ich versuche nur den Editor-Bereich (als rezizeable Popup-Window) zu bekommen (im Bild rot markiert) wenn das irgendwie möglich ist.
Bild
Benutzeravatar
Bisonte
Beiträge: 2430
Registriert: 01.04.2007 20:18

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von Bisonte »

hm .... dafür gibt es eine Einstellungen in den Preferences.
Entferne alle Panele aus der "ToolsPanel" Sektion, dann ist die linke (oder rechte) Seite frei von dem Panel.

und irgendwo gab es auch die Option, das untere Listview zu entfernen, find die grad nicht wieder.
Im Zweifelsfalle das Listview soweit nach unten ziehen wie es geht....
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
Benutzeravatar
#NULL
Beiträge: 2235
Registriert: 20.04.2006 09:50

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von #NULL »

- Alle childs des window verstecken
- das scintilla child wieder anzeigen
- Fenster borderless machen
- scintilla auf Fenstergröße maximieren
- Fenster auf ursprüngliche scintilla größe resizen.
- gucken ob alles kaputt ist :D

Ob und wie das mit Win-API geht weiß ich nicht.
my pb stuff..
Bild..jedenfalls war das mal so.
Axolotl
Beiträge: 155
Registriert: 31.12.2008 16:34

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von Axolotl »

PB-IDE Tools habe ich noch nicht versucht.

Die folgenden API-Funktionen könnten vielleicht in die richtige Richtung schubsen...

Code: Alles auswählen

;' show and hide windows ? 
  SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED) 
  SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED) 
;' Special to #SWP_FRAMECHANGED (acc. to MSDN) 
;'   Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, 
;'   even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only 
;'   when the window's size is being changed. 

;' get window client size 
  GetWindowRect_(hWnd, @rc.RECT) 
  ;' width = rc\right-rc\left 
  ;' height = rc\bottom-rc\top 

;' move to x, y and to the top of the z-order 
  SetWindowPos_(hWnd, #HWND_TOPMOST, x, y, 0, 0, #SWP_NOSIZE|#SWP_NOACTIVATE) 
Um die windows handle zu erhalten habe ich so ein kleines hilfstool (vielleicht hilft es dir ja auch)

Code: Alles auswählen

;' File: WindowUnderCursor.pb 
;' Purpose: shows window under mouse cursor and all its parent windows 
;' License: Free, unrestricted, no warranty 
;' 

Global hMainWnd 

Procedure.s GetClassName(hWnd)
  Protected cn${256} 
  GetClassName_(hWnd, @cn$, 256) 
  ProcedureReturn cn$ 
EndProcedure

Procedure.s GetWindowText(hWnd)
  Protected wt${256} 
  GetWindowText_(hWnd, @wt$, 256) 
  ProcedureReturn wt$ 
EndProcedure

Procedure DebugWindowInfo(Level, hWnd, Text$) 
  Protected s$

  s$ = Space(Level<<1) 
  AddGadgetItem(0, -1, s$+Text$) 
  AddGadgetItem(0, -1, s$+"+ Window Handle: 0x"+Hex(hWnd)+", ("+Str(hWnd)+")")
  AddGadgetItem(0, -1, s$+"+ Classname    : '"+GetClassName(hWnd)+"'")
  AddGadgetItem(0, -1, s$+"+ Window Text  : '"+GetWindowText(hWnd)+"'")
  AddGadgetItem(0, -1, "")  
EndProcedure  


Procedure UpdateWindowInfo(MX, MY)
  Static hCurrentWnd = -1
  Protected hWnd, hWndParent, level 

  hWnd = WindowFromPoint_(MY<<32 | MX)

  If hWnd <> hCurrentWnd And hWnd <> hMainWnd  ;' new window under cursor 
    ClearGadgetItems(0)

    level = 0 
    DebugWindowInfo(level, hWnd, "Window under Cursor")

    hWndParent = GetParent_(hWnd)
    While hWndParent
      level + 1
      DebugWindowInfo(level, hWndParent, "Parent Window (Level "+Str(level)+")") 
      hWndParent = GetParent_(hWndParent)
    Wend 

    hCurrentWnd = hWnd  ;' memorize 
  EndIf 
EndProcedure 

Procedure OnEventSizeWindow() 
  ResizeGadget(0, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0)) 
EndProcedure 


Procedure MainProgram()
  hMainWnd = OpenWindow(0, 0, 0, 600, 400, "Windows ", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget) 
  If hMainWnd <> 0 
    ListViewGadget(0, 0, 0, 600, 400) 
    BindEvent(#PB_Event_SizeWindow, @OnEventSizeWindow(), 0) 
    AddWindowTimer(0, 1, 100) 
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_Timer
          If EventTimer() = 1 
            UpdateWindowInfo(DesktopMouseX(), DesktopMouseY())
          EndIf

        Case #PB_Event_CloseWindow
          Break 
      EndSelect
    ForEver 
    RemoveWindowTimer(0, 1) 
  EndIf
  ProcedureReturn 0
EndProcedure 

End MainProgram()
;­ BoF 
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von Mijikai »

Danke für die Tipps, ich bin schon weitergekommen :)

Bild

Momentan hängt es daran das Editor- aka. Scintilla-Ding auf die Größe des Fensters zu bringen.
Ich vermute das geht nur mit einem #WH_CALLWNDPROC Hook (SetWindowPos_() ging nicht),
da das Ganze wohl im Resize-Event des Fensters gehandhabt wird.
(Wenn die Fenstergröße geändert wird, wird auch der Editor angepasst)

Leider bekomme ich den Hook noch nicht zum laufen...

Hook DLL:

Code: Alles auswählen


EnableExplicit

Global hInstance.i
Global hTarget.i
Global hHook.i

Procedure.i WindowHook(nCode.i,wParam.i,*lParam.CWPSTRUCT)
  If *lParam\hwnd = hTarget
    If *lParam\message = #WM_LBUTTONDOWN
      SendMessage_(hTarget,#WM_NCLBUTTONDOWN,#HTCAPTION,#Null);<- make window moveable without 'caption'
    EndIf
  EndIf
  ProcedureReturn CallNextHookEx_(#Null,nCode,wParam,*lParam)
EndProcedure

ProcedureDLL.i pb_zenHook(hWnd.i)
  Protected tid.i
  If Not hHook And hWnd
    hTarget = hWnd
    GetWindowThreadProcessId_(hTarget,@tid)
    hHook = SetWindowsHookEx_(#WH_CALLWNDPROC,@WindowHook(),hInstance,tid)
    ProcedureReturn hHook
  EndIf
  ProcedureReturn #False
EndProcedure

ProcedureDLL.i pb_zenUnhook()
  If hHook
    UnhookWindowsHookEx_(hHook)
    hHook = #Null
  EndIf
  ProcedureReturn #Null
EndProcedure

ProcedureDLL.i AttachThread(Instance.i)
  hInstance = Instance
EndProcedure
Hook Test:

Code: Alles auswählen

EnableExplicit

Import "pbzen.lib"
  pb_zenHook.i(hwnd.i)
  pb_zenUnhook.i()
EndImport

Procedure.s WindowName(hwnd.i)
  Protected buffer.s
  buffer = Space(#MAX_PATH)
  If GetWindowText_(hwnd,@buffer,#MAX_PATH)
    ProcedureReturn buffer
  EndIf
  ProcedureReturn #Null$
EndProcedure

Procedure.i WindowEnum(hwnd.i,*hwnd.Integer)
  If FindString(WindowName(hwnd),"PureBasic")
    *hwnd\i = hwnd
    ProcedureReturn #False  
  EndIf
  ProcedureReturn #True
EndProcedure

Procedure.i WindowPureBasic()
  Protected hwnd.i
  EnumWindows_(@WindowEnum(),@hwnd)
  ProcedureReturn hwnd
EndProcedure

Procedure.i Main()
  Protected hwnd.i
  Protected hook.i
  If OpenConsole("Hook-Test")
    hwnd = WindowPureBasic();<- get the purebasic window
    If hwnd
      hook = pb_zenHook(hwnd);<- trying to install the hook
    EndIf
    PrintN("Window Handle = 0x" + Hex(hwnd))
    PrintN("Hook = 0x" + Hex(hook)) 
    Input()
    If hook
      pb_zenUnhook()
    EndIf
    CloseConsole()
  EndIf
  ProcedureReturn #Null
EndProcedure

Main()

End
Der Hook wird nie 'installiert' :|
Was mache ich falsch?
Axolotl
Beiträge: 155
Registriert: 31.12.2008 16:34

Re: IDE-Tool wie nur Editor anzeigen!

Beitrag von Axolotl »

Mmmh. Hooks sind mir ein Graus und DLLs mag ich auch nicht so .. (aber sonst macht programmieren Spaß) :-)

Hier mal ein Code, der dir von jedem Hauptfenster den Start und das Ende des Move, Size Events anzeigt.

Code: Alles auswählen

EnableExplicit 

#EVENT_SYSTEM_MOVESIZEEND   = $000B 
#EVENT_SYSTEM_MOVESIZESTART = $000A 


#WINEVENT_SKIPOWNPROCESS  = 2
#WINEVENT_OUTOFCONTEXT    = 0


Enumeration
  #GADGET_List
  #GADGET_Start
  #GADGET_Stop
EndEnumeration


;' gui stuff 
Procedure UpdateButtonState(xHookIsOn) 
  DisableGadget(#GADGET_Start, xHookIsOn)
  DisableGadget(#GADGET_Stop, 1-xHookIsOn)
EndProcedure

Procedure AddText(Text$) 
  AddGadgetItem(#GADGET_List, -1, Text$) 
  SetGadgetState(#GADGET_List, CountGadgetItems(#GADGET_List)-1) 
EndProcedure


;' System 

Procedure.s GetClassName(hWnd)  ;' returns the class name 
  Protected cn${256} 
  GetClassName_(hWnd, @cn$, 256) 
  ProcedureReturn cn$  
EndProcedure ;() 

Procedure.s GetWindowText(hWnd)  ;' returns the window text (i.e. Caption) 
  Protected t${256} 
  GetClassName_(hWnd, @t$, 256)  
  ProcedureReturn t$  
EndProcedure ;() 


;' Callback / Hook 

Procedure EventProc(hWinEventHook.l, event.l, hwnd.l, idObject.l, idChild.l, idEventThread.l, dwmsEventTime.l)
  Protected rc.RECT

  Select event
    Case #EVENT_SYSTEM_MOVESIZESTART
      AddText("Start move size : 0x"+Hex(hwnd)+" - "+GetWindowText(hwnd)+" -- "+GetClassName(hwnd))

    Case #EVENT_SYSTEM_MOVESIZEEND
      GetWindowRect_(hWnd, @rc) 
      AddText("End   move size : 0x"+Hex(hwnd)+" - "+GetWindowText(hwnd)+" -- "+GetClassName(hwnd)+" > "+Str(rc\left)+","+Str(rc\top)+","+Str(rc\right)+","+Str(rc\bottom))

  EndSelect
EndProcedure


;' Main 
Define hWndHook 

If OpenWindow(0, 0, 0, 600, 400, "Test Hook (without DLL) ", #PB_Window_SystemMenu) 
  ListViewGadget(#GADGET_List, 5, 5, 590, 370)
  ButtonGadget(#GADGET_Start,  5, 375, 120, 20, "Install Hook")
  ButtonGadget(#GADGET_Stop, 130, 375, 120, 20, "Remove Hook")   
  DisableGadget(#GADGET_Stop, 1)

  Repeat
    Select WaitWindowEvent() 
      Case #PB_Event_CloseWindow : Break 
      Case #PB_Event_Gadget 
        Select EventGadget() 
          Case #GADGET_Start
            hWndHook = SetWinEventHook_(#EVENT_SYSTEM_MOVESIZESTART, #EVENT_SYSTEM_MOVESIZEEND, 0, @EventProc(), 0, 0, #WINEVENT_SKIPOWNPROCESS | #WINEVENT_OUTOFCONTEXT)
            If hWndHook 
              UpdateButtonState(#True) 
              AddText("=> Hook installed 0x"+Hex(hWndHook))
            EndIf 

          Case #GADGET_Stop
            UpdateButtonState(#False) 
            AddText("=> Hook removed ") 
            If hWndHook
              UnhookWinEvent_(hWndHook) 
              hWndHook = 0 
            EndIf
        EndSelect 
    EndSelect 
  ForEver 

  If hWndHook 
    UnhookWinEvent_(hWndHook)
  EndIf
EndIf 
End ;' bye 
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
Antworten