Dialog for the compiler options

Working on new editor enhancements?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

I wanted to test my dialog editor and did this dialog for the compiler options, it has the same look.

if someone finds it useful i could do the same for the config tools window.

Code: Select all

;Purebasic Window Editor v2.9

;Dialog for PB Editor Compiler Options
;Justin 02/03

;GADGET IDs
#CB_ICON=0
#ED_ICON=1
#BT_BROWSE=2
#CB_ASM=3
#CB_NT=4
#CB_XP=5
#TXT_EXE=6
#COMBO_EXE=7
#TXT_CMD_LINE=8
#ED_CMD_LINE=9
#BT_OK=10
#BT_CANCEL=11

;Dialog Procedure
Procedure Dialog1proc(hdlg,msg,wparam,lparam)
  shared hbrowse,hicon ;control handles
  Select msg
    ;ret=0
    Case #WM_INITDIALOG
      ;get ctrl handles
      hbrowse=getdlgitem_(hdlg,#BT_BROWSE) : hicon=getdlgitem_(hdlg,#ED_ICON)
      ;disable icon items
      enablewindow_(hbrowse,0) : enablewindow_(hicon,0)

      ;fill combo
      SendDlgItemMessage_(hdlg,#COMBO_EXE,#CB_ADDSTRING,0,"Windows")
      SendDlgItemMessage_(hdlg,#COMBO_EXE,#CB_ADDSTRING,0,"Console") 
      SendDlgItemMessage_(hdlg,#COMBO_EXE,#CB_ADDSTRING,0,"Shared Dll") 
      ;show 1st item
      SendDlgItemMessage_(hdlg,#COMBO_EXE,#CB_SETCURSEL,0,0) 

    Case #WM_COMMAND
      select wparam>>16
        case #BN_CLICKED
          select wparam
            
            case #CB_ICON ;check pushed, enable/disable icon items
              if IsWindowEnabled_(hicon) 
                enablewindow_(hicon,0) : enablewindow_(hbrowse,0)
              else
                enablewindow_(hicon,1) : enablewindow_(hbrowse,1)
              endif

            case #BT_BROWSE ;browse icon
              iconname$=OpenFileRequester("","","Icon files (*.ico)|*ico|All (*.*)|*.*",0)
              ;set text
              if iconname$"" : SetDlgItemText_(hdlg,#ED_ICON,iconname$) : endif

            case #BT_OK ;get values
              ;check boxes
              useicon=IsDlgButtonChecked_(hdlg,#CB_ICON)
              enableasm=IsDlgButtonChecked_(hdlg,#CB_ASM)
              enablent=IsDlgButtonChecked_(hdlg,#CB_NT)
              enablexp=IsDlgButtonChecked_(hdlg,#CB_XP)

              ;txt
              iconname$=space(255) : GetDlgItemText_(hdlg,#ED_ICON,@iconname$,255)
              cmdline$=space(1000) : GetDlgItemText_(hdlg,#ED_CMD_LINE,@cmdline$,1000)
              exeformat$=space(30) : GetDlgItemText_(hdlg,#COMBO_EXE,@exeformat$,30)

              messagerequester("",iconname$ + " " + cmdline$ + " " + exeformat$,0)
              
            case #BT_CANCEL ;close dialog
              EndDialog_(hdlg,1)  

          endselect
      endselect

    Case #WM_CLOSE
      EndDialog_(hdlg,1)

  EndSelect
  ProcedureReturn 0 ;ret
EndProcedure

hdlg=DialogBoxIndirectParam_(0,?dialogdata,0,@Dialog1proc(),0)
End

;DIALOG TEMPLATE
datasection
dialogdata:
data.b  192,0,204,20,  0,0,0,1,  12,0,  170,0,  72,0,  194,0,  147,0
data.b  0,0,  0,0,  67,0,111,0,109,0,112,0,105,0,108,0,101,0,114,0,32,0,79,0,112,0,116,0,105,0,111,0,110,0,115,0,0,0,  1,0,  77,0,83,0,32,0,83,0,97,0,110,0,115,0,32,0,83,0,101,0,114,0,105,0,102,0,0,0 ,0,0

data.b  3,0,1,80,  0,0,0,0,  7,0,  5,0,  53,0,  15,0,  0,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  85,0,115,0,101,0,32,0,73,0,99,0,111,0,110,0,58,0,0,0 ,0,0 ,0,0

data.b  0,0,129,80,  0,0,0,0,  60,0,  5,0,  100,0,  15,0,  1,0
data.b  69,0,100,0,105,0,116,0,0,0,  0,0 ,0,0

data.b  0,0,1,80,  0,0,0,0,  167,0,  5,0,  20,0,  15,0,  2,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  46,0,46,0,46,0,0,0 ,0,0 ,0,0

data.b  3,0,1,80,  0,0,0,0,  7,0,  25,0,  120,0,  15,0,  3,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  69,0,110,0,97,0,98,0,108,0,101,0,32,0,105,0,110,0,108,0,105,0,110,0,101,0,32,0,65,0,83,0,77,0,32,0,115,0,117,0,112,0,112,0,111,0,114,0,116,0,0,0 ,0,0 ,0,0

data.b  3,0,1,80,  0,0,0,0,  7,0,  44,0,  120,0,  15,0,  4,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  78,0,84,0,32,0,52,0,46,0,48,0,32,0,99,0,111,0,109,0,112,0,108,0,105,0,97,0,110,0,116,0,32,0,101,0,120,0,101,0,99,0,117,0,116,0,97,0,98,0,108,0,101,0,0,0 ,0,0 ,0,0

data.b  3,0,1,80,  0,0,0,0,  7,0,  64,0,  120,0,  15,0,  5,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  69,0,110,0,97,0,98,0,108,0,101,0,32,0,88,0,80,0,32,0,115,0,107,0,105,0,110,0,32,0,115,0,117,0,112,0,112,0,111,0,114,0,116,0,0,0 ,0,0

data.b  0,0,0,80,  0,0,0,0,  7,0,  84,0,  73,0,  15,0,  6,0
data.b  83,0,116,0,97,0,116,0,105,0,99,0,0,0,  69,0,120,0,101,0,99,0,117,0,116,0,97,0,98,0,108,0,101,0,32,0,70,0,111,0,114,0,109,0,97,0,116,0,58,0,0,0 ,0,0

data.b  3,4,129,84,  0,0,0,0,  80,0,  84,0,  107,0,  50,0,  7,0   
data.b  67,0,111,0,109,0,98,0,111,0,98,0,111,0,120,0,0,0,  0,0 ,0,0

data.b  0,0,0,80,  0,0,0,0,  7,0,  103,0,  67,0,  15,0,  8,0
data.b  83,0,116,0,97,0,116,0,105,0,99,0,0,0,  67,0,111,0,109,0,109,0,97,0,110,0,100,0,32,0,108,0,105,0,110,0,101,0,58,0,0,0 ,0,0 ,0,0

data.b  0,0,129,80,  0,0,0,0,  80,0,  103,0,  107,0,  15,0,  9,0
data.b  69,0,100,0,105,0,116,0,0,0,  0,0 ,0,0

data.b  1,0,1,80,  0,0,0,0,  7,0,  128,0,  87,0,  15,0,  10,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  79,0,107,0,0,0 ,0,0

data.b  0,0,1,80,  0,0,0,0,  100,0,  128,0,  87,0,  15,0,  11,0
data.b  66,0,117,0,116,0,116,0,111,0,110,0,0,0,  67,0,97,0,110,0,99,0,101,0,108,0,0,0 ,0,0

enddatasection
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

:)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Do you like it or it's too much cryptic to implement in the editor?

Now talking about exe size a dialog based application in PB should be very difficult to beat, except for asm. most languages use resource dialogs, wich are bigger.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

The Editor doesnt get such Dialogs because its
not readable and changeable by everybody.

Its only nice to see you finally figured out these things.
Its not as hard as some people think when they see these numbers... :)

cya,
...Danilo
(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Yes, you need the Window Editor to modify it, you load the .pbw
file and produce a new dialog template.

Once you understand the structures it's easy, and the numbers are
nicely grouped.. :)

your dialog example was my starting point, i can only say thanks :)
Post Reply