Code Form Helper for Windows

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Code Form Helper for Windows

Post by falsam »

Code Form Helper.
If like me you prefer to code your windows manually, Code Form Helper is for you. Encode your window in your usual editor and select the code of your window. Launch Code Form Helper and finalize the design of your window in the inspector gadget.

Installation.
Add Code Form Helper in Pure Basic tools. Do not forget to assign a key or key combination shortcut to launch it from your editor.

Image

How it works ?.
Select a portion of code containing the gadgets from Pure Basic Editor.
Image

If you code from the official Pure Basic IDE or JaPBe V3 (Philippe Guntz a.k.a. gnozal), it is not necessary to make a copy in memory.
Launch Code Form Helper from the tools menu or use your key shortcut.

Image

Image Image

Hotkeys.
Use inspector gadget or :

Changing the position (Left/Right/Top/Bottom) of a gadget.
Ctrl + Up Arrow or Ctrl + Down Arrow Move gadget up or down.
Ctrl + Left Arrow or Ctrl + Right Arrow Move gadget to the left or right.

Change the size (height / width of a gadget.
Alt + Up Arrow or Ctrl + Down Arrow Edit the height of a gadget.
Alt + Left Arrow or Alt + Right Arrow Change the width of a gadget.

Escape close Code Form Helper.

How to update your code editor Pure Basic?.
Click on the Copy button to copy the code in memory. It is not necessary to select the code.

Close Code Form Helper and now go back to your editor to update the code (Ctrl + V).

Download.

:arrow: Code Form Helper Versions 0.83.zip 91 ko

If you have a problem with your antivirus, you can download the WinRar version.
:arrow: Code Form Helper Versions 0.83.rar 81 ko

Official Link to the French forum. If you have an account, try to post your comments on this link. But do not worry, I'm watching this post. :)
http://www.purebasic.fr/french/viewtopi ... =8&t=13996

My English is very bad, but I'll try to answer your comments. Thank you for your indulgence.
Last edited by falsam on Mon Oct 21, 2013 6:33 pm, edited 4 times in total.

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Code Form Helper for Windows

Post by falsam »

Code Form Helper 0.81 is out.
-Fixed some bugs.

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Code Form Helper for Windows

Post by Kwai chang caine »

Cool idea, thanks FALSAM 8)
Just one question, have you thinking to add a day, the possibility to move the gadget with the mouse ?
ImageThe happiness is a road...
Not a destination
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Code Form Helper for Windows

Post by falsam »

Kwaï chang caïne wrote:Cool idea, thanks FALSAM
Hello KCC. Glad to read you. Long ago that I have not spoken with you. I was wondering if anyone was interested in this tool :mrgreen: ha ha ha
Kwaï chang caïne wrote:Just one question, have you thinking to add a day, the possibility to move the gadget with the mouse ?
Why not .... but I look for a method without API. :)

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Code Form Helper for Windows

Post by Kwai chang caine »

Thanks FALSAM
Me too i'm always happy to talk with you 8) in "frenglish" :oops: :lol:
Hello KCC. Glad to read you. Long ago that I have not spoken with you. I was wondering if anyone was interested in this tool ha ha ha
It's strange because it's really a good idea like numerous of your ideas :shock:
I'm sure someone come a day and see the service this tool can do :wink:

Thanks for your anwer, and again for all the great jobs you do, all the day, since we have the chance to have you in the community 8)
ImageThe happiness is a road...
Not a destination
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Code Form Helper for Windows

Post by falsam »

Code Form Helper 0.83 is out.
-Fixed some bugs.

Goto the first message and download.

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

Re: Code Form Helper for Windows

Post by Axolotl »

Thanks falsam for the nice tool.

Unfortunately I usually create my code with variables as below, because of the resize window stuff....
Do you think it is possible to add some similar feature?

In CreateMainWindow()

Code: Select all

  ww = 650 : wh = 340
  hWnd = OpenWindow(#WndMain, 0, 0, ww, wh, "MainWindowCaption", #PB_Window_SizeGadget|#PB_Window_SystemMenu) 
  If hWnd ;: window exists... 
    ; ... 
    ButtonGadget(#BtnStart, ww-78, 2, 76, 20, "Start") 
    ; ... 
In ResizeMainWindow()

Code: Select all

  ; ...
  ww = WindowWidth(#WndMain) 
  wh = WindowHeight(#WndMain)-StatusBarHeight(#Status)
  ResizeGadget(#BtnStart, ww-78, #PB_Ignore, #PB_Ignore, #PB_Ignore) 
  ; ... 
Hmm. After some minutes - I believe it is the wrong question. Of course it is possible, but are you willing to do it?
Anyway. Please take this as a low priority feature request.

Take care.
Cu Andreas
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Code Form Helper for Windows

Post by falsam »

Hi Axoloti. Difficult to precompile the code and define the variables. I'll take a look :)

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

Re: Code Form Helper for Windows

Post by Axolotl »

Hi falsam,

good to hear.
In the meantime I tried to make a tool outside of PB to show the window by reading the codelines.
I use the following concept to handle this windows size stuff.

The evaluator is from utopiomania....

Code: Select all

;EvalExpr.pbi
;String math expression evaluator,  utopiomania 20070211
I encapsulated it with this

Code: Select all

Procedure.s ExpandFormulaText(Text$) 
  Protected Result$, Formula$, xFormula
  Protected *p.CHARACTER, *chCurr.CHARACTER = @Text$

  While *chCurr\c ! 0 
    Select *chCurr\c
      Case '0' To '9', '.', '-'
        If Not xFormula
          xFormula = #True
        EndIf

      Case '('           ;* valid formula start char
        *p = *chCurr + SizeOf(CHARACTER)
        If (*p\c >= '0' And *p\c <= '9') Or *p\c = '.' Or *p\c = '-'
          xFormula = #True
        EndIf

      Case ' ', '+', '*', '/', ')'     ;* valid formula char
        ;: nothing

      Default                          ;* end a formula
        If xFormula
          xFormula = #False
        EndIf

    EndSelect
    If xFormula
      Formula$ + Chr(*chCurr\c) 
    Else
      If Formula$
        Result$ + Str(MathExpression::Evaluate(Formula$))
        Formula$ = ""
      EndIf
      Result$ + Chr(*chCurr\c)         ;:Debug "  R:'"+Result$+"'"
    EndIf
    *chCurr + SizeOf(CHARACTER)
  Wend
  If Formula$
    Result$ + Str(MathExpression::Evaluate(Formula$))
  EndIf                                ;:Debug "Result = '"+Result$+"'"  :Debug ""
  ProcedureReturn Result$
EndProcedure

Procedure Formula(Text$)
  Protected value, t$, ww, wh

  If IsWindow(#WndViewGadget)
    ww = WindowWidth(#WndViewGadget) : wh = WindowHeight(#WndViewGadget)
  EndIf

  Text$ = ReplaceString(Text$, "WndW", Str(ww))
  Text$ = ReplaceString(Text$, "ww", Str(ww))
  Text$ = ReplaceString(Text$, "WndH", Str(wh))
  Text$ = ReplaceString(Text$, "wh", Str(wh))

  t$ = ExpandFormulaText(Text$)
  If t$
    value = Val(t$)  ;:Debug "Expand: "+t$
  EndIf
  ProcedureReturn value
EndProcedure
As you can see, I use the size of the preview window to replace the WndW, WndH or ww, wh variables.
Have a good time.
Andreas
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
falsam
Enthusiast
Enthusiast
Posts: 632
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Code Form Helper for Windows

Post by falsam »

Thank for your code Axolotl. I get an error when I compile your code but I understand. (Module not found : MathExpression)

➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect 🤪
thanos
Enthusiast
Enthusiast
Posts: 423
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Re: Code Form Helper for Windows

Post by thanos »

@falsam
I just found it! :D
it is an amazing tool for real time corrections in the gadgets.
Smart and efficient.
Congratulations!

Thanos
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Post Reply